Jump to main content

Make a Mood Tracker

Abstract

How do you feel right now? Do you remember how you felt a few hours ago? How about yesterday or last Wednesday? What if you could track your emotions throughout the day and use this information to help improve your mood and well-being? In this science project, you will program a simple, pocket-sized device that you can carry around with you to log your feelings whenever you want or on a specific schedule. 

Summary

Areas of Science
Difficulty
 
Method
Time Required
Short (2-5 days)
Prerequisites

None

Material Availability

micro:bit board required, see Materials section for details

Cost
Low ($20 - $50)
Safety

No issues

Credits
Science Buddies is committed to creating content authored by scientists and educators. Learn more about our process and how we use AI.

Objective

Program and test your own mood tracking device.

Introduction

Have you ever kept a paper-and-pencil journal about your thoughts and feelings? Have you used a life-tracking app on a smartphone, website, or computer? How did your mood or emotions change throughout the day or week? Did you notice any patterns or trends? Were your moods connected to specific events in your life? For example, maybe you felt excited on the day of a friend's birthday party and grumpy on a Monday morning when you had to go back to school. Keeping track of your moods can help you think about why you feel the way you do and might help you identify ways to improve your overall well-being!

In this project, you will program your own simple mood tracker using a device called a micro:bit. A micro:bit is a little programmable board with buttons and a grid of lights called LEDs. You can use the LEDs to display scrolling text or simple drawings like happy and sad faces (Figure 1). The micro:bit can also do data logging, which means it can store data that you can look at later. Data can be something physical, like the temperature or sound level in a room, but it can also represent something emotional. For example, you could rate your moods on a scale of 1 to 3, where 1 = sad, 2 = OK, and 3 = happy (you could use a larger number scale, too). Every time you rate your mood, you create a data point that has a timestamp, which tells you when the data was recorded.

Data logging can allow you to do some simple data analysis of your moods. You might decide to check in with yourself and give a mood rating at a few specific times of the day (like 9AM, 12PM, 6PM, and before bed). When you look at your data later, you might notice patterns. If your mood numbers trend low, for example, at noon on weekdays, maybe there is a reason? Maybe you need to adjust your eating schedule? Maybe you need to work in a short walk or break? Or maybe you really just do not like whatever class you have at that time. Sometimes, our moods are easy to match to external factors!

Figure 1. Two micro:bit boards displaying sad and happy faces. 

Since the micro:bit is pocket-sized, you can carry it around with you to keep track of your feelings throughout the day. You might keep it in a pouch attached to your backpack or keys. You could even rig a holder to wear your micro:bit mood tracker on a lanyard. Nothing says biotech can't be an accessory! At the end of the day (or week), you can upload the data to your computer. You can look at the data to see how your feelings changed throughout the day, and think about what events or factors might have caused those changes. If you look at your data weekly or monthly, you may be able to spot bigger trends and even identify lifestyle or health changes that might help improve your mood overall. The procedure of this project will show you how to get started programming a basic mood tracker, but you can customize how it works using the micro:bit's easy programming interface. You might even want to program a schedule so that the device prompts you at various points in the day, maybe with a beep, to stop, think about how you feel, and enter your rating. It just takes a second to check in with yourself, but the benefits can be huge! 

Terms and Concepts

Questions

Bibliography

Materials and Equipment

Experimental Procedure

This project follows the Engineering Design Process. Confirm with your teacher if this is acceptable for your project, and review the steps before you begin.
  1. If this is your first time using a micro:bit, follow the Getting Started instructions on the micro:bit website to learn how to use your micro:bit and how to connect it to your computer. 
  2. Decide what programming language you will use for your micro:bit:
    1. If you are new to coding, we recommend using Microsoft MakeCode to program your micro:bit. MakeCode is a graphical programming language that lets you make computer programs using colored blocks of code instead of a text editor. The example code in this procedure uses MakeCode. We recommend following a few of the MakeCode tutorials before starting your mood tracker project.
    2. You can also program your micro:bit in Python, JavaScript, or Scratch. You may prefer this approach if you already have programming experience in one of these languages. See the Let's Code page for more details.
  3. Start a new MakeCode program.
  4. Click +Extensions in the blocks menu and click the datalogger extension to add the data logging blocks to your blocks menu.
  5. Make the program shown in Figure 2. Here is how the program works:
    1. The on start block sets the program up so it is ready for data logging. 
      1. It creates an "emotion" column to log your mood. The timestamp for each entry will automatically be logged.
      2. For now, we will set the units for the timestamp value to seconds. This will allow you to quickly test your program to confirm that it works. When using the program to track your mood throughout the day, you will probably want to change the units to hours.
      3. Note: the timestamp is measured as elapsed time since the program started running or the micro:bit last powered on or reset. If you want to log your mood at the same time(s) every day, you will need to reset the micro:bit at the same time each morning.
    2. The on button A pressed block cycles the LED display through three moods: sad, OK (meaning not really sad or happy), and happy. Pressing the button a fourth time will turn the LEDs off to save battery power. 
    3. The on button B pressed block logs a data point for the mood that is currently displayed.
      1. It uses the value of a variable called emotion, where 1 = sad, 2 = OK, and 3 = happy.
      2. If you press button B while the LED screen is blank (emotion = 0), then it does not log any data.
      3. After logging the data, the screen displays a check mark for one second, then goes blank again.
    4. The on button A+B pressed block deletes the stored data. You can also delete the data by downloading a new program to your micro:bit.
