Standlight vs Voltage Doubler

Bandgap

Enlightened
Joined
Aug 14, 2002
Messages
284
Location
London
Hi folks
Long time no post.
Wise Steve K drew my attention to his post.

Before you read the next bit, do realise I may be completely wrong...

...when I say that a voltage output dc-dc converter with linear feedback (eg LM46002) is not a great option for connecting what is effectively a constant current source to a constant voltage load.
The feedback loop does not know where to go.

- or are you going to force the feedback using MPPT or feed-forward?

It is a shame that no one makes something similar - integrated oscillator, level-shifter, driver stage and output mosfets - but with an external input controlling the PWM ratio - it would be so useful for this kind of application.

Unfortunately, we have to home-brew all this, with all the attendant switching losses
- and the need to hand-craft dead-band timing (to prevent both mosfets being 'on' momentarily causing large, efficiency-eating, current spikes).
That said, the advanced PWM available in several PICs, and probably some AVRs, will at least handle PWM and dead-band, still leaving the rest to be sorted.

BTW1
using 2x n-mosfets in a buck means that either you can never achieve 100% duty-cycle for Vout=Vin, or you need a separate power rail to feed the upper gate.
Using a p-mosfet in the upper position allows 100% operation.

BTW2, regarding bridge rectifiers:
Rather than use a four-mosfet active bridge rectifier, plus a Schottky, why not use two mosfets and two Schottkys?
You get the same voltage drop, reverse-blocking, and save two mosfets.
Plus, with separate mosfets you get the chance to protect the gates with resitors and Zeners.

And, I have to add a plea - please don't make bike lamps which dazzle other road users - almost anything powerful using rotationally-symmetric optics will be guilty of this.

Another Steve
 
Last edited:

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
Hi folks
Long time no post.
Wise Steve K drew my attention to his post.

Before you read the next bit, do realise I may be completely wrong...

...when I say that a voltage output dc-dc converter with linear feedback (eg LM46002) is not a great option for connecting what is effectively a constant current source to a constant voltage load.
The feedback loop does not know where to go.

- or are you going to force the feedback using MPPT or feed-forward?

without going back and looking at the proposed design.. I think the buck converter was just going to be connected to the rectified dynamo output without any other controller or feedback. I would disagree that the dynamo is constant current source; it definitely has a source impedance. I will agree that at this time, it is unknown what the dynamo's output will be when the buck converter reaches a stable operating point.... will it be operating at half of the dynamo's open-circuit voltage? Will it be near the open-circuit voltage, or conversely, near the short-circuit current?? For any given load, there are two(?) places on the dynamo's V-I curve where the buck converter could end up at (unless the load happens to exactly match the dynamo's peak power under current conditions).

That is all from a static viewpoint.

From a dynamic viewpoint, there is a chance that things could oscillate around a particular point on the V-I curve, or it might happen to stick at the short-circuit current. The latter case seems possible if there isn't a soft-start or a low-voltage disable. I can imagine the buck converter quickly going to 100% duty cycle when the dynamo is slowly starting up. If the buck is trying to deliver 1A to the battery, it will pull as much current out of the dynamo as possible, and the dynamo might end up just delivering 2.5W or so to the battery instead 3 or 4 or 6 watts. It's not great, but at least it'll charge the battery.

It is a shame that no one makes something similar - integrated oscillator, level-shifter, driver stage and output mosfets - but with an external input controlling the PWM ratio - it would be so useful for this kind of application.

Unfortunately, we have to home-brew all this, with all the attendant switching losses
- and the need to hand-craft dead-band timing (to prevent both mosfets being 'on' momentarily causing large, efficiency-eating, current spikes).
That said, the advanced PWM available in several PICs, and probably some AVRs, will at least handle PWM and dead-band, still leaving the rest to be sorted.

If someone already made this sort of thing, how would we find an excuse to tinker with electronics?? ;)

BTW1
using 2x n-mosfets in a buck means that either you can never achieve 100% duty-cycle for Vout=Vin, or you need a separate power rail to feed the upper gate.
Using a p-mosfet in the upper position allows 100% operation.

BTW2, regarding bridge rectifiers:
Rather than use a four-mosfet active bridge rectifier, plus a Schottky, why not use two mosfets and two Schottkys?
You get the same voltage drop, reverse-blocking, and save two mosfets.
Plus, with separate mosfets you get the chance to protect the gates with resitors and Zeners.

