exercise bike computer

Hello,

Bike computer on my exercise bike is no more so I'm trying to build a new one using arduino. There is 3.5mm sensor plug on my bike so I just connected the thing to mic input on my laptop and recorded very nice pulses. When I connect output from my sound card to A0 on arduino I can see values (and count pulses) in the terminal just fine. But when I connect bike to A0... there is nothing, just zeroes. Now I'm lost. Thanks for any help or guidance :slight_smile:

Sensor may be open collector and require a pull up resistor.

Sensors are many and varied so anyone's guess really.

I think I've got it. I made a small lm386 microphone amplifier for sensor input and now I'm getting reliable results. Lots of noise but I can reliably count those pulses.

The sensor on a bike is almost certainly NOT a microphone. Typically it would be a magnetic reed switch. Run this sketch:

void setup()
{
  pinMode(LED_BUILTIN, INPUT_PULLUP);
}
void loop() {}

This connects a pull-up resistor to Pin 13 which also has the 'L' LED connected. With the pin unconnected the 'L' LED will be on. If you connect Pin 13 to Ground the LED will go out.

Connect your 3.5mm sensor plug between Pin 13 and Ground. As you slowly pedal forward, does the LED wink out briefly once per revolution of the wheel or pedal? That would indicate a magnetic reed switch and a magnet on the wheel or pedal (it shouldn't be hard for you to figure out which).

If that works you can then use an interrupt pin (like 2 or 3) to measure time between pulses from which you can calculate RPM and 'speed' (wheel) or 'cadence' (pedals).

Hi,

Actually measuring pulses with an interrupt pin was the first thing for me to try and it didn't work. I guess original signal from the bike is just too weak and that's why I'm using microphone amplifier - to amplify these weak pulses. Off course there is no microphone in the bike :slight_smile:

Thanks

As you have problems with noise, you're using the wrong kind of amplifier. Wire that OpAmp as comparator, or even replace it by a Schmitt trigger. That should give you nice and clean pulses, no noise to cause false triggers.

Still makes me wonder why you can detect the signal that way and not directly - what are the actual voltage levels of your bike's signal? Maybe it's too low a voltage to detect reliably?

frgazor:
Actually measuring pulses with an interrupt pin was the first thing for me to try and it didn't work.

Perhaps you wired it incorrectly. Did you measure the resistance across the sensor? Does it act like a switch? Did you use a pull-up or pull-down resistor?