Introduction: Arduino Based Lap Timer
We recently got hold of a "Crazy Cart", a seriously cool cart to race around with. As we only have one, I did want to have something to make the driving a bit more competitive, so I build an Arduino Based Lap Timer.
The Lap timer uses an "Infrared light bridge" (Velleman PEM10D) to detect when something crosses the line. The nice thing about this light bridge is that it only needs on one side electronics. The other side just needs a passive reflector. If you do not want to buy this light brigde, you can use an laser bean on one side and a photodiode on the other side, but that will require "electronics" on both side.
Besides that I added one of those cool thermal printers, so I can print out the actual lap time and total time.
To display the time and lap count I use these large Adafruit (i2c controlled) 7 segment display.
The frame is constructed by Makerbeam components.
Step 1: Putting Everything Together
We (Me and Levi(13)) build a basic A frame out of makerbeams, using the 45 degrees brackets to create a self standing structure.
To mount the LCD panels, button face plate (created out of 2mm Aluminum plate on my CNC) and arduino to the makerbeam we use M3 spacers which are threaded on both sides, allowing us to easily screw everything together. If you do not happen to have a CNC machine, you can of course 3D print a face plate or just cut something out of thick carton.
In the back we create a simple rectangle out of makerbeam to tightly fit the Thermal printer. and we use some brackets as holders for our LiPo Battery.
The Arduino with an protoboard are mounted on the back.
Step 2: Connecting All the Electronics
Buttons:
The buttons are connected with 10K resistors, this is then connected to ground and an Analog port on the arduino. This allows you to easily connect multiple buttons to a single port on the arduino. If the 3rd button is pressed it has to travel thru 3x 10K resitor, based on the the analog value changes depending on how many resistors are traveled thru.
7 Segment Display:
I am using the large Adafruit 7 Segment displays with I2C backback, I2C allows you to connect multiple devices on a 2-wire communication network. Each I2C device does need an unique address! Out-of-the-box each adafruit 7 segment display has the SAME address, so you need to solder one of the address pins on the 7 segment display to make sure each display has a different address.
Power:
For power I am using a 11.2 Volt LiPo battery, which easily can power the arduino, printer and sensors for a long time. Different components use different power. The light bridge need 12volt, so it is directly connected to the battery. The thermal printer want power between 5 and 9 volt. I am using a step down power module to convert the LiPo power to 8 volt. This is then supplied to the raspberry and (via the VIN port) to the thermal printer.
I have placed a switch between the battery and all the electronics, so I can easily turn everything on / off.
Thermal Printer:
I am using one of those cool thermal printers from sparkfun. They connect via Serial, as I want to leave the hardware serial port for debugging, I am connecting it so pin 2/3 and using software based serial. (so no real UART is used).
Infrared Light Bridge:
I am using a Velleman PEM 10D, infra red light bridge. I used an infrared transmitter and received in the box and an external reflector. If you do not want to buy this sensor, you can create a "light bridge" in many other ways. One could be an light diode or infrared receiver LED and point a battery powered laser pointer at it.
Step 3: The Software
Enclosed is the Arduino software code I wrote for my Laptimer.
Just load this in the Arduino software, make sure you have set the correct Arduino board for your setup and configure the varianbles in the top of the code if needed.
When you run the software, it has 2 "Modes".
- Race mode: This is started by clicking the left "race" button. This will start the laptimer. It uses a "flying start" principle. So there is no count down, just start racing, when the first time you cross the line, the timer will start. It will display the amount of laps still to go on the top 7 Segment display and the time on the 2nd 7 segment display.
-Setup mode: When you click on the "menu", 2nd button, you can setup how many laps you want to race. By turning the pot-meter you can select between 1 and 9 laps.
In the code you will find the variable int clockSync = 7600;
This variable allows you to calibrate the time. If you find that the laptimer runs too fast, increase the number a little bit, if you find the timer runs to slow decrease the number :-)
An other important variable is the int minLaptime = 1000;
This variable is used to make sure then when you trip the sensor it can not directly be tripped again, thinking you have finished. By default the minimum time is 10 seconds (1000 milliseconds). If you racing something that will go faster then 10 seconds, you will need to decrease this minLapTime variable.
Feel free to modify / copy / distribute the code in any form or shape you like.
Attachments
Step 4: Use Cases
So what can you use this lap timer for.... well anything when you want to be competitive without directly racing another person.
We have use it for our crazy cart, running and cycling around the house...
As long as you position the light brige sensor correctly, you can have a lot of competitive fun! The sensing range of the PEM10D is 10 Meters (33 feet), so you can really have a big start/top line.
Have fun racing!!!