And, I have to add a plea - please don't make bike lamps which dazzle other road users - almost anything powerful using rotationally-symmetric optics will be guilty of this.

Another Steve

There is something to be said for just using a plain schottky rectifier. I've used mosfet rectifiers because it worked with my circuits and because my commute included a very steep hill and slow speeds, meaning that I needed to eliminate any voltage drop possible. For more conventional uses, the schottky diodes would probably be acceptable.
Mixing mosfets and schottky diodes is a nice middle ground!

Very nice to hear from Mr. Bandgap, a.k.a. the other Steve, again!
 

Bandgap

Enlightened
Joined
Aug 14, 2002
Messages
284
Location
London
Very nice to hear from Mr. Bandgap, a.k.a. the other Steve, again!
You are most kind Mr K

I think the buck converter was just going to be connected to the rectified dynamo output without any other controller or feedback.....For any given load, there are two(?) places on the dynamo's V-I curve where the buck converter could end up at.
That is what I meant - the internal voltage feedback in the chip cannot be trusted to push the control loop into the nice high-input-voltage/low-input-current state (rather than lo-V Hi-I input state).

For this reason, I have always used feed-forward based on measuring the dynamo speed (via its output frequency).

That excellent table of output voltages and loads that Steve K re-published above should give anyone enough data to pick thresholds for a feed-forward scheme either switching leds in and out of series, or altering the M/S ratio of a PWM. (don't forget to add a little hysteresis to stop flickering).

MPPT is another interesting option - but tough to optimise at low speed, particularly during firm braking (I suspect).
I think I mentioned (in a private message to Steve K, he of MPPT expertise) that - given infinite spare time - I would go for a learning algorithm that used MPPT to decide where mode switching thresholds should be, and then use simple speed-based feed-forward to act on those thresholds in actual use.
This would mean the MPPT algorithm could get to grips with finding ideal thresholds for the tricky slow speeds during the occasional periods when the bike is moving slowly for sustained periods.

I can see it now: a little microcontroller logging data full time as a background task, analysing this to hone thresholds as another background task, and a dynamo/led foreground task implementing the thresholds
- anyone for a multi-tasking bike light controller !!

There is something to be said for just using a plain schottky rectifier.
I agree too, but I can seldom bear the thought of that lost efficiency. I have had active rectifiers working without trouble for years - one mosfet and one bipolar (pick your transistors carefully for the latter!)

The other Steve :)
 
Last edited:

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
...

For this reason, I have always used feed-forward based on measuring the dynamo speed (via its output frequency).

aren't there F-to-V converters that could serve this function? Now that I think of it, I think one of Martin's circuits used one....
http://www.pilom.com/BicycleElectronics/DynamoCircuits.htm
oh yeah... circuit 12 uses a LM2907. The datasheet show that it is really a frequency detector sort of device, where the output switches when a frequency threshold is crossed.

hmmm, I was thinking of something more linear, where the output voltage was a linear function of the frequency. You might be able to do a decent job of using it to control the duty cycle, or mark-space ratio, of the buck converter.

Looking at the LM2907 datasheet, it does appear that you can tap off the output of the charge pump, so you do get a frequency-to-voltage output. That might be handy! $1.85 from Digi-key.
 

mbanzi

Newly Enlightened
Joined
Nov 2, 2015
Messages
37
Welcome Bandgap! Happy to have two great minds contributing to this thread! I'll add again that I'm not a hardware engineer, so I need all the help I can get.

BTW1
using 2x n-mosfets in a buck means that either you can never achieve 100% duty-cycle for Vout=Vin, or you need a separate power rail to feed the upper gate.
Using a p-mosfet in the upper position allows 100% operation.

While this is somewhat over my head, I'm going to do some research.

BTW2, regarding bridge rectifiers:
Rather than use a four-mosfet active bridge rectifier, plus a Schottky, why not use two mosfets and two Schottkys?
You get the same voltage drop, reverse-blocking, and save two mosfets.
Plus, with separate mosfets you get the chance to protect the gates with resitors and Zeners.

I was trying to find an example of this implementation, curious to try it.

aren't there F-to-V converters that could serve this function? Now that I think of it, I think one of Martin's circuits used one....
http://www.pilom.com/BicycleElectronics/DynamoCircuits.htm
oh yeah... circuit 12 uses a LM2907. The datasheet show that it is really a frequency detector sort of device, where the output switches when a frequency threshold is crossed.

