Arduino LCD Count Down Timer Clock

Simple Count down timer Code can be updated to meet your needs.

Adjust the arduino countdown code for:

  • hours
  • minutes
  • seconds
  • You might need to update the LCD pin out for your brand of LiquidCrystal lcd, my LCD board is a sainsmart 1602

Count Down Timer LCD Arduino

Arduino LCD Count Down Timer Clock

When Arduino count down is completed it says:

END


#include <LiquidCrystal.h>
 //www.brilliantlyeasy.com/ 

int hours = 0; // start hours
int minutes = 0; //start min
int seconds = 5; //start seconds

//LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //<--removed- Different LCD manufacture
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);//Pin Code for Arduino SainSmart LCD 1602 KeyPad

void setup() {
}

void loop() {
 lcd.begin(16, 2);
 lcd.print("Count Down Timer ");

 // lcd.scrollDisplayLeft();
 // wait a bit:
 delay(150);

 while (hours > 0 || minutes > 0 || seconds >= 0) {

 lcd.setCursor(4, 2);

 (hours < 10) ? lcd.print("0") : NULL;
 lcd.print(hours);
 lcd.print(":");
 (minutes < 10) ? lcd.print("0") : NULL;
 lcd.print(minutes);
 lcd.print(":");
 (seconds < 10) ? lcd.print("0") : NULL;
 lcd.print(seconds);
 lcd.display();
 stepDown();
 delay(1000);
 }
}

void stepDown() {
 if (seconds > 0) {
 seconds -= 1;
 } else {
 if (minutes > 0) {
 seconds = 59;
 minutes -= 1;
 } else {
 if (hours > 0) {
 seconds = 59;
 minutes = 59;
 hours -= 1;
 } else {
 trigger();
 }
 }
 }
}

void trigger() {
 lcd.clear(); // clears the screen and buffer
 lcd.setCursor(5, 1); // set timer position on lcd for end.

 lcd.println("END ");
 delay(1000);

 lcd.display();
}

share with friends

Share to Google Buzz
Share to Google Plus
Share to LiveJournal
Share to Odnoklassniki

9 Responses to Arduino LCD Count Down Timer Clock

  1. love spell August 29, 2017 at 3:14 pm #

    Hi there,I check your blogs named “Arduino LCD Count Down Timer Clock – Brilliantly EasyBrilliantly Easy” daily.Your writing style is awesome, keep doing what you’re doing! And you can look our website about love spell.

  2. robert carriere March 21, 2017 at 8:56 pm #

    how would I code in an activation relay or more in the middle at certain intervals during the countdown.

  3. Bashir February 1, 2017 at 4:06 pm #

    pls can u guys help me out because there’s nothing like sainsmart 1602 in proteus 8.

  4. jame February 4, 2016 at 3:46 am #

    can you explain the symbol “?” and ” : NULL ” in the code ? I understand code but i don’t know what it mean

  5. furqan August 4, 2015 at 4:36 am #

    Thank you very much

  6. Inaam May 27, 2015 at 12:55 am #

    I want to the timer to start only when i a push button signal and i want to be able to control the start up countdown time manually using buttons
    can you please help me its kind of urgent

    • Jacob December 1, 2016 at 4:19 pm #

      Have you found a way to do this?

    • Kashif January 19, 2017 at 11:26 am #

      Here’s a countdown timer that will allow you to set the start time manually:

      https://youtu.be/FuC28F23vks

      KB

Leave a Reply