Introduction: Arduino Stopwatch and Metronome
This is a pretty simple project in terms of the wiring and hardware setup. Most of the processing is done by the code, so no need for complicated circuits.
This project is just as its name describes. An Arduino is used to create a stopwatch, which can be turned into a metronome as well.
You have one momentary switch/button, which starts, stops, and resets the stopwatch. Every time you press the button, the state of the stopwatch changes. First, it is in its "home" mode, ready to begin timing. After you press the button, the stopwatch starts. After the second press, the stopwatch stops and displays the time that you recorded. With a third and final press, the stopwatch resets and goes back to the home page.
Another switch which is an SPDT switch that turns on or turns off the metronome. You can set the speed of the metronome in the code.
The build of materials is also shown in the photo for further clarification.
1) 1 x 3V piezo buzzer (link)
2) 1 x LCD screen. It can be 16x2 or 20x4. I only had a 20x4 remaining that's why I used that. Otherwise, 16x2 will be cheaper and easier to use. (link)
3) 40 x Male to Male and Male to female jumper wires (link). You need an assortment of male to male and male to female wire OR if you are comfortable with soldering, you can use any type of wire you want.
4) 1 x Push to make (PTM) momentary switch. (link)
5) 1 x SPST rocker switch (link)
6) 1 x Arduino Uno or Arduino Nano with its connecting cable. (link)
7) 1 x Breadboard (link)
8) 1 x Potentiometer or trim pot for controlling the LCD's contrast (link)
9) 2 x 10k Ohm resistors
Step 1: LCD Connection
Pins 2, 3, 4, 5, 11, and 12 of the Arduino is connected to pins 14, 13, 12, 11, 6, and 4 of the LCD, respectively.
Pins 1, 5, and 16 of the LCD are connected to ground.
Pins 2 and 15 of the LCD are connected to +5V.
Pin 3 of the LCD is connected to the middle terminal of the Potentiometer or trim pot.
The other two terminals of the Potentiometer or trim pot are connected to ground and +5V.
Pins 7, 8, 9, and 10 of the LCD are not connected to anything.
Step 2: Connecting the Other Components
We have to now connect the two buttons and the buzzer. Follow the step-by-step schematic. The first photo is for wiring the rocker switch. The second photo is for wiring the PTM momentary switch. And the third photo is for wiring the buzzer.
The first button, PTM momentary switch, is for start/stop/resetting of the stopwatch. One terminal of this button is connected to the +5V. The other end is connected to pin 10 of the Arduino. There is also a pull-down resistor of 10k ohms connected to pin 10 of the Arduino. This is added to remove any floating voltage.
The second button, SPST rocker switch is for turning on or turning off the metronome. One terminal of this button is connected to pin 8 of the Arduino. There is also a pull-down resistor of 10k ohms connected to pin 8 for the floating voltage as mentioned before.
The positive terminal of the buzzer is connected to pin 9 of the Arduino. The negative end of the buzzer is connected to ground.
Step 3: The Code
Here is a link to the code. You just have to upload it to the Arduino once you are done with the circuitry.
Step 4: The Trial
Participated in the
Arduino Contest 2020