555-based dynamo powered flasher circuit

minisystem

Newly Enlightened
Joined
Jul 12, 2011
Messages
96
I posted this in the standlight thread last week, but haven't got anywhere, so I hope the problem will find a wider audience in its own thread.

I'm working on a dynamo-powered LED circuit with a supercap standlight. With some help from SteveK, the light output and standlight function are working great. I'd like to implement a flashing mode, as I find this is more optimal for city riding, which is where 99% of my riding happens and I'm trouble getting this to work. Here's the schematic:

http://www.flickr.com/photos/72673895@N00/5975594778/ (you'll need to zoom to see the details).

MOSFET rectifier output goes into LDO regulator which limits output to 5.3V. Supercap charger is programmed to limit current going into superap to 220 mA and tapers that off once Vcap reaches 2.7V. Q1 keeps supercap disconnected from Zetex driver when dynamo is running, switches on when Vdyn drops to 0V. Q2 disconnects power to Zetex on HIGH pulse from 555, switches on when LOW. I'm not using the SHDN pin on the Zetex because Vin into the Zetex rises as the cap charges and becomes greater than Vf of the two LEDs, which prevents the Zetex from be able to regulate them (this doesn't yet seem to be a problem. ie. nothing fried yet!).

Not shown on the schematic is a 4.7K pull-up resistor between Q2s gate and the 'supply' voltage (from either the dynamo or the cap). The second Zetex schematic is just an low-side implementation of the flasher.

Using a 555-based pulse generator I'm getting the LEDs to flash properly but am running into problems once my supercap is charged: the LEDs stay on and stop flashing. When the dynamo stops, and the circuit gets power from the supercap the flashing works fine. When the dynamo is powering the circuit and the supercap isn't fully charged, the flashing works fine. As soon as the current going into the supercap starts to get tapered off by the charger then Q2 won't switch off when the 555 pulse is high. I can't figure out what's going on here. The amplitude of the 555 pulse increases as Vdyn increases, but other than that I can't see anything else going on. Giving the 555 independent power (from a benchtop supply) does not fix the problem. Cleaning up the output of the bridge with a 1000uF cap (+ diode) doesn't fix the problem either.

I think I must be missing some MOSFET fundamentals. My rudimentary understanding is that a P-channel MOSFET is ON when the gate is low and OFF when the gate is high. I understand that 'high' and 'low' are relative to the source (Vgs) and that the cutoff is dependent on Vds, but all my reading has yet to fully enlighten me (partially because most MOSFET behavior is described in terms of N-channel and I get confused flipping everything around for P-channel).

I'm not sure what to do next. I've tried to implement the low-side N-channel MOSFET solution, but it has the (expected) opposite problem: when the cap is charged, the MOSFET won't switch on and the LEDs remain off.

Any ideas for troubleshooting would be most helpful.
 

georges80

Flashlight Enthusiast
Joined
Oct 23, 2002
Messages
1,262
Location
Sunnyvale, CA
What voltage is the 555 running at? A mosfet has a Vgs value that needs to be exceeded to turn on. With a P channel, the gate relative to the source input must be more negative by Vgs to turn the device on. There is also Vgsthresh (threshold value) where the FET just starts to turn on. What FET are you using? What is its Vgs and Vgsthresh?

So, assume you have 5.3V at the source of Q2. You then need to be lower than 5.3V (by Vgs) to turn the FET on. Have you measured your gate drive voltage relative to the source voltage to see what is happening as the unit transitions through the various modes (dynamo only, supercap only, dynamo charging supercap etc etc) ?

cheers,
george.
 

jdp298

Newly Enlightened
Joined
Mar 22, 2011
Messages
115
Location
With your sister, somewhere you wouldn't like
Perhaps it's a bit of a dirty part-fix, but a thought strikes me. You say the amplitude of the 555 pulse gets bigger as V(dyn) increases. How big is big? Have you tried an LDO to limit the size of the 555 output pulse? A 3.3v LDO is only 3 pins and not that hard to squirrel away on a board with a resistor, it'd also prevent the 555 pulse getting too big if you start trying hard down a hill.

