How is it possible to construct a "light intensity varier" (increse/decrease lighting) of a 220V bulb using pwm? The main requirement is to make use of pwm

I was thinking of this connection:

220V mains --> rectifier --> smoothing --> regular (to convert to dc) --> relay --> 220V bulb
where one end of the relay is connected to the 220V dc and the other end to ground;
and is switched one to the other using the output of a PWM as shown in the block diagram 

Block Diagram

However, I am afraid that this is a poor design and not safe: no transformer to lower down the ac voltage (so I can drive the 220V bulb); and in effect, other components might blow up.

My problem is not actually on the PWM but on the connection of other components.

Please give me a better solution to this. Diagrams or schematics or even links may help me a lot. Thank you.

  • 4
    \$\begingroup\$ PWM won't work with a relay. Relays can't switch that fast. The way to go is to use a TRIAC. \$\endgroup\$
    – m.Alin
    Sep 9 '11 at 9:16
  • \$\begingroup\$ @m.Alin: Thanks. Aside from using TRIAC, is it safe to connect the 220V directly to the rectifiers and other components? \$\endgroup\$ Sep 9 '11 at 9:33

If the relay is a mechanical one it's an Awfully Bad Idea™. Relays need several ms to activate and release, so the switching frequency will be limited to about 100Hz. Your actual control cycle will be much slower than this so you'll end up with noticeable flicker to start with. The relay will also make a lot of noise, and spark all the time, so that a 100 000 cycle relay will reach its end of life after less than an hour. So the relay is out.

What you could try is to use a MOSFET to do the switching. You'll have to place it in a rectifier bridge, and control it through an opto-coupler, but that's no problem.
The MOSFET, when on, can have a very low resistance (the infamous \$R_{DS(ON)}\$), so we might think that power losses may be low. Unfortunately in general this isn't the case. The MOSFET dissipates power while switching on or off, appropriately called switching-power, and the more frequently you switch the higher the dissipation. And then there's the EMI you're radiating.
On my previous job a colleague of mine worked for a while on what we called the "100kHz dimmer", which was supposed to use PWM to control brightness for high power dimming (4kW). But while internally the name remained the principle was left because it simply isn't worth the trouble.

That's the reason most dimmer use phase control of your mains frequency.

enter image description here

This image shows forward phase dimming, which most dimmers do, including the simplest "four-component dimmers". They work well, and your switching frequency is fixed to twice the mains frequency (100Hz or 120Hz). For incandescent bulbs there's a variant, called reverse phase dimming

enter image description here

which doesn't cut in on the phase, but cuts it off. Simple dimmers using a triac as switching element can't do this; once a triac is on you have to wait until a zero-crossing before it automatically switches off. Advanced dimmers can select forward or reverse phase dimming depending on the kind of load.

I suggest you stick to phase cutting. If you plan to use a microcontroller you may make it intelligent enough to have a linear power curve. Most dimmers have their phase congruential with the potmeter rotation, but because of the mains sine shape this doesn't agree with the power curve.


See info at end re phase control dimmers. Then -

PWM control of phase type dimmer:

To convert a phase control dimmer to a PWM controlled dimmer you could use a comparator to compare the smoothed PWM with a signal which is based on a filtered version of the mains voltage.

In the second circuit below (which uses a TRIAC) the comparator inputs would be filtered PWM and the signal at the C2/R1 junction. When the C2/R1 signal rose higher than the PWM filtered value gthe comparator would fire the TRIAC. As POWM duty cycle increased the brighhtness would decrease. ie The PWM low signal duration would be roughly proportional to brightness.

"Easier" would be to rectify the mains and then modulate a MOSFET with the PWM signal.

eg in the circuit below, the lamp can be fed from rectified mains.

enter image description here

Everything connected to the MOSFET drain and above needs to be scaled up to mains voltage. LAMP goes where DC load is shown. LED indicator as shown is probably unwise. There are other ways to drive an LED indicator.

In place of VR1 smooth PWM and feed to comparator. Or feed PWM direct to MOSFET gate.

