Stopwatch and Countdown Timer Using Arduino and LCD
Stopwatch and Countdown Timer Using Arduino and LCD
Material Required:
• Arduino Uno
• 16x2 LCD with I2C interface
• 3 Push Buttons
• Breadboard and connecting wires
Software Requirements:
Theory:
The Arduino stopwatch and countdown timer operate by reading button inputs and
controlling time functions through the millis() function, which tracks the elapsed time
since the program started. In stopwatch mode, the time is incremented, and in
countdown mode, the time decreases from a preset value (60 seconds). The LCD
displays the time in real-time, allowing the user to interact with the device by starting,
stopping, resetting, and switching modes.
Circuit Diagram
• Three push buttons connected to digital pins 7, 8, and 9, with GND connections.
Circuit Explanation:
• The LCD is connected to the Arduino using I2C communication (SDA and SCL
pins).
• Three buttons are connected to digital pins 7, 8, and 9 of the Arduino. These
buttons allow switching between stopwatch and countdown timer modes,
starting/stopping the timer, and resetting the timer.
• The buttons use pull-up resistors (or Arduino's internal pull-up) to ensure proper
functionality.
Procedure:
o Connect the 16x2 LCD to the Arduino using the I2C interface.
o Connect the three push buttons to digital pins 7, 8, and 9 of the Arduino.
o Connect each button to GND using one side of the breadboard and use
internal pull-up resistors in the code.
o Open the Arduino IDE, paste the provided code, and upload it to the
Arduino board.
o Press the Start/Stop button to begin the timer, which will increment in
seconds on the LCD.
o Press the Start/Stop button again to pause the stopwatch.
o The LCD will display “Mode: Countdown” with the default countdown set
to 60 seconds.
o If the countdown reaches zero, the LCD will display "Time's Up!".
5. Repeat: You can alternate between the stopwatch and countdown modes and
test the functionality of the buttons.
Code:
Code Breakdown:
• The lcd object initializes the 16x2 LCD using the I2C protocol.
• Buttons:
Conclusion:
In this experiment, a simple stopwatch and countdown timer were created using
Arduino, an LCD, and push buttons. The system is user-friendly and effectively switches
between two modes, displaying the elapsed or remaining time. This project
demonstrates how basic timing functions and LCD outputs can be controlled using an
Arduino.