Project tutorial
Arduino Nano LCD Stopwatch Without Potentiometer

Arduino Nano LCD Stopwatch Without Potentiometer © GPL3+

Project is showing simple stopwatch with start, stop and restart. It's a great project for learning how to use LCD with Arduino UNO or NANO.

  • 5,173 views
  • 9 comments
  • 14 respects

Components and supplies

About this project

Hello everyone!

This project is a simple learning project for starting with LCD. In this project I am using Arduino NANO and LCD QUAPASS 1602A 16x2. This stopwatch can count hours, minutes and seconds. You can also change the brightness of the LCD.

With just a little code change you can also count hundredths but for my LCD is not working because screen can not refresh that fast.

I have set up almost perfect timings for my stopwatch (my stopwatch has around 15% deviation so if you run it for real 10 minutes it will be 10 minutes and 2 seconds on my stopwatch). So if you are going to change anything is the start subprogram (in program subprogram named stopwatch) you will also need to change the timings because of the Arduino execution time on every code.

STEP 1

Connect wires to the Arduino and LCD like this (look at what SCHEMATIC is showing).

STEP 2

Copy and past my code down below in your Arduino IDE. And now plug your Arduino in USB drive. Click upload button and your program should be running.

STEP 3

Have fun with my simple and easy to make LCD stopwatch.

If you have any questions leave it in the comments.

Short video to show you how it works.

Code

CodeArduino
This is the code for my stopwatch. Just copy it in Arduino IDE and upload it on your Arduino.
/*Simple LCD stopwatch program with stop, start, reset and lap buttons.*/

//including liblary for LCD
#include <LiquidCrystal.h> 

//setting up LCD INPUT pins
LiquidCrystal lcd(12,11,5,4,3,2);

//setting hours, minutes, secound and miliseconds to 0
int h=0;     
int m=0;     
int s=0;     
int ms=0;    

//defines pin for all buttons
const int start_pin = 8;    
const int stop1_pin = 9;    
const int reset_pin = 10;   
    
//defines starting points (in my case 0)
int start=0;     
int stop1=0;
int reset=0;


int brightness_pin = 6; //defines pin for setting brightness
int brightness=100; //you can change this number to change brightness 

void setup() 
{ 
  
  analogWrite(brightness_pin ,brightness); //this sets brightness on pin 6
  lcd.begin(16 ,2);  //starting LCD
   
  //defining pins if they are INPUT or OUTPUT pins
  pinMode(start_pin, INPUT);  
  pinMode(stop1_pin, INPUT);
  pinMode(reset_pin, INPUT);
  pinMode(brightness_pin, OUTPUT);
} 
void loop() 
{ 
  lcd.setCursor(0,1); 
  lcd.print("STOPWATCH");  
  lcd.setCursor(0,0);  
  lcd.print("TIME:"); 
  lcd.print(h); 
  lcd.print(":"); 
  lcd.print(m); 
  lcd.print(":"); 
  lcd.print(s);
  
 start = digitalRead(start_pin); //reading buton state
 if(start == HIGH) 
 {
  stopwatch();  //goes to sub program stopwatch
 }
 
} 



//--------------------SUB PROGRAMS-------------------------



void stopwatch()
{
  lcd.setCursor(0,0);   //setting start point on lcd 
  lcd.print("TIME:");   //writting TIME
  lcd.print(h);         //writing hours
  lcd.print(":");      
  lcd.print(m);         //writing minutes
  lcd.print(":"); 
  lcd.print(s);         //writing seconds
  ms=ms+10;           
  delay(10); 
   
 if(ms==590)           
  {
   lcd.clear();  //clears LCD
  }
  
 if(ms==590)     //if state for counting up seconds
  { 
  ms=0; 
  s=s+1; 
  }
  
  if(s==60)     //if state for counting up minutes
  { 
  s=0; 
  m=m+1; 
  }

  if(m==60)      //if state for counting up hours
  {  
  m=00; 
  h=h+01;  
  } 
   
  lcd.setCursor(0,1); 
  lcd.print("STOPWATCH");  

   stop1 = digitalRead(stop1_pin);  //reading buton state
 if(stop1 == HIGH)    //checking if button is pressed
 {
  stopwatch_stop();   //going to sub program
 }
  else
  {
   stopwatch();    //going to sub program
  }
}

void stopwatch_stop()
{
  lcd.setCursor(0,0); 
  lcd.print("TIME:"); 
  lcd.print(h); 
  lcd.print(":"); 
  lcd.print(m); 
  lcd.print(":"); 
  lcd.print(s);    
   
  lcd.setCursor(0,1); 
  lcd.print("STOPWATCH"); 

   start = digitalRead(start_pin);   //reading buton state
 if(start == HIGH)
 {
  stopwatch();    //going to sub program
 } 
 
 reset = digitalRead(reset_pin);   //reading buton state
 if(reset == HIGH)
 {
   stopwatch_reset();    //going to sub program
   loop();
  }
 if(reset == LOW)
 {
  stopwatch_stop();    //going to sub program
 }
}

void stopwatch_reset()
{
 lcd.clear();
 lcd.setCursor(0,1); 
 lcd.print("STOPWATCH");
 h=00;    //seting hours to 0
 m=00;    //seting minutes to 0
 s=00;    //seting seconds to 0
 return;  //exiting the program and returning to the point where entered the program
}
Library
This is the library that you need for LCD.

Schematics

Schematics
This is a Schematics of my circuit.
Stoparica vjgwjgisyn

Comments

Similar projects you might like

Stopwatch with Arduino starter kit

Project showcase by mingmike

  • 1,189 views
  • 1 comment
  • 6 respects

Portable Arduino Temp/Humidity Sensor with LCD

Project tutorial by ThothLoki

  • 153,291 views
  • 115 comments
  • 185 respects

Ultrasonic Sensor with Alarm, LCD and Temperature

Project tutorial by MichDragstar

  • 4,645 views
  • 7 comments
  • 19 respects

Ultrasonic Sensor with LCD Display Using 433MHz

Project tutorial by mcharrison500

  • 2,811 views
  • 0 comments
  • 15 respects

Simple Arduino Digital Clock Without RTC

Project in progress by Annlee Fores

  • 96,159 views
  • 23 comments
  • 80 respects

Stopwatch and Lap Time Counter

Project showcase by LAGSILVA

  • 13,884 views
  • 5 comments
  • 24 respects
Add projectSign up / Login