The circuit is well described on this webpage. Changing to a 12V or 24V lamp and using the voltages shown would be safer.

MOSFET as shown is not isolated from mains. An optocoupler drive could be used.

The material below here focuses on TRIAC phase controlled lamp dimmers. It does NOT address the PWM control question.

Use information above re modifyiing a phase control dimmer circuit by adding a comparator to compare smoothed PWM with mains signal.

Or use a DC lamp circuit as above :-).

Search for

  • "light dimmer" or

  • "dimmer" or

  • "phase controlled dimnmer" or

  • "TRIAC dimmer.

The function that you require is provided by "light dimmers" which are in very common use. The traditional method is to use a TRIAC - an AC electronic switch which can be truned on at any pont in an AC cycle but not turned off again until the next zero crossing of the AC.

Average voltage and thus brightness is controlled by varying the position in each cycle that the TRIAC is fired. This is ca;lled "phase control".



  • Dimmers of the sort described below usually have ALL parts effectively at mains voltage.

  • Build with care and understanding OR don't even start.


Here are many images of TRIAC dimmer circuits with links to the related page in each case.

The diagram below shows a typical TRIAC based dmmer.
Good basic description of the circuiit below is found here

enter image description here

This is functionally the same - has a simple PCB image - no noise suppression components.

enter image description here

Mains driven dimmable LED cpntroller.

Allows LEDs to be driven from mains and dimmed with a standard TRIAC phase control dimmer.

LM3445 TRIA dimmable off line LED controller IC

In stock at Digikey $3.78/1

LM3445 datasheet

enter image description here

LM3445 dimmer youtube discussion - excellent.

Kitset lamp dimmer on ebay - about $US10

ebay dimmer 110 VAC 250 Watt $US10


I take it by "220V bulb" you mean a normal standard household 220V AC bulb?

Rctifying (and smoothing) 220VAC would give you something more in the order of 310VDC which would not be good for the bulb.

So switching to using straight AC might be an option, yes?

Alas, no - not with PWM.

You'd be wanting to switch the AC on and off at a high frequency. As the AC is itself varying in voltage at a rate of either 50 or 60 HZ, imagine what a mess the waveform would be.

So the immediate thought is "So why not use a zero-crossing SSR to do the switching?"

Again, alas, no.

Take a 50HZ AC waveform. That would give 100 zero-crossings a second. So at most, you could switch on and the off 50 times per second. If you want a decent range of brightnesses, say 256 (8 bit) resolution, you would need to be able to switch on at the start then switch off at any one of 256 points before switching on again. A 256 cycle at 100hz would be a 2.5 second period. With a 50% duty cycle the light would be on for 1.25 seconds and off for 1.25 seconds.


So it looks like DC is probably the way to go. So you'd want to rectify and regulate and smooth the power. Quite what products there are available for regulating the voltage at that sort of level I really couldn't say.

But then, if it's just DC you're working with, there are plenty of components that can switch DC at high voltages and at high frequencies. Take a look at "IGBT" transistors - Insulated Gate Bipolar Transistors. These are designed to switch high voltages (essentially they are a FET controlling a BJT).

Quite how the bulb would stand up to such rapid switching though is anyone's guess.

  • \$\begingroup\$ Thanks for the answer. Can IGBT drive 220Vdc as supply? Or is there a work-around to do? Which is more efficient to use, IGBT or TRIAC? \$\endgroup\$ Sep 9 '11 at 10:20
  • \$\begingroup\$ Yes, IGBTs can switch DC voltages up to thousands of volts if you want. 220VDC is very common. \$\endgroup\$
    – Majenko
    Sep 9 '11 at 10:21
  • \$\begingroup\$ There's a good Wiki page about them here: en.wikipedia.org/wiki/Insulated-gate_bipolar_transistor \$\endgroup\$
    – Majenko
    Sep 9 '11 at 10:22
  • \$\begingroup\$ how about triac? \$\endgroup\$ Sep 9 '11 at 10:28
  • 1
    \$\begingroup\$ Triacs are aimed at switching AC not DC \$\endgroup\$
    – Majenko
    Sep 9 '11 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.