loading

This Instructable will show you how to make a stop watch out of an Arduino.

Step 1: What You Will Need

Please buy through these Amazon links as it helps me to keep making these Instructables (A small cut of Amazon's profit from the sale is given to me - It doesn't cost you anything!)

You Will Need:

- 1x Arduino Uno:

-US Link: http://amzn.to/2mikwN9

-UK Link: http://amzn.to/2e9HwgA


- 1x LCD Keypad Shield:

-US Link: http://amzn.to/2neqIEW

-UK Link: http://amzn.to/2fnLHTx


- 1x USB A - B Connector Cable:

-US Link: http://amzn.to/2ne6xqW

-UK Link: http://amzn.to/2e9NL3L

What I Recommend:

- Amazon Prime so you can get all your items the next day:

-US Link: https://www.amazon.com/tryprimefree?ref_=assoc_tag...

-UK Link: http://www.amazon.co.uk/tryprimefree?tag=instructabl00-21

- You could attach some of these magnets to attach the stopwatch onto nearly anything metal:

-US Link: http://amzn.to/2miAqqS

-UK Linkhttps://goo.gl/m4Bg1N


- Arduino For Dummies (very helpful when learning code):

-US Link: http://amzn.to/2mAWM99

-UK Link: https://www.amazon.co.uk/gp/product/1118446372/ref...

or

- Arduino Projects For Dummies:

-US Link: http://amzn.to/2mipWrj

-UK Link: http://amzn.to/2fMuCoS

Step 2: Slot the LCD Display Onto the Arduino

This step is very simple just slot the LCD display onto the Arduino.

Step 3: Connect and Install the Program

Just connect your Arduino to The Computer and install the program.

Update - Please use the Modified Stopwatch Program.

Step 4: Run Your Stopwatch

Now just run your stopwatch.

