I have a ball rolling along a grooved track and need to determine its speed. Typical speeds are in the range of 2-20 m/s. The balls are relatively shiny (think polished bowling ball.)

A common solution would be to use a pair of break beam sensors attached to the track and calculate the speed by determining how long the leading edge of the ball took to traverse the distance between the pair of sensors.

Unfortunately, my application requires that the equipment must be above the track and must not be closer than 1-4 meters. That is, some allow as close as 1 meter, some require as far as 4 meters.

I'm thinking about creating a kind of remote break beam sensor. An IR LED is focused into a line that crosses the track. As the ball passes through the plane of IR light, it will momentarily reflect a point of light (specular reflection) back up to the equipment where some type of photoelectric sensor can detect that reflection. Note that in this case, we trade leading edge for momentary point of reflection.

This will be using a Raspberry Pi. I can't control the environment where the track is setup. I fear a phototransistor might only work in certain lighting conditions, so I'm expecting to write software to filter the continuous input from an analog photoelectric sensor to detect the light reflection across a wide range of ambient lighting environments.

My questions:

  1. Is this a doable/reasonable approach? Or is there a better/common solution that I'm not aware of?

  2. Are there sensors that are sensitive enough for this application with adequate response times?

  • 1
    \$\begingroup\$ You say, "equipment must be above the track and..." How about a spot of retro-reflective tape? (e.g., amazon.com/dp/B06WVMLXMN) Would that be a rules violation if you put a half-inch square of reflective tape on the track? \$\endgroup\$ Commented Mar 25, 2022 at 21:33
  • 1
    \$\begingroup\$ Raspberry Pi is relatively powerful, you also have the option of cameras. Is your ball more reflective than the track, you might find it easier to process an interruption in a normally-present signal than a brief reflection off the ball (which may not even return directly to your sensor at any point along the ball's path) \$\endgroup\$
    – Ben Voigt
    Commented Mar 25, 2022 at 21:33
  • 2
    \$\begingroup\$ The reflection from a reflective sphere back to the source will be vanishingly small. You need to detect when the ball obstructs something permanent on the track, as @SolomonSlow suggests. \$\endgroup\$ Commented Mar 25, 2022 at 22:29
  • \$\begingroup\$ @solomonSlow - unfortunately I cannot physically modify the track in any way. I can only project IR light since it isn’t visible to humans. \$\endgroup\$
    – pauln
    Commented Mar 25, 2022 at 23:01
  • \$\begingroup\$ @BenVoigt - the ball only travels about 0.8 meters in some cases. The RPI cameras simply aren’t fast enough to capture a ball traveling at 20 m/s over that distance. Even a high speed (240fps) camera would provide questionable accuracy. \$\endgroup\$
    – pauln
    Commented Mar 25, 2022 at 23:10

2 Answers 2


Ambient lighting conditions can be addressed by chopping the infrared source at some high frequency. This is a solution used by TV remote infrared emitter/detectors - they chop at about 40 kHz. You might consider playing with these IR-remote chips...they are very easy to interface to a RPI, but since they are monolithic, there's little you can do to modify their output. Their range can extend to 10m for the direct case of LED-to-detector...but bouncing off a surface works too.

I've done red-LED ceiling-to-floor-back-to-ceiling beam-block system, but had the advantage of having a 3-inch square aluminum foil retro-reflector taped to the floor - you're not allowed such a device. For my case, optics were added to the red LED to confine the beam. A phototransistor with small glass lens was used as detector (amplified).
Optical design is really not part of EESE, but consider that specular reflection from a sphere will be very weak from 4m distance. The optical disturbance of the ball may be more detectable as @BenVoigt has suggested.


At this level of restrictions you are really pushing the limit of what is possible.

Problem with laser at this scale and conditions is that it can harm people. Shiny ball will leave one tiny hotspot on people's retina, if laser is more than a few milliwatt and people are nearby and looking at the ball. At the same time few milliwatt reflected of a shiny ball might be too few to be detectable under sunlight, even if you use modulated light.

Solution is ugly, but hey, its not like you have many options. You need to form much wider beam. Ideally of a size of a ball. And use enough power to light it up. IR is fine for this goal. Idea is to bring enough light that you can see the ball from a far, while making sure people nearby wont get hotspots on retina. And making a wide beam is the only option. Powerful laser can be used this way, with a large lense to expand the laser beam to a safe power density. But laser can be as easily concentrated back into a spot if some fancy optics will be in a way. So, apart from a wide beam you also need to make sure it ability to be concentrated back is destroyed. Thin film of white-ish plastic, in particular polyethylene, can do this. Alternative is to use LED that is much worse at forming the tight spot in the first place. Still, I would suggest to use the diffuser, thin plastic film, anyway. Since you dont care about precision and optics is needed anyway, i would suggest to use LED. Also less risk if device is partially broken. Both led lamp and diode lasers can be modulated about as well.

Now, once you have enough power, on the scale of 1w, you can use modulated light. And detect the bowling ball even in sunlight, while at the same time not burning people eyes, or their cameras. Lense on the detector helps to prevent the light from other areas affect it, same as it helps with the light emitter.

Make sure that power density of your setup is below the sunlight, preferably much lower. And make sure that no fancy optics can bring it back together to a density anywhere close to what it could do with the sunlight.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.