As part of my teaching, I needed a system to accurately measure how quickly a model vehicle travelled 10 meters. Initially, I thought I would buy a cheap ready-made system from eBay or Aliexpress, these systems are commonly known as light gates, photo gates or similar. It turned out that pre-built light gate timing systems are actually quite expensive though, so I decided to build my own.
The operation of a light gate timing system is pretty simple. Each light gate consists of a laser module at one side, this projects a laser spot onto a light-dependent resistor module (LDR) at the other side. By measuring the output of the LDR, the system can detect when the laser beam has been broken. Using two of these gates the system starts the timer when the first beam is broken and stops the timer when it senses the second beam has been broken. The resulting recorded time is displayed on the LCD screen.
Building a system such as this with students is a great introduction to coding, it is also a really useful classroom resource once it is finished. This type of system is great for STEM activities and can be used to measure how fast things like rubber band cars, mousetrap cars or pinewood derby cars travel a set distance.
Disclaimer: The solution presented here is far from optimal. I'm aware some things could be a lot better or more efficient. This project was initially put together on a very tight deadline and worked absolutely fine for the purpose intended. I have plans to release both a version 2 and version 3 of this system with improvements, please see the last step of the instructable. Implementation of the circuit and code is at your own risk.
Total cost was around £55, this assumes access to both a laser cutter and 3D printer. Most of the cost here is for cases, nuts and bolts, etc. the actual cost of the electronics is only £22 so there is probably room for a lot of optimisation here.
Upload the code below to the Arduino. If you are unfamiliar with how to do this, check out this great instructable.
The basic logic of the code is as follows:
The code is only designed to time a single run, once the time from the screen has been noted down the reset button on the shield is used to restart the program.
(FYI: The code is hosted on create.arduino.cc and I would love to have embedded the code here, but the Instructables editor doesn't allow the embedded iframe to display or work correctly. If anyone at Instructables is reading this, please implement this as a feature in the future, thanks)
The laser and LDR modules need to be held in place to ensure that no beam breaks occur as a result of the modules moving. 3D print the enclosures below and bolt the modules in place, the laser module will need to be held in place with a zip tie as it has no thru bolt hole.
Be sure to trap a 1/4 inch nut inside each of the cases, this will be used later to allow these cases to connect to the tripods. The two halves of the enclosure are held together with M3 nuts and bolts.
Laser-cut the files below from the 4mm thick clear acrylic. Line up the arduino R3 and protoboard with the holes on the acrylic pieces and bolt into place. Bolt the top piece of the case to the bottom using the PCD standoffs as spacers.
The LCD shield used in this project is explained in detail in this great instructable. The LCD screen and input buttons use some of the arduino's I/O pins however, for this reason all I/O for the laser modules and LDR's use pins 1,2,12 and 13 only.
Very little wiring is needed, but ensure the circuit is connected as shown in the diagram. I added some JST type connectors to the laser and LDR module wires to allow me to easily disassemble and store the entire setup.
Yes, arduino pins 1 and 2 are directly powering the laser modules with no in-line resistor. As the laser modules selected are designed specifically for use with arduino this shouldn't be an issue though. The laser modules draw a maximum power of 5mW, this means that at the 5V supply voltage of the pin, the module should be drawing around 1mA, this is well below the ~40mA limit for current supply on arduino I/O pins.
Finally, you are ready to assemble everything.
At this stage, you will need to fine-tune things a little. The LDR modules output a digital signal, a high signal (5V) indicating that no laser beam is detected, a low sign (0V) indicating that it can see the laser beam. The light intensity threshold at which the module switches from a 5V to a 0V output signal (and visa versa) is controlled by a potentiometer on the LDR board. You will need to adjust the potentionmeter so that the module switches between a 0V and 5V output when you expect it to.
Either gradually adjust the potentiometer until the system functions as expected, or use a multimeter to measure the LDR module output and tune as required.
You should now be ready to use the system! The images show the stages of operation.
I will probably create a version 2.0 of this system as there are some obvious improvements that could be made:
I'm also now even thinking about a version 3.0 that is fully wireless and just connects to my laptop using Bluetooth, this is a much bigger project for another day, however.