Idea
So I got one of this cool hub dynamos. I really like that it's quiet and efficient way of generating energy for bicycle lamps. I considered adding USB charger to my bicycle to be able to supply my mobile phone while cycling but this is not trivial topic because of low output frequencies from dynamo. Another problem is relatively low output voltage, 6V is to low to use LDO reliable, under low speed condition output voltage may be lower than 5V so eventually a step-up step-down converter would be useful. Additionally rectifying low voltages is kind of tricky, I mean you can do this easily but to do this efficiently is already a challenge because of immanent power loses in diodes (0.7V drop at 6 V input is already more than 10% loss).
As a byproduct of such consideration I drawn a simple circuit which uses LCD display and tiny micro to track frequency, which is directly proportional to the bicycle speed. I like the idea of using dynamo output voltage as a supply and a signal at the same time. You will never need to replace battery, and you don't need additional sensor on the wheel.
Circuit description
The speedometer is supplied from a hub dynamo. D1, C7 and C8 form a half-wave rectifier. C4 is ESD protection and D2 is a Zener diode which should be short-term overvoltage protection. IC1 is an LDO voltage regulator, carfuly chosen to have low quiescent current, C5 is output capacitor of the voltage regulator. Hub dynamo produces pseud-sinusoid signal with a frequency which rises with speed. At low speeds at big wheels frequency can go as low as 5Hz, and C7 and C8 have to store energy for the device.
Input waveform when supplied from signal generator.
Signal at SPEED node. Voltage limited to the value safe for microcontroler digital input. Not very "digital" but thanks to microcontrolers Schmitt input it's not a problem. Circuit supplied from signal generator.
Waveform shows signal at SPEED node. Circuit supplied from a real hub dynamo (Shimano DH-3N31-NT).
Waveform shows signal at SPEED node. Circuit supplied from a real hub dynamo (Shimano DH-3N31-NT).
Measurement
Because of required low power consumption micro has to run with 32[kHz] clock. The micro is actually measuring period, not frequency so division is needed. Fixed point arithmetic is used with assumptions that the speedometer shows integer part of the speed with proper rounding up and precision not worse than 0.1[km/h].
to be continued
(verification of fixed point arithmetic)
Prototype
First prototype supplied from signal generator
First prototype supplied from a real hub dynamo driven by a DC motor
Software
Currently there is a github repository where you can download software and compiled.hex file. However this software doesn't show speed yet. It shows period in milliseconds before rising edges on SPEED signal. Stay tuned, new revisions are coming.
PCB
I designed a simple one-sided PCB using Cadsoft Eagle. Designing PCB with one layer only (the red top layer are wire connections which will be soldered manually) required changing association between mirocontroler pins and LCD segments. This is "layout friendly" now, software will have to compensate for this. Eagle files and gerber production files are packed along with software and can be obtained from github repository.
Todos
Add buttons
Add possibility to set up wheel circumference
Add captive touch sensor instead of mechanic switches
Add LED to back light the display while driving
Print a housing
Find a neat way of connecting the speedometer to the bicycle (electric and mechanical solution)
Housing trials
I've drawn a simplest housing ever, it consists of one part, PCB will be put in and sealed with epoxy. There is rounded part to fix the housing on the bicycle handlebar and fixing area to secure it with cable binders. Just click on "play" button to see it.
I didn't realize that this shape is actually not printable, the result can be seen here:
My buddy convinced me that using cable binders is not perfect way of holding stuff on the bicycle. Second housing will be fixed with an o-ring. I was thinking how I could make o-ring less visible while keeping model printable, but I changed strategy, if I can't make something unvisible, I will intentionally make it visible.
This is freshly printed housing with an LCD put in to if dimensions are right













