I'd like to build a self-contained bicycle distancemeter similar to those now used by local police, i.e. that measure and display the distance between the bicycle handlebar's end and passing cars and beep when distance is less than 1m on 50-km/h roads. In order to avoid detecting cars when stopped at traffic lights, I need to determine whether the bicycle is moving above a minimum speed, say 10 km/h. How can I do that without having to install additional hardware on the bicyle, like a magnet on the wheel and a sensor on the fork? Accelerometers?

  • 1
    GPS is probably simplest.
    – Majenko
    Aug 24, 2019 at 18:45
  • Accelerometers are not a good choice for this, since they output nothing on constant speed. Like Majenko wrote, GPS is the simplest
    – chrisl
    Aug 24, 2019 at 19:00
  • Many GPS modules will directly report your ground speed to you.
    – Majenko
    Aug 24, 2019 at 19:34

2 Answers 2


I have built many years ago a device nearly identical to what you describe. I did not have the additional requirement of a minimum speed of 10 kph, however. As noted in the comments, that is likely best resolved with GPS as you are detecting motion, not absolute speed figures.

I used "arduino gps library" as the search terms and found many options. One of them, TinyGPS++ appears to have what you require and much more:

TinyGPS++ is a new Arduino library for parsing NMEA data streams provided by GPS modules.

Like its predecessor, TinyGPS, this library provides compact and easy-to-use methods for extracting position, date, time, altitude, speed, and course from consumer GPS devices.

However, TinyGPS++’s programmer interface is considerably simpler to use than TinyGPS, and the new library can extract arbitrary data from any of the myriad NMEA sentences out there, even proprietary ones.

I would definitely appreciate the "considerably simpler" aspect, as well as the "extract arbitrary data" portion, which seems specific to your project.

There may be other libraries that provide your objective, this was the first on the search returns.

The device I constructed used the common ultrasonic detector with a transmitter and receiver pair, coupled to a set of seven-segment LED display blocks. When the slightly-less-than-one-meter distance was presented, my device would trigger a pair of cameras. For your beep purpose, it would be straight-forward to redirect the camera trigger to a piezo speaker module or any other suitable audio device. I did not require GPS or other speed information.

  • I realize I already own a self-contained matchbox-sized USB-rechargeable Bluetooth GPS from Globalsat. So it's just a matter of getting a Bluetooth shield or a Bluetooth-equipped Arduino board. Aug 27, 2019 at 2:07
  • I like your idea of the camera. I gather I then need an SD shield to store photos. No Arduino board has all that? Aug 27, 2019 at 2:08
  • The cameras I used were off-the-shelf point-and-shoot digital cameras made by Canon. They support CHDK modifications which allow for remote shutter release. I'm unfamiliar with SD/Arduino/cameras.
    – fred_dot_u
    Aug 27, 2019 at 9:24

GPS would be simple in terms of being self-contained, but a GPS module is somewhat expensive, and is also a big power drain.

I'd recommend a wheel sensor. Some modern wireless bike-computers use accelerometer based wheel RPM sensors. You attach them to the spokes and they detect the motion with/against the force of gravity as they travel up and down. They use wireless communication like BLE (Bluetooth Low Energy.) If you added a BLE module to your Arduino you might be able to pair it with a wireless RPM sensor and measure speed that way, with no wires or magnets needed.


I don't know for sure what wireless protocol these accessories use. If it's not BLE then interfacing them with an Arduino might be harder.

  • Are you sure bike computers use BLE and not some custom wireless link, or ANT, which is not BLE. Aug 27, 2019 at 2:13
  • No, I don't know which wireless protocol they use. That's why I said "wireless communication LIKE BLE." I guess I should have been clearer on my lack of specific knowledge."
    – Duncan C
    Aug 27, 2019 at 14:06

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.