Author Topic: Dynamo speed sensor project  (Read 2161 times)

Dynamo speed sensor project
« on: 17 November, 2021, 02:02:53 pm »


Very early days, but got an ANT+ development board for the nRF51422

This is the schematic I have in mind. Why the shunt resistor (1 ohm I think), and the op amp?
I'm sure you night riders know the feeling of paranoia, checking behind you to see that the light is still running.

Well, by sensing current in this way, then using a high gain amplifier to make it effectively a digital waveform, then this arrangement is going to suddenly read zero if the light stops working (barring a short circuit, which would likely undervolt the sensor).

So this arrangement should also double as a confidence light!

Kim

  • Timelord
    • Fediverse
Re: Dynamo speed sensor project
« Reply #1 on: 17 November, 2021, 06:09:58 pm »
Ah, this is one of those things that I always thought would be a good idea but never got round to playing with myself.  Hadn't thought of the ANT+ approach.   :thumbsup:

Re: Dynamo speed sensor project
« Reply #2 on: 17 November, 2021, 06:28:21 pm »
Is that op-amp without feedback an op-amp ninja move or an op-amp simpleton move?

(NB I am the latter)

Re: Dynamo speed sensor project
« Reply #3 on: 17 November, 2021, 10:50:17 pm »
It's going to act as a comparator to level shift the AC waveform zero crossings to logic levels. Just a warning, some lamp controllers short the AC input at high speed to limit voltage, will not be a problem as long as you measure the period of the entire AC cycle. Rising edge to rising edge

Re: Dynamo speed sensor project
« Reply #4 on: 17 November, 2021, 10:50:51 pm »
I can't see why you are reading the current. The voltage from the dynamo will be a lot larger than the voltage across the current shunt.

I've measured frequencies before by just reading the voltage from an ac source. With a suitable series resistor you probably don't need any signal processing to run a digital input.
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

Re: Dynamo speed sensor project
« Reply #5 on: 18 November, 2021, 10:42:34 am »
I can't see why you are reading the current. The voltage from the dynamo will be a lot larger than the voltage across the current shunt.

I've measured frequencies before by just reading the voltage from an ac source. With a suitable series resistor you probably don't need any signal processing to run a digital input.
The idea of sampling the current comes from the initial idea of the project, before even a speed sensor - an easy indication that my rear light is working. The other thing about the op-amp is isolating a potentially high common mode voltage - I 'm working on the basis that an unloaded dynamo can hit 70V. Of course, that's unlikely if you're sampling a lighting circuit with two lights, but I don't fancy blowing up a microcontroller.

Of course, designs evolve. It's occured to me that the fault condition isn't no current to the rear light - it's voltage being present with no current. It would be nice to have a speed sensor that works when you're charging devices, after all!

