Counting A/C peaks from a hub dynamo to work out bike speed


I'm considering an arduino project to work as a speedometer for my bike. I have just bought a hub dynamo which outputs 6V a/c and thought i could use an arduino to count the a/c modulations and from that work out the speed of the bike. Then output the speed to a small 2 or 3 digit LCD screen. Firstly,i don't want to power the arduino from a battery, i want to use the hub dynamo for that - how do i best do that? Secondly, i estimate that there are approximately 30 oscillations of the hub dynamo a/c output per wheel revolution. With a 700mm dia wheel, at 25km/hr that works out to be about 95Hz (Maybe half that depending on the polarity of the magnets within the hub - i need to connect an oscilloscope to work out exactly how many magnets there are per revolution and how the voltage output behaves)

Can an Arduino measure 95Hz signals reliably or is that a bit fast?

Will I run into problems powering the arduino with the same thing that i am trying to measure?

If anyone has any thoughts on this, or any guidance which would be useful early on please let me know.


Hamltron: Can an Arduino measure 95Hz signals reliably or is that a bit fast?

95 Hz is no problem. 95,000 Hz wouldn't be a problem. 950,000 Hz would come close to being a problem. :)

I think this all hinges on how clean that AC signal is. Have you scoped it to confirm that it's a nice clean sine wave?

You will need to rectify the output from the dynamo using (for example) a bridge rectifier and smoothing capacitor, then feed the result into Vin. You’ll need at least about 5.5v at Vin to power a normal Arduino adequately, so there will be a minimum speed at which the power is sufficient. If that speed is low enough for the device to be useful, then what you want to do is entirely possible.

You can run the atmega processors at lower voltage (e.g. 3.3v) if output from the dynamo is not high enough to provide 5.5v at low speeds, but then you’ll also need a display device that works at 3.3v. Alternatively, you could replace the bridge rectifier with a voltage doubler to increase the voltage.

Hey dude!! I had the same idea!! Rectify the ac output of the dynamo to power the arduino, and then, ad some kind of resistor to the output of the dynamo to the analog input of the arduino! I am thinking of making a small computer to the bibycle, adding batteries would be great! Check this out!,108098.0.html We should keep in touch!! I had that same idea!!

Hi there

I got a new bike and was thinking about the same thing! :) Did you make any progress? Some working code snippets or electronics?