I need to control a bulb of 220V, with different intensity light levels. I've an Arduino Uno Board, which receives a variable voltage from a Light-to-voltage converter (TSL12S) (Like a photoresistance).

Depending of the received voltage in the Arduino board, I need to vary the light intensity of the bulb.

The output of the board is PWM, so I think that I need to connect to a DIMMER.

How to connect the PWM output to a Dimmer, and how to control the bulb with this? I've been looking for Dimmers in order to connect this, but all the dimmers that i've seen have a potentiometer to regulate this, and I need to regulate with the PWM output from Arduino.


2 Answers 2


There are serial controlled dimmers such as these for various load wattages. There are also some wireless controlled dimmers (WiFi, BlueTooth etc) listed on the same page.

For ballasted fluorescent lights, a different type of dimmer is needed: a Ballast Control Module.

Similar, lower cost products are available on various auction sites, but caution is good when buying mains electrical equipment from overseas. Also, it might be worth verifying certification of these products for use in your country.

If you want to build your own dimmer, please note that playing with live mains can be somewhat fatal, so to speak. Unless you are qualified to work with electrical mains, this is best avoided.

  • \$\begingroup\$ It may be worth mentioning that traditional dimmers are designed to dim incandescent light bulbs. Incandescent light bulbs have been mostly eliminated in Europe and replaced by halogen, compact fluorescent or LED bulbs. Many of these cannot be dimmed by a conventional dimmer. \$\endgroup\$ Jul 8, 2013 at 9:48

The lowest-cost solution would consist of the following:

  • a mains AC phase detector (a zero-cross-detector)
  • an opto-triac (without a zero-crossing circuit!) such as the MOC302x
  • a triac or a pair of SCRs to be driven by the optocoupler
  • Safety, safety, safety, since you're working with relatively dangerous voltage levels!

How does it work? A triac will conduct if you excite it with a pulse. It will keep conducting as long as there is some current flowing through it.

Let's say you fire the triac at a random time. Every 8.33ms, the AC voltage is equal to zero. When that happens, the triac will turn itself off. So, if you fire the triac right after that zero-crossing time, it will conduct almost continuously. If you wait 4.166ms after the zero-crossing, the triac will conduct for half of the AC sine wave period. As illustrated by the following image:

Triac PWM

If you know the moment when the AC sinewave reaches ~0V, you can delay the triggering pulse. The longer you wait, the smaller will be the 'chunk of energy' supplied to your load. There are many zero-cross detector circuits around. Use google to find the one you can understand the best. I highly recommend using a design that utilizes an isolation transformer, just to keep it safe. You could probably use a low voltage AC adapter for the purpose of monitoring AC.

Okay, so how do we fire a triac? The easiest and cheapest way is by using an optocoupler with an output designed to work with triacs or SCRs. Your arduino will essentially light a small diode that will trigger a light-sensitive semiconductor isolated from the rest of your circuit. If you don't know anything about triacs, first read about thyristors/SCRs. A triac is basically a slightly different thyristor.

Wish you luck with your project.

  • \$\begingroup\$ Nice animated GIF! A great visual summary of phase control. \$\endgroup\$
    – HikeOnPast
    Nov 8, 2012 at 4:59

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.