## Introduction: Electronics Projects: Constant Current Power Supply Using Pulse Width Modulation

Light an LED, Power a motor, this simple - ish circuit will accommodate all you constant current needs using NE555 chips! This is a great way to learn about electronics and although not as efficient as using a pre made buckpuck, this is more fun, cheaper and hopefully you'll learn something too!

## Step 1: Intro

Aim
To build on breadboard a circuit which will control the current across a load by using pulse width modulation for maximum power efficiency.
To operate the circuit the user will plug the circuit into a power supply; this will keep the load at a constant predetermined current.

Spec (don't worry about these bits yet, i will explain what these numbers mean later)
Power supply voltage: 15V,0V,-15V
Astable Frequency: 60KHz
Astable Space Period: 16Âµs
Astable Mark Period: 0.7Âµs
Monostable Period: 8Âµs (half the period of the astable)
Reference Voltage: 2mV
Output current: 2mA

Explanation
1. Astable oscillates when circuit is connected to power supply.
2. Falling edge of the astable will trigger the monostable.
3. Monostable will stay high for a variable period; this period is modulated by the difference amplifier.
4. Mosfet switches and allows current to flow.
5. Current Set circuit uses LC to smooth out the voltage into a DC flow.
6. Output is high, LED comes on.
7. Current in load gets too high.
8. Difference amplifier attempts to make this the same as the reference by changing its output.
9. Output of difference amplifier drops.
10. Period of monostable decreases.
11. Monostable on for less time per astable oscillation.
12. Mosfet switches on for less time.
13. After smoothing the voltage is less.
14. Less current across the load.
15. Difference amplifier output rises.
16. Monostable period increases.

Block Diagram:
Here is a diagram where i have split the project down into 'manageable' chunks, i will explain each chunk individually to help with the build.

## Step 2: Stage 1: Astable

Chip(s): NE555
Inputs: none, this is turned on when the circuit is connected to the power rails
Outputs: Pin 3 (output) goes to the trigger of the Monostable

'Circuit Diagram
(see image)

Build and Test
Once built test the output pin (pin3) with an oscilloscope and alter the variable resistor to get the pulse width to around 16 micro seconds. If you do not have an oscilloscope, simply set the potentiometer to the middle of its resistance using a multimeter which should work almost as well!

Explanation
When the system is on, pin 3 of the astable will oscillate between 0V and +5V. The mark and space of this astable has been set to a small space but a large mark. Having the output low for a short time enables the circuit to trigger the monostable accurately, and, if the monostableÃ¢â¬â¢s period is set to be very short it wonÃ¢â¬â¢t get triggered twice in one period of the astable.
The output of this circuit goes to the trigger of the Ne555 Monostable. Every time the astable gives a falling edge the monostable will trigger for a set period of time dependant on its pulse width modulation.
I have set the frequency of the astable to 60 KHz, this should be a fast enough sampling rate for the current to stay constant at all times, and however, it is not so fast that the monostable is triggered incorrectly, or the Mosfet being unable to switch on quick enough.
f=1.44/(R1+2R2)C
F = 60 KHz
C = 1nF
R1 = 50KÃ¢ÂÂ¦ Potentiometer
R2 = 1KÃ¢ÂÂ¦
R1= 1.44/FC-2R2
R1= 1.44/((60xÃ£â¬â€“10Ã£â¬â€”3 )(1xÃ£â¬â€“10Ã£â¬â€”(-9)))-2000

R1 = 22KÃ¢ÂÂ¦, this value is within the reach of the potentiometer I have, this means it will be easy to trim the circuit to get an accurate result.

The Space (T2) will be set very short, this will make sure that, if the monostable has a short period, it is not triggered twice in one oscillation of the astable.
T2=0.7(R2)C
The Mark (T1) will be longer to accommodate the rest of the period.
T1=0.7(R1+R2)C
This means, to get a short T1 (short low pulse) I will need a small R2. This works out with my equations for the resistors based on the whole period, as, I have set R2 very small. With these values I get:
T2=0.7((1xÃ£â¬â€“10Ã£â¬â€”3 ) )(1xÃ£â¬â€“10Ã£â¬â€”(-9)) = 0.7ÃÂµs, this is a very short period compared to the period for the whole oscillation:
p= 1/f= 1/60000=16.7ÃÂµs.
It will be short enough that even the most Pulse Width Modulated Pulses will not be short enough to fit inside the pulse.
T1=0.7((1xÃ£â¬â€“10Ã£â¬â€”3 )+(22xÃ£â¬â€“10Ã£â¬â€”3 ) )(1xÃ£â¬â€“10Ã£â¬â€”(-9)) = 16ÃÂµs

## Step 3: Stage 2: Monostable

Chip(s): NE555
Inputs: Input pulse from astable triggers monostable, and Pin 5 (pulse width modulation) input from the difference amplifier.
Outputs: Outputs pulses to mosfet to turn it on and off and allow current to flow for varying amounts of time.

'Circuit Diagram
(see image)

Build and Test
Once built test the output pin (pin3) with an oscilloscope and alter the variable resistor to get the pulse width to around 8 micro seconds. If you do not have an oscilloscope, simply set the potentiometer to approx 1/5th of its resistance using a multimeter which should work almost as well!
Your test should look something like image 3, test shows the astable output in blue, the red shows the monostable.

Explanation
The monostable will be triggered when pin 2 has a falling edge; this means that every time the astable has a low pulse the monostable will trigger. When the monostable is triggered the output will stay high for a set period of time.
The period of the monostable will be set to half the period of the astable. (16Âµs)/2=8Âµs
This means that the pin 5 will be able to vary the pulse width either way by the same amount. Pin 5 on the Ne555 can be used to vary pulse width. I will be using this pin to achieve pulse width modulation which will keep the output current of my circuit at a steady value. The voltage at Pin 5 is allowed to vary between 0.45 Vsupply and 0.9 Vsupply, the higher the voltage, the longer the pulse width.
To get the correct value for the pulse width, without modulation, I will use the following components:
p=1.1 x R x C
R=p/(1.1 x C)
C = 1nF
P = 8Âµs

R=(8xã€–10ã€—(-6))/(1.1 x 1xã€–10ã€—(-9) ) = 7272â¦ = 7.2Kâ¦
Again I will be using a potentiometer as a variable resistor (R) in order to get the correct period.

## Step 4: Stage3: Mosfet

Chip(s): 2N7000
Inputs: Monostable
Outputs: Current Set circuit

Explanation
When the monostable output is high the monostable will conduct between V supply and 0V. The longer the period of the monostable the longer the Mosfet will conduct for.

## Step 5: Stage 4: Current Set Circuit

Chip(s): no chips are used in this subsystem
Inputs: Mosfet

Build and Test
Build but don't test yet, you will blow the LED (or whatever load device your using)

Explanation
The current set circuit will take the Ã¢â¬ËpulsesÃ¢â¬â¢ of voltage from the monostable and smooth them out into a smooth voltage that can be used by the LED. Once the voltage has been smoothed by the inductor and capacitor, the Load (an LED in my circuit) will have a voltage across it, and, therefore a voltage across the small resistor (1Ã¢ÂÂ¦) it is in series with it will also rise. As I have set a low resistance very little power will be lost across it. The resistor has a known resistance so in my circuit I will use this to get the reference voltage for the difference amplifier, if the current through the LED gets higher, the voltage across the resistor will increase.
The 1N5817 is a fast switch diode; because of the high frequencies used it will have to deal with very fast speeds otherwise the circuit may not work.
LED current Calculation:
The resistor in series with the LED is there to give a reference voltage to the comparator. By using a fixed resistance I can calculate the voltage across the resistor when a certain current is flowing through it. In this case I will be using 1mA as the current. I have selected a small value for the resistor 1Ã¢ÂÂ¦, this way very little power is lost across the resistor, and this is what helps to make the circuit an efficient constant current source.
When the current through the LED rises to 1mA the voltage across the resistor will be:
V=IR
V=1 x (1xÃ£â¬â€“10Ã£â¬â€”(-3) )=1mV

## Step 6: Stage 5: Difference Amplifier

Chip(s): NE555
Inputs: Reference Voltage from potential divider, Voltage from current set circuit.
Outputs: Output goes to pin 5 (pulse width modulation) input on the Ne555 monostable.

Build and Test
See next step

Explanation
The job of the difference amplifier is to compare the two inputs and output the amplified difference. In my circuit this is used to compare the voltage across the LED with the voltage reference (preset current constant), it then will amplify this difference and output the voltage to the pulse width modulation pin of the monostable.
If the current in the LED is too high, the voltage across the resistor will be greater than the reference voltage, this will output will be low, this output will be clamped by the diode so that it cannot go below 0V, this should stop any damage happening to the monostable.
If the current in the LED is too low, the voltage across the resistor will be less than the reference voltage; the difference amplifier will output a high voltage to increase the pulse width of the monostable thereby increasing the current through the LED.
The input for the reference voltage comes from a potential divider. As my circuit is designed to work at different power supply voltages, the Vin to the potential divider network must be constant and not follow the power supply rail. To achieve this I have used a voltage regulator in my circuit. This will give out a constant +5V as long as the supply rail is above +5V, this means change in supply voltage will not affect the reference voltage, this will mean the current will remain constant.
To get an accurate 1mV from my potential divider I have used a potentiometer to be able to trim the voltage to an exact value. By changing this potentiometer the user can also change what the current limit is set to.
Calculation for Potential Divider:
Vin = 5V
Vout ~ 1mV
Use a 20KÃ¢ÂÂ¦ Potentiometer for R2 to give an accurate voltage output when the tested and trimmed. The middle of the Pot will have the most adjustability either side so I will use 10KÃ¢ÂÂ¦ in my calculation
Vout=Vin x R2/(R1+R2)
Vout/Vin ~ (10xÃ£â¬â€“10Ã£â¬â€”3)/R1
R1= R2/Vout xVin= (10xÃ£â¬â€“10Ã£â¬â€”3)/(1xÃ£â¬â€“10Ã£â¬â€”(-3) ) x5=50MÃ¢ÂÂ¦ ~ 4.7MÃ¢ÂÂ¦

Calculation for Difference Amplifier:
The difference amplifier controls the voltage at pin 5 of the monostable. The Ne555 specification sheet states that this pin will vary between 0.45Vin and 0.9Vin; this means I must calculate to achieve a gain, large enough to give the difference amplifier a value in this range.
0.45x5=2.25 0.9x5=4.5
The middle of this range is what I want the difference amplifiers output voltage to be set to when the current is the correct value:
(4.5-2.25)/2+2.25=Vout=3.375
Vout=Rf/Rin x(Va-Vb)
Assume Vref ~ 2mV
Vin = 1mV
Rin = 1KÃ¢ÂÂ¦

(Vout x Rin)/((Va-Vb))=Rf= (3.375 x (1xÃ£â¬â€“10Ã£â¬â€”3))/((2xÃ£â¬â€“10Ã£â¬â€”(-3) )- 1xÃ£â¬â€“10Ã£â¬â€”(-3)))=3.375MÃ¢ÂÂ¦

## Step 7: Stage 6: Finishing UP!

Ok guys, we're nearly done here. Firstly check that your circuit looks like the circuit diagram below, check all wires go to the same places or your circuit will not work. Then, plug your supply rails in, and turn on, hopefully the LED will turn on and not blow! Adjust the potentiometer mostly the 12nd and 3rd ones) to get the desired current output (this is checked my measuring using an ammeter between the led and ground). Then...Your done!

References
http://www.edn.com/contents/images/257052f1.pdf Participated in the
Pocket-Sized