0

I want to build a hack where when my stationary bike hits 0.1 miles, it sends an information to a webserver which would trigger a web API call.

I understand how the webserver and API call would work. I wanted some ideas on how the said hardware(mcirocontroller or other) would function on the bike itself.

closed as off-topic by David Richerby, Argenti Apparatus, ojs, whatsisname, Criggie Sep 24 '18 at 21:37

  • This question does not appear to be about bicycles within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    I think this is off-topic for bicycles because its about coding and hardware integration with the real world via sensors. – Criggie Sep 22 '18 at 5:51
  • 5
    I'm voting to close this question as off-topic because it's a question about electronics and the cycling aspects are incidental. (Quick rule of thumb: an electronics expert who knows nothing about cycling could answer this question just fine, but a cyclist who knows nothing about electronics would have nothing to say.) – David Richerby Sep 22 '18 at 14:57
  • The EE.SE site may be able to provide you useful answers. – whatsisname Sep 23 '18 at 20:08
3

Two main technologies picking bicycle speed are magnetic sensors and pickups counting wheel revolutions and ANT+/Bluetooth sensors with accelerometers counting wheel revolutions.

Magnetic sensor into a micro controller would be trivial and is not really a bicycle question. ANT+ sensors follow a standardized API so you could look for a micro that support ANT+ and look at the ANT+ API for bicycle sensors.

Not sure how the accelerometers go on stationary bikes as they auto calibrate distance/revolutions, and a stationary bike has 0 distance.

I will ignore GPS...

  • There are ANT+/Bluetooth magnetic sensors, and they're cheap. I've got one (speed and cadence) but never got it working properly with my phone. Logically it should be possible to interface one to a PC, as you can get ANT+ USB dongles. – Chris H Sep 22 '18 at 6:36
  • I'd go with ANT+. There are cheap ANT+ USB devices available and a host of material on messing with ANT+ with small form factor machines like the Raspberry Pi. – Argenti Apparatus Sep 22 '18 at 13:23
2

A bicycle wheel has a nominal radius, plus a tyre on the outside will give you a diameter. That will give you a circumference, something like 1500-2500 mm depending on the wheel rim size.

So set up a reflective patch between two adjacent spokes, and use an optical sensor to detect when that patch goes past. Simply have tuo tune the sensor so it doesn't see spokes, but does see the reflector. If that doesn't work, you could use a magnet and a magnetic pickup like a simple bike computer. Each pass is one wheel revolution.

Simply count the pulses and send your interrupt/trap/signal/message when you hit 72 pulses/wheel revolutions (assuming a tyre circumference of 2235mm)

There are 160,935 millimetres in 0.1 miles.

2

A hack I've used for 1 or 2 bits of I/O in the past is to use the status lines of a cheap USB-RS232 adaptor. These are easily addressed in any programming language, so could connect directly to your server if it's nearby, or a single board computer like a raspberry pi.

Then you just use a magnetic bike computer switch from 5V (taken from the USB line) to DSR, and a resistor to USB ground. USB-232 converters tend to run with 0V where the 232 spec says they should have a negative voltage. Cheap bike computers tend to use reed switches; more expensive ones may use Hall sensors that would take more interfacing.

1

If you're more into programming and embedded software (or want get into) you can simply google for e.g. "raspberry pi bicycle trainer" or another DIY embedded platform. Enough ideas will pop up. The advantage of the raspberry pi (besides its price) is that it already has network connectivity and can run web servers on its own.

Nevertheless, it's not a bicycles.stackexchange question but rather stackoverflow or some embedded forum.

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