AC Light Dimmer using Arduino 2

(New Video to be added soon)


Most of the household appliances used by us operate from the 220V/50hz AC supply (in India) such as Lights, TVs, refrigerator, fans, etc. We can digitally turn them ON/OFF if required, using Arduino and Relays or SSR’s. But what if we need to control the power of those devices for example to dim an AC Lamp or to Control the speed of the Fan?
In that case, we have to use phase control technique and semiconductor switches like TRIAC to control the phase of AC supply voltage.

So in this tutorial, we will learn about an AC light dimmer using Arduino and Dimmer module (based on TRIAC). Here a TRIAC based dimmer module is used to control the voltage to a AC lamp and using a module makes the project very easy to make.

Lately, Dimmers have become an often used modules for the smart home systems. For example, when you need to smoothly change the light brightness. The lamp is slowly turning ON or OFF, creating a comfortable atmosphere. Dimmer works most effective with filament lamps. It’s less stable with low brightness dimmable LED lamps, but with moderate and high brightness it will perform a solid job. Note that luminescent lamps (gas discharge lamps) do not support dimming.


Zero Crossing Detection Technique

For controlling AC voltage, we first need to detect the zero crossing of the AC signal. And, every time the signal comes to Zero crossing point, we have to detect that point and trigger the Dimmer Module (TRIAC) as per the power requirement. Zero crossing point of an AC signal is shown below:

TRIAC and Firing Angle

Once the zero crossing point is being detected, we can use a TRIAC based circuit to control the firing angle. TRIAC is a three-terminal AC switch which can be triggered by a low energy signal at its gate terminal. In SCRs, it conducts in only one direction, but in the case of TRIAC the power can be controlled at both directions. Here we are using a BTA16 TRIAC for AC Light dimmer purpose.


As shown in the figure above, we have 2 different firing angles 45 degree and 90 degrees. The time “t1” or “t2” is the delay time which we have to give as per our dimming requirement.
The lesser the firing angle, more power is transmitted, thus the bulb glows brighter.

We know that the frequency of AC signal is 50 Hz here. Thus, the time period will be 1/f, which will be 20ms, so for a half cycle, this will be 10ms or 10,000 microseconds. Hence for controlling the power of our AC lamp, the range of “t1” can be varied from 0-10 ms.



The dimmer module consists of an on-board optoisolator or optocoupler which is used to maintain isolation between two electrical circuits like DC and AC signals. Basically, it consists of an LED that emits infrared light and the photo-sensor which detects it. The module uses an MOC3021 optocoupler to control the AC lamp from microcontroller signals which is a DC signal. 

Components Required

  1. 1 x Arduino Uno R3 (Buy here)
  2. 1 x 1 channel AC Dimmer Module (Buy here)
  3. Jumper Wires (as per connection) (Buy here)
  4. AC Wire/Power Cord
  5. 1 x AC Bulb


Arduino      =>        1 Channel Dimmer Module (AC Light Dimmer module)

5V                   =>         5V

Gnd                =>         Gnd

2                     =>         ZC (Zero Crossing)

13                   =>         PWM/DIM



Code & Circuit Diagram

Download the code and circuit diagram here.


  1. Am Ali from Uganda and wanted to know if u guys also sell usb port sockets and also wanted some dimmer modules for smart home

    1. Please drop a mail to [email protected].

Leave a Reply