Mood Tracker

by melissawolf729 in Circuits > Arduino

296 Views, 1 Favorites, 0 Comments

Mood Tracker

006A2483-DDD8-45D5-A031-18B2E5C27275.jpeg

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

2C670DEF-4F97-4CE9-9A61-B055D6F72F07.jpeg

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

006A2483-DDD8-45D5-A031-18B2E5C27275.jpeg

Print the box that will contain the Arduino Tinker Kit Redboard, Breadboards, LCD, cardboard, and buttons.

3D Print Lid

8FD483DA-A7E2-448E-916B-B3649CBFB770.jpeg

Print the lid to the box. The box has a hole for the LCD screen.

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

429DB34F-8CE2-40AA-A628-EA1223AD7036.jpeg
D9E30176-3D84-41C9-9A20-6A32BFAE1565.jpeg
D0FB86D6-2E83-4BA5-8EED-18C5AB82CD7D.jpeg
379F7F8F-2131-49C1-9082-D6D2365329AE.jpeg
506576CB-6A98-4EC8-9D00-70FA03F44103.jpeg

Assemble Items in Box

CFE1790C-F563-45BD-8A8A-81F376C84943.jpeg

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.