Introduction: Arduino Minutes Tracker
In this tutorial, I will teach you how to make a minutes tracker using an Arduino Uno. A minutes tracker is a device that you can use to keep track of how long you work on something over time. You press the start button to start counting minutes, and press the reset/log button to submit those minutes to a file. The file can be accessed and you can see how many minutes you've accumulated over time.
18 jumper wires
4 digit 7-segment display
2 10k ohm resistors
Step 1: Build the Hardware
Follow the schematic above to construct your minutes logger.
Note: the left-most digit of the 7-segment display was left unconnected because all the pins were used up. If you want to use all 4 digits, try an Arduino Mega.
Note: various brands of components will be set up differently. Be sure to check the precise wiring for your components.
Step 2: Code the Software
There are three substeps for coding the software: coding the timer, connecting the display, and implementing the logging. If you get stuck or don't want to code this yourself, feel free to check out my code here: https://github.com/alexacalkhoven/minutes-logger
Tip: when coding, have the program log seconds (not minutes) for easier testing.
Coding the Timer
The first part of the code essentially creates a stopwatch. It uses the start/stop button and reset button to keep track of minutes. Start by getting the start and stop button working: print elapsed time to the console after hitting the button, and pause it once you hit the button again. Hint: you will have to use the millis() function.
Hint: you will have to add a delay of about 20-50ms to ensure that the button does not turn on and off with one press.
Once you have this working, the next step is incorporating pauses. For example, if you start, stop, and start again, you want the timer to continue where you left off. I did this by keeping track of the length of the pause and subtracting this from the time before printing it.
Now that your start/stop button is functional, the next step is the reset button. The function of this is to set the time back to 0. Hint: remember to reset your start time and pause time variables.
Connecting the Display
Once your program is keeping track of time successfully, you need to send the time data to the 4-digit 7-segment display. You can create a counting function from scratch or get help online for displaying certain numbers. Make sure to set a limit of the maximum value your display can show (if you're using 3 digits this will be 999).
The last step is to keep track of the timing data in a file. This will be done using Processing, so make sure you have it downloaded before starting this step. You can store the timing data in any way that will be helpful for you. Personally, I had a column for the time logged and total time. Hint: use the PrintWriter class to write to a .txt file.
Step 3: Done!
That's it! Feel free to add on to this project and customize it for what you're tracking. Thanks for reading.