A stopwatch is a manually controlled time clock device designed for measuring the length of time that may have elapsed starting from a particular point of time when it was activated, and by the time it was finally deactivated.A bigger variant of the same device is called the stop clock which is used for monitoring the action from a distance and is normally found in sports stadium etc.
Earlier the traditional mechanical handheld stopwatch were more common, and used by all for the purpose.
In the mechanical system we had two press buttons for executing the stop watch functions. One for starting the stop clock by pressing once, and for stopping the time by pressing the same button once again for recording the elapsed time....the second button was used for resetting the clock back to zero.
Mechanical stop clock basically worked through spring power, which required period winding up manually by turning the given knurled knob at the top of the clock device.
However compared to the modern digital stop watches, the mechanical types can be considered significantly primitive and inaccurate in the range of milliseconds.
And today with the advent of microcontroller, these stop watches have become extremely accurate and reliable to the microsecond range.
Arduino stop watch circuit presented here is one of these modern microcontroller powered design which is most accurate can be expected to be on par with the commercial modern stop watch gadgets.
Let's learn how to build the proposed Arduino stop clock circuit:
You will need the following Bill of materials for the construction:
An Arduino UNO board
An Arduino USB cable
Once you have acquired the above material and hooked them up with each other, it's just about configuring the following given sketch code into your Arduino board and watch the magic of the stop clock functions.
Standalone Arduino StopWatch
By Conor M - 11/05/15
Modified by Elac - 12/05/15
// call the necessary libraries
// these are the pins used on the shield for this sketch
LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);
// variables used on more than 1 function need to be declared here
unsigned long start, finished, elapsed;
boolean r = false;
// Variables for button debounce time
long lastButtonPressTime = 0; // the last time the button was pressed
long debounceDelay = 50; // the debounce time; keep this as low as possible
lcd.begin(16, 2); // inicialize the lcd (16 chars, 2 lines)
// a little introduction 🙂
lcd.setCursor(4, 0); // set the cursor to first character on line 1 - NOT needed (it sets automatically on lcd.begin()
lcd.setCursor(3, 1); // set the cursor to 4th character on line 2
delay(2000); // wait 2 seconds
lcd.clear(); // clear the display
lcd.print("Press select for");
lcd.setCursor(2, 1); // set the cursor to 3rd character on line 2
lcd.print("Start & Stop");
int x = analogRead (0); // assign 'x' to the Arduino's AnalogueInputs (Shield's buttons)
if (x < 800 && x > 600 ) // if the button is SELECT
if ((millis() - lastButtonPressTime) > debounceDelay)
if (r == false)
lcd.setCursor(2, 0); // needed
start = millis(); // saves start time to calculate the elapsed time
else if (r == true)
lcd.setCursor(2, 0); // needed
lcd.print(" Final Time ");
r = !r;
lastButtonPressTime = millis();
if (r == true)
finished = millis(); // saves stop time to calculate the elapsed time
// declare variables
float h, m, s, ms;
unsigned long over;
// MATH time!!!
elapsed = finished - start;
h = int(elapsed / 3600000);
over = elapsed % 3600000;
m = int(over / 60000);
over = over % 60000;
s = int(over / 1000);
ms = over % 1000;
// display the results
lcd.print(h, 0); // display variable 'h' - the 0 after it is the
number of algorithms after a comma (ex: lcd.print(h, 2); would print
lcd.print("h "); // and the letter 'h' after it
if (h < 10)