Arduino LCD Shield Countdown Timer with Menu

This countdown timer demonstrates practical use of our LCD menu library code. It features multiple timer profiles, and is targeted to work with Arduino R3 Uno/Leonardo/Mega2560 and LCD keypad shield similar to that in the picture below:

Arduino LCD Keypad Shield

Arduino LCD Keypad Shield

There are numerous manufacturers of LCD keypad shields that have the same or similar pin connections, and you must ensure that the timer source code uses the pin connections that are right for your shield. If the keypad buttons of your shield give different analog readings, you’ll need to make changes to file LcdKeypad.h. Bear in mind that the analog readings are not always consistent, which can lead to the occasional misreporting of a button press.

The count down timer has multiple profiles that are configurable using a menu. The Select button on the LCD shield starts/stops a timer, with a long press resetting the timer. A long press of Up enters the menu. Up/Down/Right buttons are for navigating the menu, and Select for choosing a menu item. When an item is selected, Up/Down are used for changing values. When the Reset menu item is displayed, a long press of Select loads default configuration values. Digital pin 2 is used for activating a beeper for the alarm.

The source code can be downloaded from the link below. You’ll need to find and install the TimerOne library for the code to compile.

Examining the source should give you good insight for using the menu system in your own projects. If you find this timer useful, please share it. Thank you for reading.

Share on LinkedInShare on Google+Tweet about this on TwitterShare on Facebook

22 thoughts on “Arduino LCD Shield Countdown Timer with Menu

  1. Rob

    In file included from MenuManager.cpp:2:0:
    MenuManager.cpp: In member function ‘void MenuManager::descendToChildMenu()’:
    MenuManager.cpp:132:19: error: invalid conversion from ‘uint16_t {aka unsigned int}’ to ‘const MenuItem*’ [-fpermissive]
    currentMenu = pgm_read_word(&(currentMenu[currentMenuItemIndexPos].childMenu));

    Help?

    Reply
    1. Kashif Baig Post author

      Hi Rob. Try inserting (const MenuItem*) after the = sign. It’s quite possible you have different compiler settings enabled to mine.

      Reply
  2. zach

    i am very new to arduino but when i try to press upload it says this:

    Arduino: 1.6.12 (Mac OS X), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

    /Users/student/Downloads/LcdCountDownTimer/LcdCountDownTimer.ino:5:22: fatal error: TimerOne.h: No such file or directory
    #include
    ^
    compilation terminated.
    exit status 1
    Error compiling for board Arduino/Genuino Mega or Mega 2560.

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    Reply
    1. Kashif Baig Post author

      Hi Zach. You’ll need to find the timerone library (on the internet) and install it.

      Reply
  3. David

    Hello Friend.
    I loved your project, it’s just what I was looking for to better understand the lcd shield and the timers.
    I have a problem, I do not work the “select” button in both arduino one, as mega.
    It does not give me compilation error, it just does not work that button.
    Do you know what it could be?
    Thank you and congratulations for your work.

    Reply
    1. Cohesive Computing

      Hi David

      It is possible that your select button is giving a different analog reading. I suggest you create a new project and try doing analogRead(0) and writing the result to the serial output to see what the value is.

      Reply
  4. Alexandre Bertoletti

    Dear friend Kashif Baig
    Lengths by beautiful design
    I do not have much ability with the C ++ language I have to study more
    I would like to have your help for my project
    I need that when I run the countdown the digital signal of the alarm is high during all counting time and that when the signal is finished it is low.
    Through this signal I will put in the base of a transistor driver to keep a relay closed during all counting and it will open at the end of the count.
    Thanks for your help and best regards to all.

    Alexandre

    Reply
    1. Kashif Baig Post author

      Hi. This file is included in the downloadable project files. Essentially, it is a file where you paste menu code, overwriting existing file content.

      Reply
  5. William Peters

    Hi,

    Great code! I’m currently operating on an arduino uni and using a DFrobot LCD keypad shield. The code works…except the select button does not. How will I fix this? I am really inexperienced with coding so I kind of need all the help i can get! if you could reply ASAP that’d be awesome.

    Reply
    1. Kashif Baig Post author

      Hi. In a separate Arduino project, perform an analogRead on pin A0 and output to the serial console. What values to you get?

      Reply
        1. Kashif Baig Post author

          Sorry, what I meant was what value(s) do you get from analogRead on pin A0 when you press the select button on the LCD shield?

          Reply
  6. John Hutchison

    William, the following sketch will get you the analogRead values for each button. You’ll just need to edit the display config to match what you have, and the analogPin you have the buttons tied to.

    #include
    LiquidCrystal_I2C lcd(0x27, 20, 4);
    int a=0;

    void setup()
    {
    lcd.init();
    lcd.init();
    lcd.backlight();
    pinMode(A12, INPUT_PULLUP);
    }

    void loop()
    {
    a = analogRead(12);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print(” analogRead() “);
    lcd.setCursor(0,1);
    lcd.print(” value is :”);
    lcd.print(a);
    delay(250);
    }

    Reply
    1. William Peters

      Would you be able to help me edit the original code to do these things:

      – Only have 1 timer option
      – Once timer has reached zero, initiate digital pin 12 and 13 (I had LED’s attached to 12, and vibration motors attached to 13.)

      If you could help me do this It would be greatly appreciated!

      Reply
  7. William Peters

    Does anyone know how I would be able to activate LEDs (Digital Pin 12) and Vibration motors (digital pin 13) when he timer value reaches 0? Could someone please help, I am very bad with code and any help would be amazing.

    Reply
  8. Dello

    Hi there sir, just wanna know how can we put the Finger Print sensor on the LCD shield.

    I mean the wiring of it.

    We’re using the Wido board and the LCD shield same came from the DFRobot and a Finger print sensor.

    We’re going to create a Senior citizen program using biometrics. And the thumbmark will be saved on our website is there any tutorial sir about the Wiring of the Finger print sensor on the LCD shield.

    https://circuit.rocks/lcd-keypad-shield-for-arduino.html

    https://circuit.rocks/wido-open-source-iot-node-arduino-cc3000?search=wido

    heres the link we’re we bought our LCD shield and Wido board with specification of it’s hardware.

    Thanks in advance for your help s

    Reply
  9. holger

    Hello,
    ich have also the problem that the select button not work. but i have try another skeetch and its ok. i setup the working analog readings but the same problem.
    select not working and if i pusch left it change the timers…
    i hope anybody can help me…
    my mail
    guldokat@gmail.com

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *