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.