
Countdown Timer
Arduino output
TEHILLAH MULOMBA
01
DESCRIPTION & MATERIALS
This is a timer designed to display amount of time left before submitting a paper during an exam. The time is displayed in the format HH:MM:SS (Hours, Minutes, Seconds). First the time duration is set. Then the timer starts once the board is ON. Once the set time is elapsed, the LCD will display "Submission Closed!!"and the LED light will come on.
1 Arduino Uno R3
1 10kiloOhms Potientiometer
1 220Ohms Resistor
1 LCD 16*2 screen
1 Yellow LED light
1 1kiloOhm Resistor
02
CODES
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//Sets the duration for the countdown
long hour = 0, minute = 0, second = 10;
long countdown_time = (hour*3600) + (minute * 60) + second;
//LED Pin
int LED = 10;
void setup() {
pinMode(LED, OUTPUT);
lcd.begin(16, 2);
lcd.setCursor(2, 1);
lcd.print("HH:MM:SS");
}
void loop() {
lcd.setCursor(0, 1);
//Calculates the time to be displayed
long countdowntime_seconds = countdown_time - (millis() / 1000);
if (countdowntime_seconds >= 0) {
lcd.print("T-");
long countdown_hour = countdowntime_seconds / 3600;
long countdown_minute = ((countdowntime_seconds / 60)%60);
long countdown_sec = countdowntime_seconds % 60;
lcd.setCursor(2, 1);
//Displays 0 if set duration elapsed
if (countdown_hour < 10) {
lcd.print("0");
}
lcd.print(countdown_hour);
lcd.print(":");
if (countdown_minute < 10) {
lcd.print("0");
}
lcd.print(countdown_minute);
lcd.print(":");
if (countdown_sec < 10) {
lcd.print("0");
}
lcd.print(countdown_sec);
lcd.print("s");
if (countdowntime_seconds == 0) {
digitalWrite(LED, HIGH);
}
if (countdowntime_seconds > 0) {
lcd.setCursor(0, 0);
lcd.print("Deadline In:");
}
//Displays text once duration elapsed.
else {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Submission");
lcd.setCursor(0, 1);
lcd.print("Closed!!");
}
}
delay(500);
}
03
OUTPUT

04
ANALYSIS
The system run smoothly and without fault.