Simple Arduino Timer




Introduction: Simple Arduino Timer

About: I build projects using arduino nano / esp32 / arduino micro and also arduino mkr1010

Need a timer to check how much times you spent on a task ?
Or maybe you want to make a clock without a RTC module ?

I didn't find a code to make one easily so I share mine.
This is also a good test to check if your DFRobot LCD Keypad Shield works correctly and learn how to use it.

  • First, we will upload our code
  • Then, we will see how to use our timer.
  • Aftewards, i'll explain how to use the LCD/Keypad
  • Finally, I'll explain how to manage time

As always documentation and code are available in english/french on

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Make It!


  • Arduino Uno : 6€
  • DF Robot LCD Keypad shield : 4€

Total : 10€

You should find theses components easily on most E-commerce using these keywords
DF Robot shield is already soldered, you only have to plug it on the Arduino Uno.


Download the software, libraries and upload the code with Arduino

  • Download :
  • Copy lcdclock and libraries folder into your arduino sketchbook (Documents/Arduino)
  • Upload lcdclock.ino

Board : Arduino/Genuino Uno

  • The led on the LCD Keypad can be removed, if you find it too bright.
  • We didn't make a 3D printed case for this project, but you can find some on

Step 2: Manual

Here is a manual on how to use the timer.

  • LEFT: -1 minute
  • RIGHT: +1 minute
  • UP: +1 hour
  • DOWN -1 hour
  • RST: Reset timer
  • Select: Turn off/on backlight

You can use this manual as a template for your own projects:
Download: shield-manual.svg

Every illustrations / text in my tutorial are licence as Creative Commons (by) and available with the source code in the folder docs/

Feel free to use it in your own tutorials!

Step 3: Control the LCD/Keypad

All libraries on my projects are included with the source code.

Official DFRobot manual :


  • Setup screen
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup(){
	lcd.begin(16, 2);
  • Print Text
lcd.print("Hello World")
  • Set Cursor Position


  • Setup
int lcd_key     = 0;
int adc_key_in  = 0;
#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5

//Buttons are all on Analog0
int read_LCD_buttons(){
  adc_key_in = analogRead(0);
  if (adc_key_in > 1000) return btnNONE;
  if (adc_key_in < 50)   return btnRIGHT;
  if (adc_key_in < 195)  return btnUP;
  if (adc_key_in < 380)  return btnDOWN;
  if (adc_key_in < 555)  return btnLEFT;
  if (adc_key_in < 790)  return btnSELECT;
  return btnNONE;  // when all others fail, return this...
Check keypress
void loop(){
 lcd_key = read_LCD_buttons();  // read the buttons
 switch (lcd_key){              // depending on which button was pushed, we perform an action
   case btnRIGHT:{
	//Right button action
   case btnLEFT:{
       //Left button action
   case btnUP:{
      //Up Button action

   case btnDOWN:{
      //Down Button action
  case btnSELECT:{
     //Select Button action

Step 4: Manage Time

To manage the time , we are using timelib

  • Setup
  • Get time
void loop(){
	now(); //Get current time

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge



    2 years ago

    how do you pause this or stop?