Skip to main content

Laser Sensor Timer using Arduino

I’ve made this project during project week in high school. This timer can be useful for timing races over short distances, because the result is more accurate than using handheld stopwatch. The average reaction time of a human is approximately 0.25s which is a lot when the total time can be as low as about 7 seconds.

List of parts that I used to make this project:

A laser is pointed to photoresistor which is connected to analog pin on the arduino. Using code below, you can read the value of analog ping (photoresistor) in range of 1 to 1000. The more photons fall on the photoresistor in a given time, the higher is the read value. The value of ambient light read from analog pin is in my case 400, and 800 while the laser is pointed at the photocell.

We can use this to determine whether there is a clear path between laser and photocell or not. Now we just need a display and a button to start the timer. Well we can also wire a starting pistol instead. Here is my diagram: (R1, connected to button, is 10k and R2 is 1.5k)

Arduino Timer Diagram
Arduino Timer Diagram

I used OLED 128×64 I2C display, which requires these two libraries: SSD1306 and GFX. You can use any Arduino compatible display.

Components on a breadboard
Components on a breadboard

And here is my final code. For timing, I’m using millis() function, which returns the number of milliseconds since the Arduino board began running the current program. When the start button is pressed, it saves value of millis in a variable and also current value of photoResistor. Then the program is displaying current time and constantly checking value of photoresistor. If it drops below 90% of a value at the beginning, it means that the path between laser and photoresistor is broken.
When I first made the program in school, I made it stop the timer at this event. But if we are using it for running, where you need to cross the finish line, timer shouldn’t stop just yet. Instead, it should wait until runner goes past the line and then stop the timer. So it waits for laser to shine on the photoresistor again and then stops the timer.

Timer System
Timer System

For now, timer can only store one value and if it was used outside on a bright day, difference between the values of ambient light and the laser on the photoresistor wouldn’t be sufficient. You can make cover for photoresistor so that only light from laser would fall on it, thus making the system more reliable. For keeping the laser directed, I used laser on distance meter, which I attached on camera tripod.

Here is a test video of my timer.