# Measure ball speed with sensor inside

I came across a product which is a ball with a small Bluetooth sensor placed inside. This sensor, coupled with an app, can measure ball speed, height and length of throw. I wonder how this is possible, especially the speed and length of throw. Probably height can be measured with pressure sensors.

I've recently used a general purpose chip with accelerometers and gyroscope in different projects, but the speed and range of throws are definitely more complex to obtain.

Also we are dealing with a ball which randomly rotating in the 3D space.

Any idea? How can we achieve similar data acquisition?

• doppler radar products for sports training (e.g. tennis) are out there now, and do location mapping, integrated with video and vision software. I saw a demo of one this summer, very impressive, and reasonably priced (ie not extraordinary compared to training gear for serious athletes, which I ain't =] ) Commented Nov 24, 2021 at 19:44

As already mentioned, you would do this with accelerometers and gyroscopes.

Long term integration is a problem, but not in this case.

A thrown ball only "flies" for a few seconds. Integration over those few seconds shouldn't wander too badly.

The software in the ball monitors the accelerometer. As long as the acceleration is low (thrower standing still or walking around,) the ball keeps the accumulators for the acceleration and the gyroscope at zero - don't integrate, just keep setting everything to zero.

Once you get a high acceleration reading, you start the integration and keep it up until acceleration and rotation fall under some lower limit.

• thank @JRE, I'll give a try! how do you handle gravity and randomly rotation in 3D space? Commented Nov 25, 2021 at 8:21
• @neting.it It's more complicated than integrating acceleration, the gravity is particularly difficult to deal with. Check my answer for an alternative method. Commented Nov 30, 2021 at 10:28

I have done a similar application for a portable instrument for sportsman. The double integrating led to a very fast divergence, so no path or position was obtainable. Except I could get very accurate position of small deviations, like the gait bouncing height or the runner. The mean value was obtained using a large tap order FIR filter that was subtracted to the input values (double integral of acceleration), to eliminate the bias. These small deviation measurements were compared to the camera array system on the bench with a sportsman running.

So pretty difficult if you even rotate the coordinate system, also the sensor would be saturated in case of ball kick, or you will get very low precision data if you use high G sensor.

As for barometric sensor - it can't be used if the ball doesn't have a hole.

• I think the biggest point is, who is going to check the accuracy. And even if someone does, the manufacturer will just claim the ball is a novelty toy. I doubt the accuracy or precision is very good and likely barely researched. When I was a kid, a baseball was sold that had a small tactile switch and a small 3-digit display. It used time of flight for a standard 60.5-foot pitch. Timer started when the ball (button) was released snd some type of spring switch to sense the catch and stop the clock - the calculated speed was displayed on the LCD. Not intended for hitting. Oh, the memories. Commented Nov 24, 2021 at 13:40

One method is to use an accelerometer and gyroscope to track the position, however, this is quite hard to do and the accuracy is fairly limited due to the integration of the error. It is fairly hard to do and some devices like Woo do it, but the margin of error is perhaps 10-25% over a few seconds of computation.

A simpler way than integrating the acceleration for your ball and what is probably done, the ball weight is known and the direction of the hit in regard to the direction of gravity can be known as well as the hit intensity.

The time of the hit and the time when the ball hit the floor can also be known.

Based on this information, a trajectory can be computed.

However for a cheap gadget that could be enough.

A better way would be to use some receivers at known fixed locations, the ball emitting some wireless beacon signals and the receivers can measure latencies of reception between them, from which you can calculate the position. This would be fairly accurate.