Participated in the
Outside Contest 2016

Participated in the
Automation Contest 2016
30 Discussions
3 years ago
great project, have modified it for single event and one display, less switches,wireless remote gate. works great.
green and yellow wires on diagram are reversed.!!!
Reply 3 months ago
Hi celad2001
Could you post the modified code?
Reply 1 year ago
Good day sir. Can you please share the components. Would like to make one
Question 4 months ago on Step 3
Hi me again,,,,
What is the ohms on the pot meter?
Answer 3 months ago
Hi tribbesd
I'm using a 10K pot and it's working as expected.
Tip 3 months ago
If you purchase the Adafruit displays from the link and solder the A1 jumper the address is 0x72 not 0x71 as in the code. To use 0x71 you would solder the A0 jumper.
4 years ago
Hello ! it is a great instructable ! I love the idea :)
but I have some questions...
How much does it cost ?
The time is created by the software ? (I can't read the code right now...)
thank you for this instructable, it is amazing :D
Reply 4 months ago
The code can be downloaded and opened without the Arduino IDE installed by changing the extension to a .txt
Reply 4 years ago
Hi,
The lap timer works based on a "flying start". So when the infrared beam is broken, the clock starts ticking. The arduino (the software) clocks each laps and in the end prints out the times.
If you want to read the code, you can open it with the Arduino IDE.
I think the components are about 100 euros in total, but many are fully re-usable for other projects and you can use a cheaper laser / light sensor as infra-red bridge, reducing the cost.
Question 4 months ago
Hi the_anykey
I love this project, it's exactly what I was looking for. I purchased a through beam sensor and wanted to bench test it with the timer code before I purchase the LCD displays. I would be eternally grateful if you can post a modified version of the code to allow testing with just a photo sensor and Arduino using the serial monitor on the computer. I love your setup but I don't have the funding to include the printer. Thanks for any help or advice anyone can provide.
Question 4 months ago on Introduction
Hi,
Is the Velleman PEM10D no or nc?
Question 5 months ago
Love it, almost perfect for what I need to make, except I need 6 digits IE: 14.9062 seconds... have any idea how I could do this? it's for the kids when they play with the horses, there are systems out there built for that but are way out of reach money-wise, I could build this, would be even better if it could transmit the results to a PC or even better a mobile phone ( WiFi?? Bluetooth???) if I could get some help, I would document the build and maybe make an instructable with links to the original post? Would love some help, this is way above my pay grade but it would help us and a lot of other people, I've seen many in my search...
Answer 5 months ago
do you need accuracy of 4 decimal places of a second? because I doubt the timing of the arduino is that accurate:-)
you can easily swap the arduino with an esp32 so you have build in wifi and send out the times to a webservice or to IFTTT
have you programmed and ESP32/arduino before?
Reply 5 months ago
The timing does not have to be that precise, as long as it's close, a constant in the results is more favorable, it is a play thing after all. The four decimals is the norm when it comes to horses and barrel racing as seen on TV. When I was a kid we played sheriff and bank robbers, now they race their ponies. I have barely any basic understanding of arduino codes, never even seen an esp32 in the flesh as it may...
8 months ago
would you be able to get me a materials list by chance? Thanks!
Reply 8 months ago
this pictures has all the electronic parts shown:
https://cdn.instructables.com/FTF/EOV8/IPH0JYIE/FTFEOV8IPH0JYIE.LARGE.jpg?auto=webp&width=1024&height=1024&fit=bounds
Reply 8 months ago
Sorry, not really, as I mainly used parts I just have laying around.
But main parts are 2 x 7 segment (i2c) displays, Arduino, Light bridge sensor, thermo printer and makerbeam parts for the frame.
1 year ago
Great project, I built something similar for Karting but smaller as the timer was mounted on the steering wheel and the infra red beam sent from the pit wall. Love the fact that you made this portable by adding the lipo. The printer is cool too.
Would be interesting to find out how much it cost?
3 years ago
hi I am new to this. Can you please list all the components needed to make this. I want to make it also. are the components available on eBay?.
Reply 2 years ago
Hello
Did you ever receive a list of the components. I would like to purchase them as well.