I try to build a dimmer with arduino phase control and triac. I followed the schematic fromhttp://www.instructables.com/id/Arduino-controlled-light-dimmer-The-circuit


Now I used the software provided in the instructable link, but it is not working as it should. The light is simply blinking instead of dimming. So I used the following software to just glow the bulb without dimming:

unsigned int i=1;
void setup() {
    pinMode(AC_pin, OUTPUT);
    pinMode(11, OUTPUT);
    attachInterrupt(0, light, RISING);

void light(){
    digitalWrite(11, LOW);
    digitalWrite(11, HIGH);

void loop(){

Following are the results: In the above code I am testing the zero crossing circuit just by counting upto 100, and printing a value (100) when it turns hundred. When i run the system without load (pin 11 is not connected to opto triac) it gives me almost perfect print rate of 1 per second (visibly) and steady. Now if i connect pin 11 to opto triac 3021, the output load bulb starts blinking (not steady at all), and also the output of optocoupler (4n25) gets randomized; Visibily i can see it is not giving output at every 1 second, rather it is somewhat random. Please note instead of MOC3021 i am using EL3021, and in place of TIC206 triac i used bt 136. I am not using any snubber right now. I also tried the software from http://wiki.dxarts.washington.edu/groups/general/wiki/4dd69/AC_Dimmer_Circuit.html. Still with no luck however their schematic is little bit different in terms of biasing but i am using exact values from the schematic attached. Please help me sorting out this problem.

Thanks in advance. Debojit

  • \$\begingroup\$ What sort of bulb do you use? Incandescent? LED? Halogen? Tube? \$\endgroup\$ – jippie May 5 '13 at 20:08
  • 1
    \$\begingroup\$ What happens if you change light() as follows: { digitalWrite(11, HIGH); delayMicroseconds(100); digitalWrite(11, LOW); } ? \$\endgroup\$ – jippie May 5 '13 at 20:14
  • \$\begingroup\$ @jippie: I am using plain light bulb hopefully that is called incandescent. And i will try testing with 100 usec delay tonight my time. \$\endgroup\$ – Debojit Kundu May 6 '13 at 7:34
  • \$\begingroup\$ @jippie: In the mean time please let me know i apply a steady high signal to the moc3021 input, would it not stay high. And one more thing: when i connect the arduino output to moc3021 why the 4n25 output timing issue is arising. Also i wanted to know what is the pulse width (time) of the zero cross signal. Should i use any snubber for the moc3021 along with a snubber for the load. Will keep u posted about the outcomes \$\endgroup\$ – Debojit Kundu May 6 '13 at 7:38
  • 1
    \$\begingroup\$ ultimately success.... removing the led did the job, thanks for your suggestion. Now i think the led is eating too much, and the rest is not sufficient to drive the opto. Should i use any gain with npn transistor, if i really want that led to turn on. \$\endgroup\$ – Debojit Kundu May 6 '13 at 20:32

Browse other questions tagged or ask your own question.