So I want to build a circuit that can control the intensity of a light bulb (powered by 220V AC, 60 Hz) through the output voltage of Arduino.

I know I must use Triac but the question is, is the output voltage/current of Arduino good enough to control the Triac current such that I can get different levels of light intensity?

The block diagram of the whole system is given below, the whole purpose is to control the intensity of light through the output voltage of Arduino only, I don't need any kind of light sensor or anything else...

[Arduino] --> [Light dimmer circuit] --> [light bulb]

I'm honestly new to this Triac thing and don't want to blow up things, so I need some guidance from experts like you :)

  • \$\begingroup\$ You'll probably want to do something like use an opto-isolator in between the arduino and the triac \$\endgroup\$ – jramsay42 Feb 6 '18 at 7:51
  • \$\begingroup\$ Sure, I believe that's something we use for safety purposes only by isolating low power side from the high power side. But my question is about the feasibility of controlling light intensity through Arduino output voltage, and how the circuit will look like \$\endgroup\$ – Fahad Feb 6 '18 at 8:18
  • 2
    \$\begingroup\$ Google how to use a triac as a light (or lamp) dimmer. You'll find umpteen articles about it. Then, when you have a specific question about it, someone will help you. :) I'd be more worried about electrocuting myself than damaging an Arduino! \$\endgroup\$ – DiBosco Feb 6 '18 at 9:08
  • \$\begingroup\$ You mentioned not wanting to blow things up, so I thought the opto might help. \$\endgroup\$ – jramsay42 Feb 6 '18 at 9:12

Capability wise, yes arduino running at 16 MHz is more than capable of dimming your incandescent bulbs by phase control method.

The logic goes like this: You sense the exact time when sine wave crosses zero. You wait for some time (0-10 milliseconds depending upon the brightness you want), turn the triac ON for like 100 uS and then turn it OFF.

Now 0-10 ms should depend a bit on exact components chosen and you might want to make this range 1-8 ms or so. Having some buffer saves you from running into edge cases which will cause flicker in the bulb.

100 uS is a good number but you can reduce it as well. Check it before you mark it ready for production.

To keep things safe, I (and everybody else) recommend using an optocoupler for zero cross sensing as well as triac driving.

Use this circuit to sense the zero cross: (3.3V will be 5V for you if you are using arduino UNO. No need to change anything due to that.)


And you can drive the triac using this circuit:


From my experience, I recall that arduino running on 8MHz at 3.3V wasn't that good. I saw very slight flicker when focusing too hard but again it could be due to code. It was using less efficient functions like delay and delayMicroseconds. Use interrupts for better performance.

|improve this answer|||||
  • \$\begingroup\$ Thanks Whiskeyjack for your comment, it was really helpful to me. But the one thing I couldn't understand is the difference between the first circuit and the second? Do I need both of them? \$\endgroup\$ – Fahad Feb 13 '18 at 18:03
  • \$\begingroup\$ From my understanding, you are using the first circuit to sense the zero crossing of the sine wave from which I can determine the amount of current passing through the load (AC to OPT to MCU). Then the second circuit is used to connect the load ( MCU to OPT to Load)... so basically I need 2 OPTs? \$\endgroup\$ – Fahad Feb 13 '18 at 18:06
  • \$\begingroup\$ @Fahad - You need both circuits. First one to sense zero crossing. It has nothing to do with amount of current passing through the load. Second one is to drive the triac. Check the part numbers - EL814S and FOD420. They are opto-couplers but with totally different applications. Read more here: ecmweb.com/lighting-control/shining-light-dimming \$\endgroup\$ – Whiskeyjack Feb 14 '18 at 5:01

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.