Next, what happens the charging chip once it's drawing the current to the supercap down? Is there something leaking through earth which is bypassing or otherwise biasing Q2?
 

minisystem

Newly Enlightened
Joined
Jul 12, 2011
Messages
96
What voltage is the 555 running at? A mosfet has a Vgs value that needs to be exceeded to turn on. With a P channel, the gate relative to the source input must be more negative by Vgs to turn the device on. There is also Vgsthresh (threshold value) where the FET just starts to turn on. What FET are you using? What is its Vgs and Vgsthresh?

So, assume you have 5.3V at the source of Q2. You then need to be lower than 5.3V (by Vgs) to turn the FET on. Have you measured your gate drive voltage relative to the source voltage to see what is happening as the unit transitions through the various modes (dynamo only, supercap only, dynamo charging supercap etc etc) ?

cheers,
george.

Thanks George, that makes it pretty clear. I'm pretty sure that this is where the issue is. I have taken some Vgs measurements with the scope. I think I'll capture those and post them. Hopefully that will provide some insight.
 

minisystem

Newly Enlightened
Joined
Jul 12, 2011
Messages
96
Perhaps it's a bit of a dirty part-fix, but a thought strikes me. You say the amplitude of the 555 pulse gets bigger as V(dyn) increases. How big is big? Have you tried an LDO to limit the size of the 555 output pulse? A 3.3v LDO is only 3 pins and not that hard to squirrel away on a board with a resistor, it'd also prevent the 555 pulse getting too big if you start trying hard down a hill.

I've tried giving the 555 it's own clean power from a separate supply (non-dynamo) and it doesn't seem to fix the problem. BUT...

Next, what happens the charging chip once it's drawing the current to the supercap down? Is there something leaking through earth which is bypassing or otherwise biasing Q2?

I'm not sure. As far as I can tell, the charging chip just limits the current going into the supercap as it's voltage approaches the programmed voltage. I think some pics from the scope might offer some enlightenment to you more experienced folks.

Also, I think my next step will be to power the whole thing from just a benchtop supply with the current limited to 500 mA (typical max output for my dynamo). I'm becoming increasingly convinced that the fluctuating output of the dynamo (any where from 50-180 Hz depending on how fast I'm spinning the wheel) might be contributing to the problem here. At the very least, if it still persists I can rule out the nature of the dynamo power as the problem.
 
Last edited:

jdp298

Newly Enlightened
Joined
Mar 22, 2011
Messages
115
Location
With your sister, somewhere you wouldn't like
Strewth! What was I writing? It must've been late. What I meant was: What happens to the chip controlling the charging of the supercap once the supercap approaches full charge? Poor show.

Looking again at the circuit, could a negative charge be reversing through Q1 to Q2, kind of how the negative side of the MOSFET H-bridge works? Could this happen if the chip is backing off the charge, or creating a negative voltage around R5, C4? I don't see how it would, but my understanding of the behaviour of ccts isn't total. Might you want to use another MOSFET as an effective diode in front of the Source of Q1? I would have said diode, but you'd lose at least a volt, and the supercap only goes to 2.7v, so it'd be massively wateful.
 

minisystem

Newly Enlightened
Joined
Jul 12, 2011
Messages
96
A little progress to report:

Replacing dynamo power with a regulated bench top supply (5.3V limited to 500 mA, bypassing the bridge and LDO regulator in the schematic) produces the same problem, so it isn't wacky AC dynamo power that is the issue. As with dynamo power, the rail voltage of the circuit drops to around 2.0V as the capacitor begins to charge and it slowly increases to 3.0V. As soon as the supercap charger starts tailing off the current into the supercap, the voltage jumps up to the set voltage of 5.3V

After some investigation, there seem to be two problems. The first is that Q2 doesn't properly switch off, as described before. BUT, when the voltage jumps once the supercap is charged, the output of the 555 is forced low. I'm using this CMOS 555 from Zetex: http://www.diodes.com/datasheets/ZSCT1555.pdf

which can run at up to 6V. As soon as the voltage gets up to around 4V the timer goes low and stays there. If I set the bench top supply to less than 4V then the timer runs fine. That seems very odd to me. I just have the 555 set up in a basic astable operation.

Keeping the input voltage below Vf of the two series LEDs keeps the Zetex driver in regulation and allows me to use the shdn pin to flash the LED with the 555, which eliminates whatever problem I was having with Q2 switching.

So, I now have a working circuit that can run in both solid and flashing modes. The only real complaint that I have now is that I have to set the input voltage to around 3.6V to keep the 555 running properly. At this voltage, with a 50 milliohm current set resistor, the LEDs draw a max of 350 mA, when the hub could provide 500 mA. Lowering the sense resistor to less than 50 milliohm introduces some kind of instability in brightness. Although it works, it seems like a waste to lose that extra 150 mA that the hub can provide.
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
A little progress to report:

Replacing dynamo power with a regulated bench top supply (5.3V limited to 500 mA, bypassing the bridge and LDO regulator in the schematic) produces the same problem, so it isn't wacky AC dynamo power that is the issue. As with dynamo power, the rail voltage of the circuit drops to around 2.0V as the capacitor begins to charge and it slowly increases to 3.0V. As soon as the supercap charger starts tailing off the current into the supercap, the voltage jumps up to the set voltage of 5.3V

what does "rail voltage" refer to in this case?
Sounds like you might want to investigate this further. Might help if you can replace some of the circuitry with something simpler. Possibly replace the Zetex boost circuit and LEDs with a power resistor?

After some investigation, there seem to be two problems. The first is that Q2 doesn't properly switch off, as described before. BUT, when the voltage jumps once the supercap is charged, the output of the 555 is forced low. I'm using this CMOS 555 from Zetex: http://www.diodes.com/datasheets/ZSCT1555.pdf

which can run at up to 6V. As soon as the voltage gets up to around 4V the timer goes low and stays there. If I set the bench top supply to less than 4V then the timer runs fine. That seems very odd to me. I just have the 555 set up in a basic astable operation.

Is there anything that is pulling up the gate on Q2? I can't see how the 555 is wired up or what it is powered from, so I can't tell. In general, a standard practice would be to put a resistor from Q2's source to drain in order to ensure that the default state is "off". I would assume that the 555's totem pole output would pull the gate voltage up to the 555's supply voltage, but I don't know what that supply voltage is.

You need to figure out why the 555 is having trouble with supply voltages over 4v. The datasheet says 6v is an acceptable supply voltage.


Keeping the input voltage below Vf of the two series LEDs keeps the Zetex driver in regulation and allows me to use the shdn pin to flash the LED with the 555, which eliminates whatever problem I was having with Q2 switching.

So, I now have a working circuit that can run in both solid and flashing modes. The only real complaint that I have now is that I have to set the input voltage to around 3.6V to keep the 555 running properly. At this voltage, with a 50 milliohm current set resistor, the LEDs draw a max of 350 mA, when the hub could provide 500 mA. Lowering the sense resistor to less than 50 milliohm introduces some kind of instability in brightness. Although it works, it seems like a waste to lose that extra 150 mA that the hub can provide.

Right now you use diodes to allow either the dynamo or the supercap to power the boost converter, which powers the LEDs. Why not change the layout a bit.... move the boost converter in between the Q1 and D2? This would allow the dynamo to directly drive the LEDs at 500mA, and only run the boost converter when the dynamo is stopped? This does disconnect the load from the boost converter when Q2 is off, and I'm not sure if that is a problem for the boost converter. You could also use the boost converter's shutdown pin to inhibit the converter when Q2 is off.

regards,
Steve K.
 

minisystem

Newly Enlightened
Joined
Jul 12, 2011
Messages
96
I'm getting closer. I did as you suggested SteveK (again!) and put the boost converter between Q1 and D2 and am now using a low-side N-channel mosfet to flash the LEDs (between the cathode of Dr and ground) with the 555. Now, everything is working very well and when the cap is charged there are no issues; the LEDs continue to blink and are amazingly bright. Couple little niggling issues to work out: I'm pretty sure my 555 is faulty, so I'm going to try popping in a new one. Also, when the cap is fully discharged on start up it seems to draw more current than programmed (current set at 200 mA), which causes a voltage drop across the output of the regulator and prevents the LEDs from reaching Vf. After a few seconds of the wheel spinning it seems to balance out and start charging at the set current, allowing the LEDs to reach Vf.

Anyway, this has been a great trouble shooting experience. I'll keep you posted about how things are going and post a final schematic!
 

dlindsey

Newly Enlightened
Joined
Aug 18, 2011
Messages
1
Great work. I'm really impressed by the amount of detail going into these dyno-lights.

I'm starting on my first build, have plenty of background soldering and tinkering, just wondering what you are using to build the circuit on? Any pictures of the built-up circuit for on bike installation? I was looking up some of the parts in your schematic and it seems they are mainly surface mount, are people doing PCBs?

Thanks,

-Derek
 

minisystem

Newly Enlightened
Joined
Jul 12, 2011
Messages
96
I'm still in the prototyping stage, but ultimately plan to have PCBs made up by someone like PCBExpress or pad2pad. Seems like you can have 3 pro-quality boards made for between $50-$70. For prototyping, I've been using SMT-SIP/DIP adapter boards made by http://www.proto-advantage.com/store/, which allows me to use a regular prototyping breadboard. Soldering the surface mount components gets easier with practice (a low power microscope and steady hand certainly helps). For extremely fine pitched parts and parts without exposed pads I've had good luck using solder paste stencils (also from proto-advantage) and reflowing in a frying pan.

Project update: ditched the supercapacitor charging IC and replaced it with an LDO regulator and current limiting load switch. This got rid of a variety of glitches that were driving me nuts. Also replaces a $5 part with about $2 worth of parts. :)

My last thing to work out is what to do with the lost energy in flashing mode. In this mode when the LEDs are in their off cycle, the voltage from they dynamo rises (no load) and is clamped by a 6.8V zener, so it's just lost as heat. Trying to work out a scenario where I can maybe divert that into a charge pump to light up another LED or something. Still tinkering...
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
Project update: ditched the supercapacitor charging IC and replaced it with an LDO regulator and current limiting load switch. This got rid of a variety of glitches that were driving me nuts. Also replaces a $5 part with about $2 worth of parts. :)


It's never easy to admit that one has been wandering down a dead end, but it does feel better to back-track and get onto a path where progress is easier.


My last thing to work out is what to do with the lost energy in flashing mode. In this mode when the LEDs are in their off cycle, the voltage from they dynamo rises (no load) and is clamped by a 6.8V zener, so it's just lost as heat. Trying to work out a scenario where I can maybe divert that into a charge pump to light up another LED or something. Still tinkering...

Someday, I should try to build a basic buck regulator that can operate from 6v to 100v, since that's what's needed to go from full load to a light load on a modern dynamo. I addressed some of the issues when I built a pwm battery charger that operated from the dynamo... I used a 100v (150v?) mosfet to switch the power from the dynamo. Worked okay, but there were other issues that made me go another direction. You could use almost the same scheme to disconnect the dynamo when the input to your LDO gets too high. It involved a quad op-amp, voltage reference, lots of R's and C's, etc. At least a few square inches of circuitry using SMD parts. It might be easier to just deal with getting rid of a few watts of power, really.

