[posted] Laser gates for measuring sports ball velocity


For some contracting work this summer, I built some laser gates for detecting the transit of a baseball/softball at up to 135 miles per hour. The Teensy 4.1 has been an incredible board for getting the timing down. The design is made up of 4 emitter boards (no Teensy) and 4 sensor boards (one Teensy on each). Each emitter board has 34 laser diodes that can be aimed using three set screws. Each sensor board has 34 transimpedance amplifier circuits for a PIN photodiode. Using a validation fixture with a tightly controlled rotational velocity setup, I am detecting the point that the beam begins to be broken and the beam being restored to within about 3.75 microseconds.

Each detector board is connected to a Raspberry Pi4 over i2c, with a trigger to start the timing sequence just before the cannon fires the ball. Then, each Teensy polls the 4 ports that are connected to amplifier outputs as quickly as possible and stores the cycle counter time and the state of the 4 ports each time there is a change. After the completion of the firing sequence, a post-processing step unscrambles the ports into the bits that are triggered in geometric order. The RPi4 then retrieves all the timings and does a nonlinear least squares minimization problem based on the geometry of the ball's flight and the beam configurations to determine the incoming and rebound velocity.

Here is a photo of the boards mounted on the aluminum plates and a video of a shot from the cannon.


Here is the GitHub repository for my speed reading code for the laser beams.

I need to update that public repository with some updates where I cut the number of beams per teensy down to 20, but can now do it on only two of the GPIO ports and poll at about 67ns when overlocking the teensy 4.1.