Maker Pro
Maker Pro

Beginner: Constant Current Switch Mode Supply with PWM

MagicMatt

Jun 15, 2011
70
Joined
Jun 15, 2011
Messages
70
Please can somebody take a look at the attached GIF and tell me if it would work? I have no idea how to calculate the maximum switching frequency based on the transistors or mosfets, so if I could have some guidance that would be much appreciated. Logic and PIC side of things I'm completely happy with, but I don't really understand the analogue side of things.

I've tried to design a constant current power supply after looking at a few designs on the web. I want around 600mA, but in reality anything from 500mA to 700mA is fine. I want to control the brightness of a set of LEDs via a logic output from a PIC, and want the "flicker" fast enough so as not to be perceptable either to the eye and ideally not to a webcam either, hence I am trying to get somewhere near 1kHz if that's possible, as at a duty cycle of 10% I can see the "off" period still being undetectable. The only power supply available to me is a 12V 5A supply, hence supplying 2 or 3 LEDs in series (also to reduce parts) rather than each individually. In total, there could be 16 LEDs (4 of each colour R,G,B and W).

Edit: (A) and (V) are where I will put my test meter for testing. XSG is a signal generator (it will be the output from the PIC).
 

Attachments

  • Livewire---Constant-Current-PWM.gif
    Livewire---Constant-Current-PWM.gif
    25.5 KB · Views: 1,016
Last edited:

Resqueline

Jul 31, 2009
2,848
Joined
Jul 31, 2009
Messages
2,848
I can't see that that will work. The 1uF capacitor will be discharged quite independently of the duty cycle, & the 100k resistor will charge the MOS gate quite slowly.
Try the circuit wired as below instead.
The circuit is not switchmode as such btw., it's only a switched analog constant current generator.
 

Attachments

  • Livewire---Constant-Current-PWM.gif
    Livewire---Constant-Current-PWM.gif
    20.6 KB · Views: 3,456

MagicMatt

Jun 15, 2011
70
Joined
Jun 15, 2011
Messages
70
Thanks for fixing the circuit - will that still supply a constant current with the PWM "on" constantly? I am confused as to what now turns the mosfet on and off if the current gets too high...
 

Resqueline

Jul 31, 2009
2,848
Joined
Jul 31, 2009
Messages
2,848
The MOSFET, the transistor below, and the 1.1 ohm resistor takes care of the current limiting itself (as long as there is a reasonable bias current available from R1).
Q3 & Q4 now simply diverts that bias current to ground and thus shuts off the constant current generation. Note that the PWM signal is inverted - so to speak.
If you want a non-inverted PWM then you just remove Q3 & Q4 and connect R1 to the generator instead of to 12V.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Let me suggest another way of thinking about this.

Essentially you can view a SMPS as a PWM signal driving a chopper transistor that passes current through an inductor. A flywheel diode and a capacitor combine to give you something like DC.

In it's simplest form the mark/space ratio determines the output voltage for a given load. To be regulated the output voltage is sensed and is used to vary the mark/space ratio (it can also vary the frequency with constant width pulses, or vary the off time, with constant on pulses -- but it somehow changes the amount of time the transistor is on vs off.

There are 2 other considerations. Firstly, you don't want to saturate the inductor, so either (or both) the maximum current or the on time is limited.

Limiting the on time is simple, but it doesn't directly limit the current.

Another possibility is to turn off the transistor early if the current exceeds some set value. This can be used to either protect the transistor, prevent saturation of the inductor, or to limit current.

In our case the third is the one you're looking for.

An easy way to do this is to measure the voltage across a sense resistor in series with the pass transistor, when this voltage exceeds some point, the chopper transistor is forced to switch off.

If this sensing is done after the filter capacitor, then it will more directly limit the output current.

This technique is used in a number of small (and simple) constant current SMPSs here. The beauty of these is that they are simple enough to pretty easily understand.
 
Top