Devanimus: Ai-powered Mood Tracker & Enhancer + Chatbot

About the project

DevAnimus is a an AI-powered device which helps to track and enhance mood, which is paired with an additional app, where users can interact with a chatbot and improve mood.

Project info

Items used in this project

Hardware components

Google Aiy Vision Full Kit - Includes Pi Zero Wh - V1.1 Google Aiy Vision Full Kit - Includes Pi Zero Wh - V1.1 x 1

Software apps and online services

MIT App Inventor MIT App Inventor https://appinventor.mit.edu/
Thingspeak Thingspeak thingspeak.com
Google Dialogflow Google Dialogflow https://cloud.google.com/dialogflow

Hand tools and fabrication machines

Pliers Pliers May require for standoffs x 1

Story

Introduction

One of the worst issues in today's society is mental health, a worldwide epidemic affecting many demographics. From the elderly to teenagers, mental health is one of the largest issues which many face. A design which can help track the moods of loved ones (i.e. for doctors), which can simultaneously enhance their mood is required to help combat the epidemic.

One example case study for this design is for those who suffer from bipolar disorder, which can cause dramatic spikes in mood. This can help carers track their emotions and reach out remotely when required, thereby reducing the cost of care and also allowing for remote reach.

Kit and Software 

This project is built using:

  1. Google AIY Kit: This is an AI-Powered kit run via a Raspberry Pi which can help track mood
  2. Thingspeak: This will be used to help store the mood data through visual graphs and be used to determine the mood of the individual, and will be used to make the decision to enhance the mood if necessary,
  3. MIT App Inventor: External App to help present the mood data as well as acting as interface to enhance mood and offer a 'therapy' chatbot.

STEP 1: Assembling the AIY Vision Kit

Follow the steps on:  https://aiyprojects.withgoogle.com/vision

These steps will help you get started with the aiy vision kit, and will inform you on how to get setup. Before you get started, here are some top tips :

  • Ensure your Camera is adequately placed inside the connector latch, remember the black side of the camera aligns with the black side of the connector latch.
  • Double-check standoffs are being inserted into the correct holes, as they can be hard to remove.
  • Once you are started, the demo of joy detection will be played immediately.  Use the taskctl method to stop, and every time the device reboots it will play.
  • Safety Light or Buzzer not working ? Double check your connection, you may have the swapped around.

STEP 2: Modifying the Joy Detector Code

In order to send the data to thing speak we need to edit some of the code to send the value of joy through WiFi to thingspeak. The code is below, make sure to change your API key (write not read key) before starting.

STEP 3: Automatically turning on the camera

You can make the design automatically work without any buttons by using the raspi-config comand. Open the terminal and type:

  1. sudo raspi-config

Then proceed to enable the camera and reboot, you should be able to see the data being streamed on thingspeak.

STEP 4: Connecting to Mit App Inventor

There are many tutorials for parsing thingspeak data through to MIT App Inventor. This may take some trial and error but I recommend you check out: https://www.youtube.com/watch?v=gA-3cvfqHpY You need to store your mood data as a variable.

STEP 5: Logic for MIT App Inventor and Mood

After successful pairing the ThingSpeak data, we can now do something to improve people's mood ! Below is the logic !

You can choose a wide variety of options, such as playing music (in this example). However, if someone looks upset, they may require further assistance to get them back into happiness !An example is a chatbot, using Dialogflow !

STEP 6: Dialogflow Chatbot 

We can create a simple dialogflow chatbot, which uses google cloud ! This will help users to talk,and share the worries with an AI-Powered bot ! For this part we will use a knowledge base ! There is a great video here:  https://www.youtube.com/watch?v=kF33Ime0a2k

Create you gcs account, then go to dialogflow and create a new chatbot. Then enable knowledge bases and create a new base. Import your file, and build your bot !

Remember to ensure everything is relevant for your target audience ! You can update responses, but to extend you can even convert them into intents ! These will allow you to achieve even more ! You can connect dialogflow to smart appliances, e.g. lights.

To integrate the chatbot into the app, enable the web integration and then link the design into the webviewer element in app inventor.

Schematics, diagrams and documents

Google Vision Bonnet Fritzing File

Google AIY Vision Kit's Bonnet Schematic from AIY Vision Website (top view): https://aiyprojects.withgoogle.com/vision/#makers-guide--gpio-expansion-pins

Code

Edited Google Joy Demo

Replace the original with this version (copy and paste) . This has been added to stream data to thingspeak. Please replace ground URL and write key before testing ! Make sure it is the write key ! You may need to add a small time.sleep function, to prevent overheating. Failure to do so will cause lag with the LED updating ! Updates for ThingSpeak lines 269 : if joy_score > 0: self._leds.update(Leds.rgb_on(Color.blend(JOY_COLOR, SAD_COLOR, joy_score))) f = urlopen(groundURL + PRIVATE_KEY +"&field1=%s" % (joy_score)) print (f.read()) f.close()

Credits

Photo of SNatesan

SNatesan

Avid technology hobbyist in the field of pharmacology with research interests in psychopharmacology and neuroimaging based in the United Kingdom.

   

Leave your feedback...