# Building AC dimmer - digitally controlled

I'm looking for help about making a design for a digitally controlled AC dimmer to control some AC lamp light intensity.

I've searched for ideas and found these:

They are very proper for my application, but I'm not able to buy them currently.

So, my question is:

• How can I build a circuit to control the AC lamp light intensity using digital input which is the output of a microcontroller (AVR)? What are the recommended designs?

• How will this circuit behave (How the control process will occur) ? [I mean how the dimming process will happen logically]?

The first link gives a simple schematic to follow as Matt says. The DF15005S is a bridge rectifier, which is basically 4 diodes connected together in order to create varying DC from an AC input, which can then be smoothed to pure DC using a capacitor/regulator. They are typically used with a step down/up transformer in DC power supplies. Here is one with the in/out waveforms (transformer shown but not relevant):

The part can be easily replaced with many options. It's actually only rated for 50V reverse voltage, so not ideal for 115V and 240V applications. Although it's working a a very low current in this circuit, since the price difference is literally a few pence I would pick something with a minimum of 400V so you don't have to worry. Something like this 400V HD04-T is only 16 pence (GBP) in Qty 1. Many more options here (I selected everything over 200V)

In your circuit it is used to provide the photodiode in the 4N25SR2VM optocoupler with a varying DC voltage, as the diode will be damaged if it is biased too far in the negative direction (>6V). This is used to create a zero crossing detector, which sends a logic low/high signal to tell the mocrocontroller when the AC waveform passes through 0V.
The dimming circuit is an AC switch (a TRIAC) that is fired at a certain point in the AC waveform to allow current to pass - the amount of dimming is controlled by the time waited before firing the TRIAC. We start the timing when the zero crossing is detected.

For example, for a 50Hz waveform, one cycle is 1s / 50 = 20ms. A half cycle is therefore 10ms.
So if we want to set the dimming at 50%, we wait for the zero cross signal, then time 5ms using a timer in the microcontoller, then fire the TRIAC. Here are some example waveforms for various levels of dimming:

• Good explanation, thank you. What are R2 and R3 there for? I guess they are in paralell to withstand more power, but I can't figure out why it's needed before the rectifier bridge.
– chwi
Commented Sep 20, 2013 at 15:03
• They are there to limit the current through the bridge rectifier - remember the BR is just 4 diodes, so without something to limit the current you would have an effective short circuit between the mains leads (which would burn the bridge rectifier out, or whatever is the "weakest link") Commented Sep 22, 2013 at 23:59

If the first module you found meets your requirements, you can just build it yourself. The schematic is available on their website.

• The main problem in it is that, the DF15005S is not available for me .. and i have no idea what alternatives i can use instead .. Besides i don't understand how it works. Commented Aug 15, 2012 at 23:13
• The schematic is a little confusing. Usually inputs are on the left and outputs on the right, but the top section of this schematic is backwards IMO -- ZERO-CROSS is an output going to the microcontroller. The bottom section is drawn correctly, with DIMMER being an input driven by the microcontroller. Commented Aug 16, 2012 at 1:00

Semitone Lighting Controllers are open source and open hardware, have AVR inside, and plenty of features. All info you were seeking can be found on their web site.

I did a project to do this just recently with a PIC micro. Full details are at: