Mood Tracker! Get Feedback on Feelings (ESP8266 - Adafruit IO - IFTTT)
by MertArduino in Circuits > Microcontrollers
1981 Views, 27 Favorites, 0 Comments
Mood Tracker! Get Feedback on Feelings (ESP8266 - Adafruit IO - IFTTT)
My daughter started primary school this year, and primary school is challenging for students and that's normal! But children sometimes avoid sharing how they are feeling with their parents. This is where I thought of a way to get feedback, and decided to make a mood tracker. The system includes two "thumbs", and has some LED strips to make it look fun. A simple distance sensor detects when the device is approached and the device is activated. An "up thumb" indicates a "good" mood and a "down thumb" indicates a "bad" mood, and a different colored light appears for each mood expression. The "mood tracker" provides feedback by e-mail through a Wi-Fi board and a few other tools. You can develop this project to find out how your students, family, or office colleagues are feeling, let's get started!
Tactile Switch Button Circuit
First of all, two tactile switch buttons are needed to read the thumb actions. I also used drilled PCB to build and fix the switch buttons circuit. Finally, a resistor is needed for the switch circuit to work properly. With the help of a soldering iron, I solder and fix the circuit components and complete the connections. After the two switch circuits are prepared, I fix the switches with the help of glue on the inside of the back cover of the 3D box where the whole circuit will be placed. Then, I commonly connect the switch circuit power line with the help of a clip.
Breadboard Circuit Diagram
Once the switch circuit is complete, we need to make the circuit connections that contain the whole system. A breadboard and some jumpers are needed for the base of the circuit. You can easily build your circuit by following the shared circuit diagram.
Printed Circuit Board
However, to avoid a complex circuit, I will use the printed circuit board that I have designed before. This printed circuit board is suitable for this project and many other projects. If you would like to have this PCB, you can easily order it from PCBWay by following the shared link.
https://www.pcbway.com/project/shareproject/Mood_Tracker_Get_feedback_of_feelings.html
You can find the list of components used in the printed circuit board in the video descriptions.
- Wemos D1 Mini (ESP8266) x1
- 16V 100uF Capacitors x2
- Soil Moisture Sensor x1
- Water Level Sensor x1
- Water Pump Motor DC 3.3V - 5V x1
- 330ohm Resistor x1
- 10K Resistor x1
- IRFZ44N Mosfet x 1
- 5V 1A Power Supply
- Jumper Wires
- Breadboard
You can easily assemble the components using a soldering iron and soldering wire. The heart of the PCB is a Wi-Fi-based WeMos controller, you can use all I/O pins on the WeMos with both terminal blocks and headers. There is also a MOSFET on the board, which has an external power supply and allows you to switch digitally.
PCB Circuit
We start the circuit connections by first wiring the 3.3 volts and ground line common to the switches. Then, make the digital pin connections to read the switch values. Next, connect the LED strip connections to the digital, ground, and 5-volt inputs respectively. Next, complete the ultrasonic distance sensor connections. Finally, make the ground and power connections to supply 5 Volt power to the circuit. Let's move on to the next part, programming the board.
Source Code (Adafruit IO)
Open the shared source code, then install the required libraries. As an example, I will show the Adafruit library installation. We will use Adafruit IO to save the switch data and trigger some actions based on the read values. The library is compatible with many boards. After completing the library installation, go to Adafruit IO and create two New Feeds from the Feeds section to save the read values. I defined two feeds as "vote good" and "vote bad". To ensure correct communication with Adafruit IO, you must add your unique username and key number to the code.
Downloads
If This Then That (IFTTT)
We will use IFTTT to get feedback on the data saved in Adafruit. We need to create two Applets. Find Adafruit and select "if new data is received", in this section you will be asked to connect with your Adafruit IO account. If "vote good" data is received, we will trigger the "send me an email" option. Set the subject and message content for the email, you can use HTML codes when editing. Create the "vote bad" applet in the same way and let's go back to the code.
Source Code (Functions and Definitions)
In the code, your WiFi information and the feed names created in Adafruit must be updated. In the "Setup" section, firstly pin modes are specified, and then Adafruit IO and strip LED initial settings are defined. In the "Loop" section, the functions to be executed when the distance sensor detects an object is defined. Outside the "Loop", there are functions for object detection and LED color to be activated when an object is detected. In the LED color section, you can update your preferred color values. Then, the operations to be executed when the buttons are pressed and the LED colors to be displayed are defined. Again, you can update the colors that will light up when the buttons are pressed according to your preference. Finally, at the beginning of the source code, you can update the pins to which the components are connected, the distance threshold value, the LED brightness value, and the LED delay values.
Testing Circuit and Source Code
After uploading the source code to the board, let's test our circuit! Supply the circuit with 5 volt 1 amp power and then test if the distance sensor, buttons, and LED lighting are working correctly.
Assembling the Circuit to 3D Design
If your circuit is working correctly, let's place the whole circuit in our 3D enclosure in the next section. You can find the 3D models from the shared link. Finally, we have come to the end of one more project, you can improve the project and expand its usage areas depending on your personal preferences. Write your thoughts in the comments about what you would add to the project. Thank you for reading.