<p>i made it but i am sorry to say that it did not work for both versions</p>
<p>Very cool idea and a great starting point, thanks!!!</p><p>I did a bit of rewrite to make it more accurate and display the time as it progresses plus other tweaks :</p><p>/*<br><br>Standalone Arduino StopWatch<br><br>By Conor M - 11/05/15<br><br>Modified by Elac - 12/05/15<br><br>*/<br><br>// call the necessary libraries<br>#include &lt;SPI.h&gt;<br>#include &lt;LiquidCrystal.h&gt;<br>// these are the pins used on the shield for this sketch<br>LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);<br>// variables used on more than 1 function need to be declared here<br>unsigned long start, finished, elapsed;<br>boolean r = false;<br>// Variables for button debounce time<br>long lastButtonPressTime = 0; // the last time the button was pressed<br>long debounceDelay = 50; // the debounce time; keep this as low as possible<br><br>void setup()<br>{<br> lcd.begin(16, 2); // inicialize the lcd (16 chars, 2 lines)<br><br> // a little introduction :)<br> lcd.setCursor(4, 0); // set the cursor to first character on line 1 - NOT needed (it sets automatically on lcd.begin()<br> lcd.print(&quot;Arduino&quot;);<br> lcd.setCursor(3, 1); // set the cursor to 4th character on line 2<br> lcd.print(&quot;StopWatch&quot;);<br> delay(2000); // wait 2 seconds<br> lcd.clear(); // clear the display<br> lcd.print(&quot;Press select for&quot;);<br> lcd.setCursor(2, 1); // set the cursor to 3rd character on line 2<br> lcd.print(&quot;Start &amp; Stop&quot;);<br>}<br><br>void loop()<br>{<br> CheckStartStop();<br> DisplayResult();<br>}<br><br>void CheckStartStop()<br>{<br> int x = analogRead (0); // assign 'x' to the Arduino's AnalogueInputs (Shield's buttons)<br> if (x &lt; 800 &amp;&amp; x &gt; 600 ) // if the button is SELECT<br> {<br> if ((millis() - lastButtonPressTime) &gt; debounceDelay)<br> {<br><br> if (r == false)<br> {<br> lcd.clear();<br> lcd.setCursor(2, 0); // needed<br> lcd.print(&quot;Elapsed Time&quot;);<br> start = millis(); // saves start time to calculate the elapsed time<br> }<br> else if (r == true)<br> {<br> lcd.setCursor(2, 0); // needed<br> lcd.print(&quot; Final Time &quot;);<br> }<br> r = !r;<br> }<br> lastButtonPressTime = millis();<br> }<br>}<br><br>void DisplayResult()<br>{<br> if (r == true)<br> {<br> finished = millis(); // saves stop time to calculate the elapsed time<br> // declare variables<br> float h, m, s, ms;<br> unsigned long over;<br><br> // MATH time!!!<br> elapsed = finished - start;<br><br> h = int(elapsed / 3600000);<br> over = elapsed % 3600000;<br> m = int(over / 60000);<br> over = over % 60000;<br> s = int(over / 1000);<br> ms = over % 1000;<br> // display the results<br> lcd.setCursor(0, 1);<br> 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 0,00<br> lcd.print(&quot;h &quot;); // and the letter 'h' after it<br> lcd.print(m, 0);<br> lcd.print(&quot;m &quot;);<br> lcd.print(s, 0);<br> lcd.print(&quot;s &quot;);<br> if (h &lt; 10)<br> {<br> lcd.print(ms, 0);<br> lcd.print(&quot;ms &quot;);<br> }<br> }<br>}</p>
<p>Elac,</p><p>I only want to count time while the button or another input is present , how would I go about this?</p>
<p>I'm struggling to get external buttons to work - I want to add a start and stop but keep getting stuck! Anybody done this with the modified code? :) </p>
<p>Welcome to join the group :)</p><p>https://www.facebook.com/groups/305526369783769/</p>
how to install the program I don't see anything on my computer after connecting the arduino to it. do we need some software like matlab or something?
<p>Make sure you have downloaded the arduino software from https://www.arduino.cc/en/Main/Software</p>
<p>I want a coding I want to connect ir sensor to micro servo so that if something pass from front of ir sensor servo rotates at a 90 degree angle and returns to its initial position. I have a ARDUINO UNO for the purpose.... Can anybody do coding for this..PLZ PLZ PLZ THANK YOU... HOPE U REPLY...</p><p>please reply here --http://arduino.stackexchange.com/questions/28666/coding-for-connect-servo-with-ir-sensor-to-ardiuino</p>
The code is there for you to use
Check out one of my other instructables, how to make an arduino web server, it uses a servo, hope it helps<br>☺
<p>nice</p>
<p>Outstanding. I am using it and am happy to say it works without problem. </p>
<p>Great! here's mine: <a href="https://youtu.be/av8g8N9Z5RU?list=PLUf1E7DXqsCvVQ56yFzpO1OO22iZPvi5-" rel="nofollow">https://youtu.be/av8g8N9Z5RU?list=PLUf1E7DXqsCvVQ56yFzpO1OO22iZPvi5-</a></p>
<p>can somebody give me a version for measuring and displaying seconds,miliseconds and microseconds all on 3 digits each . If yes thanks in advance and contact me at mmedocean@gmail.com </p>
<p>works</p>
<p>on the line elapsed = finished - start I am getting an error 'start' was not declared in this scope.</p><p>Any ideas?</p>
<p>is your software up to date?</p>
<p>can i have the schematic diagram...</p>
<p>sorry I don't have a schematic</p>
<p>OK - got it working and it is great! Can you instruct me on how I can replace the SELECT button with an external switch for an experiment I am working on?</p>
<p>Very nice, works as it says. Thanks :)</p>
<p>Brilliant</p><p>I have tried to gather all my collection of websites and youtube channels and videos in one place. There are many things also to introduce to you in an elegant way so I established this site : <a href="http://www.speakelectronics.com/" rel="nofollow">www.speakelectronics.com</a> and I hope you like it.<br><br>Regards,<br>-----------------------<br><a href="http://www.speakelectronics.com/" rel="nofollow">www.speakelectronics.com</a></p>
<p>Wish I could see it!</p><p>it says data base error and then a blank page with only</p>&quot;Error establishing a database connection&quot;
<p>Very simple - I will give this s go this weekend, thanks :)</p>
sir , which pin of display is connected to which pin of arduino
I don't know but I got the module from banggood.com
sir , which pin of display is connected to which pin of arduino
<p>awesome project</p>
<a href="https://www.youtube.com/watch?v=-hDbhm5z-PI" rel="nofollow">Thanks Great tutorial!! check out this arduino browser</a>
<p>Very tidy Arduino project.</p>
<p>I have modified Elac's modified program please update your program to this one if you are using it.</p><p>Thanks</p>
<p>just uploaded it it is very good </p><p>Thx</p>
<p>I will upload this to my arduino</p><p>Thx</p>
Quite nice and easy! :)
Thanks<br>
Thanks

About This Instructable

48,212views

216favorites

License:

Bio: If it moves and it isn't supposed to move, Duct Tape it. If it doesn't move and its supposed to move, WD40 it ... More »
More by Conor M:Arduino Short Circuit Prevention Arduino Web Server Phosphorous Powder 
Add instructable to: