Picture of Pulse Width Modulated LED Torch
Pulse width modulation (PWM) can be used to vary the power, speed or brightness of many devices. With LEDs, PWM can be used to dim them, or make them brighter. I will use them make a small hand torch.

An LED can be dimmed by quickly turning it on and off, several times a second. By varying the mark space ratio, the brightness is varied.
A simple implementation of a PWM system would be a clock feeding an LED and protective resistor to the ground.

The clock should ideally oscillate at a frequency of 50Hz to ensure that you will not see the oscillation. To test this, you can either use a signal generator to provide a square wave, as below, or create a circuit to do it for you.

Step 1: Relaxation Oscillator

Picture of Relaxation Oscillator
This circuit will produce a square wave with a duty cycle of 50%. Two 10K resistors connected to the +input of the op-amp provide a reference voltage, and R1 and C1, connected to the -input, create a time constant which controls the frequency, f = 1/{2ln(3)RC}.

The capacitor C1 charges and discharges through the resistor R1, and the time taken for this cycle to occur is the period of the waveform.

chetancc2 years ago
Please put video so that we can see how it looks. How long this light goes in dark?
luckyvictor5 years ago
 so your LED are connected in parallel??
mathews (author)  luckyvictor5 years ago
Yes, each with its own current limiting resistor.
recuat mathews3 years ago
in step 2 there is a i.c. or transistor in the picture? no part no. please reply. thanks
mathews (author)  recuat3 years ago
No, there is not.

You can select an NPN transistor based on the current required for the LEDs you are going to use. This selection is a design decision you must make, and I cannot make for you.
 Thank you very much for replying me, as you can see from my detail, I am a newbie to electronics and just join recently, I have a question about powering up 12  LED, would you mind to have a look of the following link and give me some technological advise please?


thanks again for your time and advise
fobot4 years ago
This is a great instrucable! Some very simple and powerful ideas are presented here, Thank you!
heaker894 years ago
where put the switch?
Padlock6 years ago
Err... Exactly what is the point of this? Using them normally (without PWM) would yield just as much light? I could see if there was a potentiometer to adjust the frequency and there for the light output, but there isn't.
mathews (author)  Padlock6 years ago
Just because it gives off the same amount of light, it is not unnecessary. It uses far less current as an average, and the LEDs do not heat up anywhere near as quickly.

And yes, potentiometers could be used to adjust the frequency (Step 2), so long as you ensure the on time is no greater than 10ms.
Padlock mathews6 years ago
Show me the math. How much energy does this save? Does the IC use as much energy?
mathews (author)  Padlock6 years ago
From observation while testing the relaxation oscillator, the circuit draws approximately 10mA. While off, the LEDs draw no power, and when on, the LEDs draw 150mA each, and so 900mA. Given the duty cycle of 1:10;

10mA + (10*0mA)/10 + (1*900mA)/10 = 10mA + 0mA + 81mA = 91mA

As I said above, the power supply gave a reading of about 85mA, so this isn't far off.

If it was wired up 'normally' then

6 * 30mA = 180mA

Adds up to a fairly large saving.
lemonie6 years ago
Nice. Not quite off-topic: PWM is good for model trains, as inertia tends to give unrealistic acceleration from normal controllers. L
mathews (author)  lemonie6 years ago
How do you mean off topic? PWM is good in this instance due to its large (<50%) energy saving.
lemonie mathews6 years ago
I said "not quite off topic" with reference to the rest of my comment. PWM is good for things, and not just LEDs. L