I was originally thinking of using a zero cross detector with an opto-isolator to measure the frequency, but this may be a little simpler to do.

Could be really cool to have the MCU build the table of data dynamically then use that in conjunction with MPPT - an AI dynamo light!
 

Bandgap

Enlightened
Joined
Aug 14, 2002
Messages
284
Location
London
hmmm, I was thinking of something more linear, where the output voltage was a linear function of the frequency. You might be able to do a decent job of using it to control the duty cycle, or mark-space ratio, of the buck converter.

Nice idea Mr K, I never thought of a continuous solution, only step-wise solutions.

so, a dynamo frequency>voltage converter, followed by a voltage>pwm converter, with curve-fitting in between if needed?
Very nice
However, I think an all-digital solution would need far fewer components and be just as good
- is it time to buy a microprocessor development system?

The other Steve
 

Bandgap

Enlightened
Joined
Aug 14, 2002
Messages
284
Location
London
Welcome Bandgap! Happy to have two great minds contributing to this thread! I'll add again that I'm not a hardware engineer, so I need all the help I can get.

You are too kind.
I am pleased to be reading stuff from real software guys - I write code like monkeys type Shakespeare.

I was originally thinking of using a zero cross detector with an opto-isolator to measure the frequency, but this may be a little simpler to do.

There are far simpler ways to do that.

I can sketch out some circuits for various parts, but I don't know how to post them - can you help.

Also, i am not a power supply designer, so they will not be optimised - it takes a real PSU designer to get the magnetics just right.

in the mean time, take a look at th eTC442xA (http://ww1.microchip.com/downloads/en/DeviceDoc/20001423J.pdf) range of chips as mosfet gate drivers - they can work at 100% duty cycle because they do not need 'bootstrapping'. you would need to follow this with a pair of mosfets to beef up the current output - the top one p-channel and the bottom one n-channel - each one driven by one channel of the TC442xA.
for good reasonl the pair of mosfets would look a lot like the output stage of one channel of the driver chip - you would be building a giant CMOS output.
There is one difference - your two output devices need t be driven by 'non-overlapping' drive signals so they are never both on at the same time (or great spikes of current will be wasted). In Microchip Land, peripherals like the COG and CWG provide suitable non-overlapping waveforms.

Could be really cool to have the MCU build the table of data dynamically then use that in conjunction with MPPT - an AI dynamo light!

With Steve K's help, you could be the person to do it. (and with your help, he could finally 'go digital'!) - and, while you are helping people, what idiots guide could I read to get into embedded C?
 
Last edited:

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
Nice idea Mr K, I never thought of a continuous solution, only step-wise solutions.

so, a dynamo frequency>voltage converter, followed by a voltage>pwm converter, with curve-fitting in between if needed?
Very nice

I'm starting to go back to my model of the SON, based on Nick Ray's data, and hope to do the math to see how the dynamo frequency maps to buck converter duty cycle. In a perfect world, it will a linear function. It could easily be exponential or logarithmic, etc., which would make it more of a challenge to do as a analog-ish circuit.

I like the all-analog approach in some ways... the debugging is easier since you only have to deal with how the circuit is misbehaving. Plus... it's easier for other people to build their own, since the hardware is very generic and the functionality is pretty simple and obvious. A little uC based design would certainly end up smaller, which is nice. I suppose you could post a software flowchart if others wanted to try building it with their preferred uC.

However, I think an all-digital solution would need far fewer components and be just as good
- is it time to buy a microprocessor development system?

The other Steve

that is very much on my list of things to do. It's just a little further down the list than the stuff I'm working on right now (i.e. delayed bike maintenance, cleaning of domicile, attempting to clean out the closets, etc). I do have a local bike & electronics friend who is very experienced in microcontrollers, and I hope to get some guidance from him. I think I'm better at the hardware side of the business, so perhaps we can work something out. :)

I did talk to our local Atmel distributor about development systems, and she said there is a lot of stuff available from Atmel, both in terms of hardware and on-line educational materials. I'm guessing that there are a ton of youtube videos on the subject too.
 

Bandgap

Enlightened
Joined
Aug 14, 2002
Messages
284
Location
London
A little uC based design would certainly end up smaller, which is nice. I suppose you could post a software flowchart if others wanted to try building it with their preferred uC.
I almost don't know what I am saying here - but I believe 'C' is the equivalent of a good old flowchart. Software folk seem to read it like I read a circuit diagram (better than I read a circuit diagram!).
And people can email code to each other - more tricky that emailing connections!

delayed bike maintenance, cleaning of domicile, attempting to clean out the closets, etc
Indeed.... same here, including a half-finished kitchen I wish I hadn't started......

Just on the Atmel front, it looks like some standard Atmel PWMs can provide non-overlapping PWMs for deadband control - it is just that it is explained as clearly as by Microchip - it is here for the ATmega48 http://www.atmel.com/Images/doc8010.pdf
One little Arduino dev boards that will run from 2.7V (SparkFun LilyTiny) has an ATtiny85, which looks like it can do the same thing, but no idea what max output frequency is.
LilyTiny is here https://www.sparkfun.com/products/10899

Many 8bit PIC PWMs can be run in a three bit mode which means they can produce several hundred kHz (for small magnetics) providing you don't mind being limited to a choice of only PWM ratios:
(12.5%) (25%) (37.5%) (50%) (62.5%) (75%) (87.5%) or (100%).
Mbanzi - I think 50% in a buck converter with a single led is equivalent to a load of two leds in series, 25% is like four in series, and 37.5% is three(ish).
I can probably even show the maths!

The other Steve with closets to clean
 
Last edited:

mbanzi

Newly Enlightened
Joined
Nov 2, 2015
Messages
37
One little Arduino dev boards that will run from 2.7V (SparkFun LilyTiny) has an ATtiny85, which looks like it can do the same thing, but no idea what max output frequency is.
LilyTiny is here https://www.sparkfun.com/products/10899

I love the ATtinys from Atmel! Max PWM frequency depends on the clock (typically 8-16MHz) and the required duty cycle resolution (minimum 2 steps - maximum 255). This means with a 16MHz clock you can get up to 8Mhz PWM but only at 50% duty cycle. With full resolution 62kHz is possible, 500kHz still has decent resolution with around 3% steps.
 

Bandgap

Enlightened
Joined
Aug 14, 2002
Messages
284
Location
London
I love the ATtinys from Atmel! Max PWM frequency depends on the clock (typically 8-16MHz) and the required duty cycle resolution (minimum 2 steps - maximum 255). This means with a 16MHz clock you can get up to 8Mhz PWM but only at 50% duty cycle. With full resolution 62kHz is possible, 500kHz still has decent resolution with around 3% steps.

Interesting. Do you know anything about the deadband capability at, say, 200kHz output? - after a brief look in the data sheet, it seemed to me that deadband delays might only be available one count of the output resolution - so 1us if the resolution of the PWM was 1us.

Thanks

The other Steve
 

mbanzi

Newly Enlightened
Joined
Nov 2, 2015
Messages
37
Interesting. Do you know anything about the deadband capability at, say, 200kHz output? - after a brief look in the data sheet, it seemed to me that deadband delays might only be available one count of the output resolution - so 1us if the resolution of the PWM was 1us.

As far as I know some ATtinys (e.g. ATtiny85 & ATtiny261) have a programmable dead time generator. Of course the one I like to use, ATtiny84 does not, but I've never had a use for it! The Dead Time Generator has a dedicated prescaler (CLK / 1,2,4,8) and a 4-bit down-counter, which should provide for large range of dead times that can be generated.

1 / (16Mhz / 8 / 2^4) = 8uS max dead time?? I have a few Attiny85 boards, so I'll try to play with this over the weekend. Unfortunately I don't have a good scope, but I'll try to get a picture of the PWM waveforms.

Look at page 105: ATtiny85 Datasheet
 
Last edited:

Bandgap

Enlightened
Joined
Aug 14, 2002
Messages
284
Location
London
As far as I know some ATtinys (e.g. ATtiny85 & ATtiny261) have a programmable dead time generator. Of course the one I like to use, ATtiny84 does not, but I've never had a use for it! The Dead Time Generator has a dedicated prescaler (CLK / 1,2,4,8) and a 4-bit down-counter, which should provide for large range of dead times that can be generated.

1 / (16Mhz / 8 / 2^4) = 8uS max dead time?? I have a few Attiny85 boards, so I'll try to play with this over the weekend. Unfortunately I don't have a good scope, but I'll try to get a picture of the PWM waveforms.

Look at page 105: ATtiny85 Datasheet

Thanks mbanzi, reading through it now.
I wish I could find some time to build hardware as I am dying to try out a nice dynamo-fed synchronous buck converter.

BTW, if I might be nosey, are you by chance the Arduino M Banzi?

The other Steve
 

mbanzi

Newly Enlightened
Joined
Nov 2, 2015
Messages
37
Thanks mbanzi, reading through it now.
I wish I could find some time to build hardware as I am dying to try out a nice dynamo-fed synchronous buck converter.

BTW, if I might be nosey, are you by chance the Arduino M Banzi?

The other Steve
No I'm not and you're not the first to ask that. Mbanzi is a nickname I got years ago. Got very annoyed at this M.Banzi person taking my username on many sites until I realized who it was!
 

Bandgap

Enlightened
Joined
Aug 14, 2002
Messages
284
Location
London
No I'm not and you're not the first to ask that.

I am just as honoured to share a thread with you mbanzi, and the wise SteveK :)

Am very much enjoying ATtiny85 data sheet - I am that sort of person. Would be trying to make a dynamo interface if I had a little spare time.

How did youy get on with experiments?

The other Steve
 

mbanzi

Newly Enlightened
Joined
Nov 2, 2015
Messages
37
How did you get on with experiments?

Turned out to be very simple to add dead time - just 2 additional lines of code! You set the dead time for the regular & complementary wave separately, so you could have different values if that was required.

This is a 10kHz PWM signal with the complementary output turned on, no dead time:

sshot122726.png


This is the same 10kHz PWM signal with the complementary output turned on, and the maximum possible dead time added to both waves' rising edges (approx 8uS):


sshot123334.png


and this was my test setup using a AtomNanite85 and a Xprotolab Plain USB scope (very limited bandwidth, which explains the 10kHz PWM):

IMG_3812.JPG



Source code is here: PWM on the ATtiny85 with complementary waveform and dead time

I was lazy and did the test program using the Arduino IDE with the Digispark configuration. I added a lot of comments, but the actual code can be done in 7 statements!
 

mbanzi

Newly Enlightened
Joined
Nov 2, 2015
Messages
37
in the mean time, take a look at th eTC442xA (http://ww1.microchip.com/downloads/en/DeviceDoc/20001423J.pdf) range of chips as mosfet gate drivers - they can work at 100% duty cycle because they do not need 'bootstrapping'. you would need to follow this with a pair of mosfets to beef up the current output - the top one p-channel and the bottom one n-channel - each one driven by one channel of the TC442xA.
for good reasonl the pair of mosfets would look a lot like the output stage of one channel of the driver chip - you would be building a giant CMOS output.
There is one difference - your two output devices need t be driven by 'non-overlapping' drive signals so they are never both on at the same time (or great spikes of current will be wasted). In Microchip Land, peripherals like the COG and CWG provide suitable non-overlapping waveforms.

I'm trying to understand the buck converter using P & N mosfets :confused::


  • If I'm generating PWM from the ATtiny (regular & complementary waveforms with dead time added), do I still need an inverting output for the high (P-channel) driver?
  • What would good matching P & N mosfets be for the TC442xA driver be for this application?

Questions are based on this design from Driving Power MOSFETs in High-Current, Switch Mode Regulators

Screen%252520Shot%2525202016-02-05%252520at%25252012.31.08%252520PM.png
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
I'm trying to understand the buck converter using P & N mosfets :confused::


[*]If I'm generating PWM from the ATtiny (regular & complementary waveforms with dead time added), do I still need an inverting output for the high (P-channel) driver?

at a casual glance... if you are working with complementary outputs... and you need a low signal to turn on the P mosfet, and a high signal to turn on the N mosfet, then it appears that the P mosfet does require an inverter in order for the two mosfets to not be turned on at the same time.

[*]What would good matching P & N mosfets be for the TC442xA driver be for this application?

Questions are based on this design from Driving Power MOSFETs in High-Current, Switch Mode Regulators

I think you'd have to define what currents and voltages you expected to be dealing with.

Looking at some of the model data I have for the SON, at 90Hz, you could see 28V at the input of the buck converter, and could be delivering 4A to the LED (assuming a single LED absorbing the 12W that the dynamo can produce at 90Hz). I think that the P mosfet only needs to handle 0.5A or so (so size it for 1A), and the N-mosfet needs to handle at least 4A but shouldn't see much more than 4V or so.
Having said that... I'd prefer to run a simulation to confirm these off-the-cuff estimates. :)
 
Top