I'm going to come up with a plan that involves placing the speed sensor with the dynamo charger, and having a facility to sample the rear light cable. Then the sensor can issue a battery warning if the light turns off. In the fullness of time, I'd like to power the speed sensor off the dynamo, too (it's only about a 10ma current draw from the microcontroller when transmitting).

It's going to act as a comparator to level shift the AC waveform zero crossings to logic levels. Just a warning, some lamp controllers short the AC input at high speed to limit voltage, will not be a problem as long as you measure the period of the entire AC cycle. Rising edge to rising edge
Always was going to do that through the comparator, as 28 cycles per revolution is already more than enough! Sampling the raw dynamo voltage should also help, though.

BFC

  • ACME Wheelwright and Bike Fettler
Re: Dynamo speed sensor project
« Reply #6 on: 20 November, 2021, 11:56:35 am »
You might want to look into the "features" of B&M brake light plus rear light.
Main features that come to mind are the supercapacitor charging and usage, frequency detection for the brake light function and a (well hidden) off switch to save the capacitor charge for rapid wake up next usage.

Super capacitors tend to be far easier to charge and use than lithium ion cells, and are also allowed on aircraft. Lithium designs must have a removable (approved) battery or have gone through approval testing (expensive) to be permitted on aircraft or other sensitive transport.

Re: Dynamo speed sensor project
« Reply #7 on: 20 November, 2021, 01:14:29 pm »
You might want to look into the "features" of B&M brake light plus rear light.
Main features that come to mind are the supercapacitor charging and usage, frequency detection for the brake light function and a (well hidden) off switch to save the capacitor charge for rapid wake up next usage.

Super capacitors tend to be far easier to charge and use than lithium ion cells, and are also allowed on aircraft. Lithium designs must have a removable (approved) battery or have gone through approval testing (expensive) to be permitted on aircraft or other sensitive transport.
Yeah, I have that light. Supercapacitors are an obvious choice for keeping the sensor running for a few minutes extra, although it's not exactly a high current device.

As for speed sensing based on frequency, that's already working.


Actually, I think if I got a custom circuit board made, it could be small enough to fit inside my Kemo USB charger. That thing has quite a bit of space!

Re: Dynamo speed sensor project
« Reply #8 on: 20 November, 2021, 09:44:10 pm »
I 'm working on the basis that an unloaded dynamo can hit 70V. Of course, that's unlikely if you're sampling a lighting circuit with two lights, but I don't fancy blowing up a microcontroller.

Microcontroller inputs are quite high impedance, so you can put a high value resistor in series and still get a voltage reading. You can limit the voltage by fitting either a zener diode to the -ve supply, or two clamping diodes to the +ve and -ve supplies.

Something like a 100 kOhm resistor will only allow 0.7 mA at 70 V, so the resistor will only need to dissipate about 50 mW and the microcontroller will not have any big voltages applied to it.

As the signal can be changing slowly, it's a good idea to have a schmitt trigger input.
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

Re: Dynamo speed sensor project
« Reply #9 on: 21 November, 2021, 02:41:06 pm »
I 'm working on the basis that an unloaded dynamo can hit 70V. Of course, that's unlikely if you're sampling a lighting circuit with two lights, but I don't fancy blowing up a microcontroller.

Microcontroller inputs are quite high impedance, so you can put a high value resistor in series and still get a voltage reading. You can limit the voltage by fitting either a zener diode to the -ve supply, or two clamping diodes to the +ve and -ve supplies.

Something like a 100 kOhm resistor will only allow 0.7 mA at 70 V, so the resistor will only need to dissipate about 50 mW and the microcontroller will not have any big voltages applied to it.

As the signal can be changing slowly, it's a good idea to have a schmitt trigger input.
That little rig I currently have (only sampling voltage straight out of the dyno at the moment) has an op-amp, zener diodes, and a matched resistor, although I probably would be better off with a higher valued resistor (it's a 1K8). The zener diodes form a wave clipper at +/- 12V. The op amp is happy with this, and powered off the 3V supply. I was thinking about adding a debounce counter to the timer, it hasn't seemed necessary, but if necessary I can always solder an extra couple of resistors across the op amp!

Feanor

  • It's mostly downhill from here.
Re: Dynamo speed sensor project
« Reply #10 on: 21 November, 2021, 06:00:16 pm »
I've always been leery of driving the inputs of any chip, op-amp or otherwise, higher than the supply rails.

But I have no real basis for that, I'd need to read the data sheets I suppose.

Re: Dynamo speed sensor project
« Reply #11 on: 21 November, 2021, 09:44:04 pm »
I've always been leery of driving the inputs of any chip, op-amp or otherwise, higher than the supply rails.

But I have no real basis for that, I'd need to read the data sheets I suppose.
Most chips will safely clamp the voltages to one diode drop (0.6 V) above the +ve supply and one diode drop below the -ve supply. There will be a limit to how much current is allowed to be clamped.
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

Feanor

  • It's mostly downhill from here.
Re: Dynamo speed sensor project
« Reply #12 on: 22 November, 2021, 11:35:58 am »
My gut reaction would be to regard that as protection, rather than a normal operating envelope.
I'd always want to do my own clamping externally.

But as I say, thats just a gut feeling that I've had since the earliest days of ICs.
I expect they are more robust these days.

#electronics-design-dinosaur.

Re: Dynamo speed sensor project
« Reply #13 on: 01 December, 2021, 09:41:22 pm »
First trial run of the prototype on an actual ride.

I needed to adjust the wheel diameter, as it's only 14 cycles per rotation. At least, that's what it felt like.

The data looks generally pretty good, although some drop outs, that's to be expected when the wires are just loosely inserted!

As for a final design, I've come up with something like this.


That's 30x45mm, which is comparable in size to my kemo charger.

I need to add a debug interface for programming the microcontrollers, for a start.

Since I have all the power conversion stuff, as a product it would probably make sense to make it into a USB charger.

Re: Dynamo speed sensor project
« Reply #14 on: 01 December, 2021, 10:15:44 pm »
If your regulator is ever at maximum power transfer you will need a big heatsink for Q1. just look at this graph...


Full report here...
https://www.cyclingabout.com/dynamo-hub-power-drag-testing-schmidt-son-shutter-precision-shimano/

I can confirm SON28 results from my own rolling road tests before commercial LED lighting became a thing I designed and built my own an SCR crowbar limiter far more efficient. Nowadays I just buy my lights ready made.

Re: Dynamo speed sensor project
« Reply #15 on: 02 December, 2021, 08:01:10 am »
If your regulator is ever at maximum power transfer you will need a big heatsink for Q1. just look at this graph...


Full report here...
https://www.cyclingabout.com/dynamo-hub-power-drag-testing-schmidt-son-shutter-precision-shimano/

I can confirm SON28 results from my own rolling road tests before commercial LED lighting became a thing I designed and built my own an SCR crowbar limiter far more efficient. Nowadays I just buy my lights ready made.
The current circuit would only ever be drawing about 20 mA, so not a concern. However, if I stick some USB circuitry on there, then it definitely needs a buck converter.

Some interesting stuff here:
https://blog.andrew-lohmann.me.uk/2020/09/electronics-design-project-bicycle.html

Re: Dynamo speed sensor project
« Reply #16 on: 02 December, 2021, 01:22:29 pm »
I would like to disagree, Q1 is a shunt regulator, depending how your protection and whatever is within a parallel lamp interact your circuit may dissipate some significant power.

Kim

  • Timelord
    • Fediverse
Re: Dynamo speed sensor project
« Reply #17 on: 02 December, 2021, 02:46:53 pm »
I would like to disagree, Q1 is a shunt regulator, depending how your protection and whatever is within a parallel lamp interact your circuit may dissipate some significant power.

Indeed.  It needs to cope with riding downhill with the lights switched off, for much the same reason that derailleur chains should be long enough not to jam in big:big.

I dabbled with an active-rectifier charger circuit 5 minutes before the e-Werk came out, and found that shunting the excess voltage would easily cook whatever was doing the shunting.  (I also fettled a commercial product of fboab's that had died in similar circumstances.)

Crow-baring the dynamo with a thyristor or TRIAC is a much better approach.

Re: Dynamo speed sensor project
« Reply #18 on: 02 December, 2021, 03:03:56 pm »
I would like to disagree, Q1 is a shunt regulator, depending how your protection and whatever is within a parallel lamp interact your circuit may dissipate some significant power.

Indeed.  It needs to cope with riding downhill with the lights switched off, for much the same reason that derailleur chains should be long enough not to jam in big:big.

I dabbled with an active-rectifier charger circuit 5 minutes before the e-Werk came out, and found that shunting the excess voltage would easily cook whatever was doing the shunting.  (I also fettled a commercial product of fboab's that had died in similar circumstances.)

Crow-baring the dynamo with a thyristor or TRIAC is a much better approach.
Q1 is a big transistor, but I don't think it will feature in the final design. I also don't like the TRIAC approach. I mean, it's the same idea as the transistor, but what I don't like about it is that it's turning on and off every cycle. I feel like the changes of load that that entails is going to give you some vibrations. I'm not sure it's a huge issue - watching some recordings of me doing 40-55 mph with the dynamo lights running, there's a humming sound that crops up, which could be a load turning on and off at >100 Hz... It feels wasteful when you could disconnect the circuitry from the dynamo instead, which isn't really an option for lights, but would be fine for a USB charging / speed sensor solution.


Re: Dynamo speed sensor project
« Reply #19 on: 02 December, 2021, 03:10:50 pm »
Correct, I get some fork vibration from my IQ-X, but that's a compliant 531 fork. Noticeable but not annoying. Everyone else now has disc forks so a non-issue.
Shorting the alternator* is an efficient means of regulation. It's wot you do with a current transformer.
* Dynamos in my definition are D C machines

Kim

  • Timelord
    • Fediverse
Re: Dynamo speed sensor project
« Reply #20 on: 02 December, 2021, 04:19:07 pm »
It feels wasteful when you could disconnect the circuitry from the dynamo instead, which isn't really an option for lights, but would be fine for a USB charging / speed sensor solution.

I scratched my head over this while trying to solve the problem for my charger.  It needs a component that conducts when the circuit is de-energised, otherwise you have a bootstrap problem.  (Depletion-mode MOSFET maybe?)  I mocked it up with a convenient relay, and it did the job, clicking in and out every few seconds when unloaded.  Not sure that's any less annoying from a mechanical load on the dynamo perspective, thobut.

The thyristor crowbar was simple, uneoxtic, and just worked.

Re: Dynamo speed sensor project
« Reply #21 on: 03 December, 2021, 10:42:53 am »
It feels wasteful when you could disconnect the circuitry from the dynamo instead, which isn't really an option for lights, but would be fine for a USB charging / speed sensor solution.

I scratched my head over this while trying to solve the problem for my charger.  It needs a component that conducts when the circuit is de-energised, otherwise you have a bootstrap problem.  (Depletion-mode MOSFET maybe?)  I mocked it up with a convenient relay, and it did the job, clicking in and out every few seconds when unloaded.  Not sure that's any less annoying from a mechanical load on the dynamo perspective, thobut.

The thyristor crowbar was simple, uneoxtic, and just worked.
I've had a bit of a breakthrough thought with the power management. An IC like the BQ51013B. Designed for wireless charging! That particular unit has a 5V/5W output limit, it can handle up to 20V on the input side. Ofc it's designed for far higher frequencies, but I'm not sure whether that would be an issue. I suspect it's just a question of adjusting the passives to compensate.