Trybotics Logo

Arduino Laser-based Timing System

DESCRIPTION

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.

Supplies:

  • Arduino R3 (or compatible board) - £4.50
  • Adafruit feather wing protoboard - A small section of any type of protoboard is also fine - £1
  • LCD keypad shield - Ensure this is made to fit the version of the arduino you have - £5
  • 2 x Light Dependent Resistor (LDR) module - Searching ebay for "arduino LDR" should show plenty of options - £2.30 each
  • 2 x Laser module - Searching ebay for "arduino laser" should show plenty of options. Make sure the power of the laser is not greater than 5mW. - £2.25 for three
  • 4 x Small tripod - £3.50 each
  • 4x 1/4 inch nut - To fit a standard tripod thread - £2
  • Clear acrylic for Arduino case £3
  • M3 nuts and bolts - £2
  • Plastic PCD standoffs - Kits of these can be had for quite cheap on Ebay.- £6.80
  • 4 x 3D printed enclosures - Material cost was around £5.
  • Ribbon cable - £5

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.

Description:

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:

  1. Turn on laser modules and check than each LDR can "see" the laser beam.
  2. Wait until LDR 1 detects a break in the laser beam, immediately start the timer.
  3. Wait until LDR 2 detects a break in the laser beam, immediately stop the timer.
  4. Show the resulting time on the LCD screen in milliseconds.

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.

LINK TO ARDUINO CODE

(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)

Description:

3D Print Enclosures
3 More Images

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.

Attachments

Description:

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.

Attachments

Description:

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.

Description:

Finally, you are ready to assemble everything.

  1. Mount the LDR and Laser module cases on the small tripods.
  2. Position the Laser modules to shine directly at the LDR sensor

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.

Description:

Operation and Further Work
5 More Images

You should now be ready to use the system! The images show the stages of operation.

  1. Press the select button to initialise the system.
  2. Align the lasers so that they shine directly on the LDR sensor.
  3. The system is now armed. Set you model car going.
  4. The system will start timing once the first laser beam is broken.
  5. The system will stop once the second laser beam is broken.
  6. The time in milliseconds is then displayed on the screen.
  7. Press the reset button to time another run.

I will probably create a version 2.0 of this system as there are some obvious improvements that could be made:

  1. There is no need to power the laser modules from the Arduino, they could be battery powered and simply switched on when needed. When I designed the system, wiring the laser modules to the Arduino for power seemed like the simplest solution, in practice, this results in long cable runs that get in the way.
  2. Condenser lenses are really needed on the LDR housings. Lining the laser dot up exactly with the centre of the (very small) LDR sensor is very tricky and can sometimes take several minutes, using a condenser lens would give the user a much bigger target to aim at with the laser dot.

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.


YOU MIGHT ALSO LIKE