Figure 2. Micro:bit code for basic mood tracker.
  1. Make sure your micro:bit is plugged into your computer with a USB cable. Then click the Download button to send the program to your micro:bit. 
  2. Practice using the program. Press the A button to cycle through the different moods. Press the B button to log the emotion. You do not have to log your real moods for now. You are just testing the program to make sure it works. Be careful not to press the A and B buttons at the same time until after you have uploaded your data to your computer, or you will lose all of your data! 
  3. When plugged into your computer, the micro:bit works like a USB flash drive. Open the micro:bit folder to see the files on it and double-click MY_DATA to view your data in a web browser. Ask an adult or see the instructions on the micro:bit data logging page if you need help with this part.
  4. You should see a table with one column for time in seconds and one column for the value of the emotion variable.
    1. If you click the Visual preview button, you can see a graph of your data (Figure 3).
    2. Click the Download button to download a comma-separated values (csv) file that contains your data. You can open your csv file in a spreadsheet program like Microsoft Excel or Google Sheets. 
Figure 3. Screenshot of micro:bit data logging interface.
  1. Look at the graph in Figure 3. Can you tell what happened based on the graph? In this example data, it looks like the person was happy, then something happened to make them sad, and then, after a little while, they felt better again.
  2. If you want, you can add a reminder to log your mood after a certain amount of time. You can do this using the every 500 ms block under Loops.
    1. This block will make the code inside it run at a specified interval. Try putting something from the Music menu inside the block to make the micro:bit play a sound or melody as a reminder.
    2. This block uses milliseconds (ms) to measure time. There are 1,000 milliseconds in one second, so there are 60,000 milliseconds in one minute, and 3,600,000 milliseconds in one hour! So, for example, to set a reminder every 3 hours, you would change the value to 3 × 3,600,000 = 10,800,000 milliseconds. 
    3. Remember that the micro:bit measures time from when it was last powered on or reset. So, to log your mood at the same times every day, you would need to power on or reset the micro:bit at the same time every morning. For example, if you set a reminder for every 3 hours and reset the micro:bit at 9:00 AM, then the reminders will go off at 12:00 PM (noon), 3:00 PM, 6:00 PM, and so on (you will want to unplug the battery pack overnight so the micro:bit does not wake you up at 3AM!).
  3. Once you have tested your program and have it working, you are ready to track your moods!
    1. Remember to change the units for the set timestamp block to hours instead of seconds. Re-download the program.
    2. Unplug your micro:bit from your computer and plug in the battery pack.
    3. Carry your micro:bit around with you throughout the day and use it to log your moods.
    4. At the end of the day, reconnect your micro:bit to your computer and open the MY_DATA file. 
    5. How did your mood change throughout the day? Do you remember what caused those feelings?
  4. Repeat this process for at least a few more days (preferably one week or more).
    1. Do you notice any trends or consistent patterns in your mood?
    2. If so, what do you think could be causing them? Can you make any changes to improve your mood?
  5. There are many other things you can do to change or improve your mood tracker. See the Variations section for some suggestions.
icon scientific method

Ask an Expert

Do you have specific questions about your science project? Our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.

Variations

  • Can you change your code to let the user select from a wider range of moods, for example, using a scale of 1-5 instead of a scale of 1-3? What else could you display on the LED screen instead of smiley and sad faces? Check out the options under Basic in the micro:bit menu to see what you can display on the LEDs.
  • The micro:bit has other inputs, called sensors, besides buttons. You can read more about them on the micro:bit sensors page. Can you write a program that uses other inputs besides the buttons? This could be an especially good option for small children who have trouble pushing the tiny buttons. For example, can you make it so they can shake the micro:bit when they're mad (using the accelerometer sensor), or cover it up to block light from hitting it when they're sad (using the light sensor)?

Careers

If you like this project, you might enjoy exploring these related careers:

Career Profile
Are you interested in developing cool video game software for computers? Would you like to learn how to make software run faster and more reliably on different kinds of computers and operating systems? Do you like to apply your computer science skills to solve problems? If so, then you might be interested in the career of a computer software engineer. Read more
Career Profile
Why people take certain actions can often feel like a mystery. Psychologists help solve these mysteries by investigating the physical, cognitive, emotional, or social aspects of human behavior and the human mind. Some psychologists also apply these findings in order to design better products or to help people change their behaviors. Read more

News Feed on This Topic

 
, ,

Cite This Page

General citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.

MLA Style

Finio, Ben. "Make a Mood Tracker." Science Buddies, 7 May 2025, https://www.sciencebuddies.org/science-fair-projects/project-ideas/HumBeh_p072/human-behavior/emotion-tracker. Accessed 16 June 2025.

APA Style

Finio, B. (2025, May 7). Make a Mood Tracker. Retrieved from https://www.sciencebuddies.org/science-fair-projects/project-ideas/HumBeh_p072/human-behavior/emotion-tracker


Last edit date: 2025-05-07
Top
We use cookies and those of third party providers to deliver the best possible web experience and to compile statistics.
By continuing and using the site, including the landing page, you agree to our Privacy Policy and Terms of Use.
OK, got it
Free science fair projects.