Or.... synchronize the switching of the dynamo power with the 555? That would be pretty basic.

regards,
Steve K.
 

minisystem

Newly Enlightened
Joined
Jul 12, 2011
Messages
96
It's never easy to admit that one has been wandering down a dead end, but it does feel better to back-track and get onto a path where progress is easier.

Yep, was married to the LTC4425 when my original design used two supercapacitors. When it turned out I really only needed one, I had a hard time letting go...



Someday, I should try to build a basic buck regulator that can operate from 6v to 100v, since that's what's needed to go from full load to a light load on a modern dynamo. I addressed some of the issues when I built a pwm battery charger that operated from the dynamo... I used a 100v (150v?) mosfet to switch the power from the dynamo. Worked okay, but there were other issues that made me go another direction. You could use almost the same scheme to disconnect the dynamo when the input to your LDO gets too high. It involved a quad op-amp, voltage reference, lots of R's and C's, etc. At least a few square inches of circuitry using SMD parts. It might be easier to just deal with getting rid of a few watts of power, really.

Or.... synchronize the switching of the dynamo power with the 555? That would be pretty basic.

regards,
Steve K.

Yes, turning off the dynamo during the OFF cycle of the 555 makes good sense. I'm assuming that would need to be done after rectification. Maybe another load switch, like this: http://www.fairchildsemi.com/ds/FP/FPF2700.pdf
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
Yes, turning off the dynamo during the OFF cycle of the 555 makes good sense. I'm assuming that would need to be done after rectification. Maybe another load switch, like this: http://www.fairchildsemi.com/ds/FP/FPF2700.pdf

hmmmm.... might want to consider all of the ramifications of this.... IIRC, you're using a mosfet rectifier, so there may be a chance of exceeding the voltage ratings on the mosfets if disconnect the load at the output of the rectifier. Using plain schottky diodes for the bridge rectifier would avoid that problem.

Another idea would be to short the dynamo out instead of disconnecting the load. Shorting the dynamo avoids the issue of high voltages, but does produce some drag.

regards,
Steve K.
 

minisystem

Newly Enlightened
Joined
Jul 12, 2011
Messages
96
Here is the latest, which I'm about to move from the breadboard into a more durable perfboard prototype that I can actually ride around to see if I can destroy it!

Schematic: http://www.flickr.com/photos/72673895@N00/6101646665/sizes/l/in/photostream/

Supercapacitor charger has been replaced with a 3.0V LDO regulator. The current going into the supercap is regulated by a load switch with a settable current limit. Q1 is OFF while the dynamo is running, ON while stopped, providing standlight power through the Zetex driver. While the dynamo is running, a 5W, 6.8V zener diode clamps the voltage. The 555 gets either 3V from the LDO regulator while the dynamo is going or from the supercapacitor when stopped. PAD1/2 and PAD5/6 are connections for a switch to turn the flashing mode on or off. PAD3/4 are for a switch to disconnect the dynamo from the circuit. LEDs are connected via J2 and J3. Dynamo comes in through J1.

Everything is working great. My only concern is that during prototyping I've blown two sets of mosfets in the bridge. They have a Vdss max of 20V and a Vgs max of 12V. In both cases, I'm pretty sure I disconnected the load by accident and didn't have a zener in place to clamp the voltage. I'm wondering, with a Vgs max of 12V, if I should use a TVS diode with a reverse standoff voltage below 12V, just in case?

As well (and as aforementioned), when the dynamo is running and the circuit is in flash mode, the rectified voltage rises and is clamped by the Zener at 6.8V when the LEDs are in their off cycle (no load). This doesn't seem to be a problem (other than the energy is being wasted as heat). I'm hoping that even at high speeds the brief pulse the Zener gets when it clamps won't cause it to overheat and fry.

Comments welcome (and hoped for!). I want to really put this thing through the ringer as an on-bike prototype before getting the proper boards made that will go into the lamp housing.
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
... PAD3/4 are for a switch to disconnect the dynamo from the circuit.

disconnect the dynamo? I haven't done that since I made my first LED headlight. The drag is low enough that I just leave mine running.


... My only concern is that during prototyping I've blown two sets of mosfets in the bridge. They have a Vdss max of 20V and a Vgs max of 12V. In both cases, I'm pretty sure I disconnected the load by accident and didn't have a zener in place to clamp the voltage. I'm wondering, with a Vgs max of 12V, if I should use a TVS diode with a reverse standoff voltage below 12V, just in case?

yep, you need to have something to limit the voltage produced by the dynamo. If the LEDs are always running, then it's not a problem (although I usually still add a clamp zener just in case a wire would break ). Having the zener at the output of the bridge rectifier is sufficient; no need to add a clamp at the input of the bridge too.

As well (and as aforementioned), when the dynamo is running and the circuit is in flash mode, the rectified voltage rises and is clamped by the Zener at 6.8V when the LEDs are in their off cycle (no load). This doesn't seem to be a problem (other than the energy is being wasted as heat). I'm hoping that even at high speeds the brief pulse the Zener gets when it clamps won't cause it to overheat and fry.


I'd suggest running a test with the dynamo, some plain 1N4004 diodes (or equivalent) in the bridge rectifier, and just the zener at the output. Nothing else. Run the dynamo for 5 minutes or more and see if the zener survives. Might want to simulate the final package design a bit, just to account for the loss of airflow, etc. A zener will usually fail by shorting, which isn't too bad in this case. With the dynamo limited to 0.5A, it might not ever blow out the short circuit, so the damage would be limited to just the zener. It's always nice to run a test and avoid costly surprises.

Sounds like you're in pretty good shape!


regards,
Steve K.
 

jdp298

Newly Enlightened
Joined
Mar 22, 2011
Messages
115
Location
With your sister, somewhere you wouldn't like
I agree with Steve about switching off the dynamo. I have 3 lights running constantly and the front halogen (the only one with a switch built-in) only when it's dark or I think the hill's getting a bit steep. Although 34mph and nothing fried. I even had a wire to the front LED come loose the other day, caps and everything were just fine, and lit me up as I soldered it back together.
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
... I even had a wire to the front LED come loose the other day, caps and everything were just fine, and lit me up as I soldered it back together.

I'll assume that "lit me up" meant you were illuminated, and not that you had 100v delivered to you?

It does bring to mind the fact that since the leds and dynamo are so reliable, the biggest source of failure/malfunction is going to be our own workmanship. Good solder joints are important, as is securing wires so they can't vibrate and fatigue. A housing that keeps moisture off the electronics is also important.

Steve K.
 

jdp298

Newly Enlightened
Joined
Mar 22, 2011
Messages
115
Location
With your sister, somewhere you wouldn't like
100v, no, there's a zener which stops more than 5v6 getting stored.

I think you can't stop the moisture so it's better to give it a way back out again. The right hole in the right place so the electronics aren't rained on or flooded, but can still dry out when they get the chance.
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
You can stop moisture, but there are challenges. I think my light can breath a bit through the switch. I put the switch and wire entry on the bottom with the intent of keeping water from flowing in, and promoting the potential for it flowing out. The housing is partly plexiglas, so it can flex in response to air pressure changes. I've seen some electronics on earthmoving equipment that actually sucked water up the wire strands. The connectors weren't well sealed, and were pretty moist.

You can also pot the electronics, but there are challenges with getting the potting to stick to the housing, the electronics, the wires, etc. I've dealt with a lot of this stuff in my job. For the less severe environments such as bike lights, it's probably enough to just keep the water from splashing directly on the electronics (such as an unsealed housing), and use a good conformal coat on the circuit board.

Steve K.
 
Top