Mood Tracker
This is a Mood Tracker, which can be used in classroom settings
Supplies
- Arduino Tinker Kit
- 3 buttons
- 1 Redboard
- 2 Breadboards
- Wires
- Resistors
- Battery pack
- LCD screen
- 4 AAA Batteries
- 3D Printer
- Tri-wall cardboard (Approx. 8 in. x 3 in.)
3D Print Buttons
Print the buttons to attach from the outside of the Mood Tracker. These buttons will trigger the Arduino buttons inside of the box.
Downloads
3D Print Box
Print the box that will contain the Arduino Tinker Kit Redboard, Breadboards, LCD, cardboard, and buttons.
Downloads
3D Print Lid
Print the lid to the box. The box has a hole for the LCD screen.
Downloads
Code
Copy this code into the Arduino IDE app.
#include <LiquidCrystal.h> // liquid crystal display library
LiquidCrystal lcd(13, 12, 11, 10, 9, 8); // Arduino pins connected to the display
// pushbutton pin
const int happyButtonPin = 3;
const int sadButtonPin = 5;
const int okayButtonPin = 4;
//create a variable to store a counter and set it to 0
int happyCounter = 0;
int sadCounter = 0;
int okayCounter = 0;
int happyButtonState = 0; // current state of the button
int sadButtonState = 0; // current state of the button
int okayButtonState = 0; // current state of the button
void setup()
{
// Set up the pushbutton pins to be an input:
pinMode(happyButtonPin, INPUT);
pinMode(sadButtonPin, INPUT);
pinMode(okayButtonPin, INPUT);
// we are using a display that is 16 characters wide and 2 characters high
lcd.begin(16, 2);
//clear the display
lcd.clear();
}
void loop()
{
//read the digital state of buttonPin with digitalRead() function and store the //value in buttonState variable
happyButtonState = digitalRead(happyButtonPin);
sadButtonState = digitalRead(sadButtonPin);
okayButtonState = digitalRead (okayButtonPin);
//if the button is pressed increment counter and wait a tiny bit to give us some //time to release the button
if (happyButtonState == HIGH) //
{
// add 1 to counter
happyCounter++;
// waiting...
delay(1000);
}
if (sadButtonState == HIGH) {
// add 1 to counter
sadCounter++;
// waiting..
delay(1000);
}
if (okayButtonState == HIGH) //
{
// add 1 to counter
okayCounter++;
// waiting...
delay(1000);
}
// set the cursor in the top left corner
lcd.setCursor (0,0);
// print number of button presses
lcd.print ("Happy ") ;
lcd.print (happyCounter) ;
lcd.print(" Sad ");
lcd.print(sadCounter);
// move down to next line
lcd.setCursor(0, 1);
lcd.print ("Okay ") ;
lcd.print (okayCounter) ;
}
Assemble Redboard, Breadboards, and LCD
Assemble Items in Box
Place the Mood Buttons in the holes, lining them up so the pegs touch the Arduino buttons. Place the carboard behind the Breadboard to support it.
Finished Product
The final product will keep a tally of how many times each button was pressed (Ex. Happy 1, Okay 0, Sad 3). This is displayed on the LCD screen, which sits in the opening of the lid of the box.