In order to switch some floodlights by my Arduino, the small switch circuits I built around a 39mf22 were just not man enough to handle the current needed, so I decided to build a switch with discrete components around a TRIAC.

Now these circuits are very easy and come a dime a dozen on the internet: just google for TIC206 or MOC3041 and you have lots of choice. The reason I make an instructable for such a simple circuit is to also provide a print design for those people to lazy or unable to make a design themselves :-)

But let me start with a disclaimer/warning:
This circuit is connected to a mains voltage that can kill you. If you do not know what you are doing then do not build this circuit.. Do not touch it when it is connected to the mains. The metal plate of the Triac is connected to it's Terminal 2 and thus to the mains voltage. When in use, do not touch that plate to feel how warm it gets.
Put this circuit in a proper container.

Materials List
Triac TIC206 €1.20
MOC3041 €0.65
DIL 6 IC foot €0.15
LED €0.15
Resistor 220 Ohm 1/4 Watt €0.10
Resistor 470 Ohm 1/4 Watt €0.10
Connector €0.20
Piece of scrap PCB 23x43 mm

That is a total of €2.55
The links are just there to illustrate what I mean and to give a price indication. I have no links to that webshop other than that i use it and am satisfied with it.
It is also possible to use the considerably cheaper BT136-600, that like the TIC206 can deliver 4Amps, but it's gate current is a hefty 35-70mA as compared to the TIC206's 5mA. If a BT136 is used, the 470Ohm resistor may need to be a bit smaller (150 Ohm). The BTA16-600 is also a good choice

additionally you may need:
capacitor 10-100nF 400V
resistor 39-100 Ohm
resistor 330 Ohm

The PCB is here.
and mirorred here.

The circuit
The main components in this circuit are the MOC3041 optocoupler and the TIC206 TRIAC (M or D version). I have chosen for a MOC3041 because it has a zero crossover circuit in the chip, ensuring smooth switching. The TIC 206 is a triac that has a relatively sensitive gate.

The output from an Arduino or other uP is led to the MOC3041 via a 22o Ohm resistor and an LED. This way one can see for sure if there is current flowing through the optocoupler.
The gate of the thyristor is fed from a 470 Ohm resistor that connects through the MOC3041 optocoupler
On the printed circuit board there is room for a 330 Ohm resistor (labelled with a '*'). If one uses the TIC206 TRiac this resistor is not necessary. Some other thyristors however may need that resistor in order to start.

Triacs are not really suitable for inductive loads. As I am switching a lamp, I have no use for a snubber circuit (formed by the 100R resistor and C1). However, if you switch inductive loads you will need one. The values of the resistor and capacitor may vary depending on your situation but a proper way to start would be a 100 Ohm resistor and a 100nF capacitor. The PCB offers holes at various distances, suitable for different sizes of capacitors.

Download the PCB design(s) above and use your favorite method to etch your PCB. With regard to the design: the pcb picture in this ibble is seen from the component side: The copper traces thus are actually seen as if you are looking through the board. That is why the writing is in reverse. This design is suitable for a direct toner transfer

If you use the mirrorred design, the writing is in fact not mirrorred.

I have used the non mirrorred design for a direct toner transfer (printing it on glossy paper and ironing it on a copperplate) and that works well. Etching in Hydrochloric acid and Hydroyperoxide.

There is only a two pole connector on this PCB that can be thought of as a switch, interrupting the 'Live' line of a connection, just like a regular switch. The figure shows the proper way to connect it according to EU codes: Blue is neutral, brown is live black is switched and yellow green is earth. Outside the EU there are different colour codes.

<p>Hi, please, is it possible to use esp8266 + MOC3021 + BTA16 for switching 230v/16A ?</p>
<p>sure, but it is pushing the bta 16 to its limits. need some serious heatsinking</p>
<p>my pleasure</p>
<p>Hello,</p><p>I have tried this circuit with very bad results. I put in the snubber circuit just in case and connected a small 50w halogen lamp transformer and 30W halogen lamp, the 470ohm resistor next to the triac smoked away when the triac turned on.</p><p>Even when the triac was off I could still hear the transformator being on so it is never actually turns a device off.</p><p>I have tried it with low power devices, the switching doesnt work as it should either this cannot replace a relay. </p>
<p>I am sorry to hear about your problems. But I think your conclusions as that it doesnt work is wrong. It is working for me for 3.5 years already and as you can see from the various reactions here it works for a lot of other people.<br>If the 470 Ohm burnd away, then perhaps you made a faulty wiring.<br>Triacs are not very suitable for inductive loads because the Voltage and current can get out of phase due to an inductor.<br>Nevertheless, as a result of your comment I tried it with a 25 W Halogen lamp and I have no problems<br></p>
<p>Hi,</p><p>I tried this circuit with moc 3061 and BTA16-600 BW, with 470 and 330 ohms resistors. It works perfectly switching on and off. But when Direct AC driven LED is connected, i can see light flickering after 2 second. Can you please suggest me any changes that needs to be done to the circuit for LED load?</p><p>Thanks,</p><p>Sham.</p>
<p>AC LED's work completely different and many are not compatible with a circuit like this. For starters you would need an </p><p>lED that is labelled as suitable for dimmers</p>
<p>Yes true, the one i have does not support dimmer. Let me buy one with dimmer and try. Thanks diy_bloke.</p>
<p>if you buy one with dimmer then ofcourse you do not need this circuit anymore. I meant onr suitabl for a dimmer</p>
<p>hi,</p><p>i think the T2 label in your diagram should be T1, as its on the side of the Gate.</p><p>As per http://www.bristolwatch.com/ele/triacs.htm and other references, Gate should be triggered from T2.</p><p>i was trying out a circuit with bta136 and 3061. for safety, i was testing it with an AC-AC adapter that output 18V AC, with a 1uF/300V capacitor in series, so as to limit the current, so that i could it it with a load of LEDs.( one can also design an LEDs light from mains this way). initially had the problem with the circuit always remaining on, as well as the leakage issue. i replaced bta136 with bta16, as per comments here, but no change. researched the internet for some triac basics, one of the tips was to make sure to connect &quot;Mt2 to Gate&quot;. Checked the pinout of bta16, and made the connections again, keeping t2-gate in mind. Now i tried to make the circuit work first with 3061 alone, then with the bta16 alone, and finally using both, and had success all times. It also worked with the bta136. Note that the resistor to the input of 3061 may have to be reduced, in order to provide sufficient current. the snubber causing leakage seems unavoidable, as it provides a parallel path to the triac. I=V/R = V/(1/wC) = VwC = 240*50*10^-8 is around .12 mA, probably not significant when a proper load is connected. some circuits suggest a value of higher 100nF, so would not reduce it. i was also thinking of using a non-zero-detect photo-triac, so that i could send pulses instead of providing a continuous input current.( zero-crossing detection can help protect the load by providing a gradual voltage, and may be a must for some loads ) am attaching a pic of my test circuit. the black box at the start is a fuse-holder.</p>
<p>ManoJM,<br>oddly, my earlier reply to you has not been posted. There was a time that apparently I had to click the button 'Make Comment' twice. and as I didnt always do that, comments disappeared when i left the page.<br>Anyway, Thanks for your contribution. There indeed can be some confusion about those pins.<br>As my earlier reply got lost, I am not sure if I indeed had changed the picture then, but as far as i can see it is now correct.<br>You can use a non zero crossing detect photo triac to which you can send pulses, but as there will be no defined relation then to the point in the cycle when u send the pulse, the effect will be unpredictable. for that you may want to check mu ibble on the triac dimmer.</p><p>thanks for your picture. i always appreciate to see what othes do.</p>
<p>thats odd, i had read your earlier reply and seen the corrected diagram posted around 3 mths ago. i can still see your comment on my home page, maybe its just lost here. thanks for responding.</p>
<p>that is odd indeed, but thanks for letting me know</p>
<p>@diy_bloke Will this work with 120V? what values change? Also the other circuit with the triac the dimming one can it be used with 120V as it is shown?</p>
<p>yes it will. no need to change any values.<br>With regard to the dimmer, the changes are described in the article. If you are running 120 Volts, most likely you will also have 60Hz and then it involves changing a value in the software as well as changing 2 resistors.. as described in the article:-)</p>
<p>Hi,</p><p>I am making another switch to control water valve of over head tank and using this circuit. I am facing problem that when I supply current to pin 1 of MOC3410 pin 4 &amp; 6 get connection but even after cutting the current supply to pin 1 the connections of pin 4 &amp; 6 remains. I want some thing which cuts off connection when the signal is off. Can you suggest any solution.</p><p>Mashiur </p>
<p>Mahiurmmr<br>It seems like you have exactly the same problem as before:<br>The MOC3041 should shut off once you remove power. if it doesn&rsquo;t, you might have a faulty one or yr circuit is not correct.<br>If it is just to switch a control valve and you are having so much trouble with teh MOC, how about a transistor with a relay?<br></p>
<p>Hi,</p><p>Thanks for the circuit I made it, used a mobile for input signal ( ringtone) and 12 volt for operation of a relay had to use a triac 547 to enhance the signal the relay is switch on but it remains switched on even after cutting the input signal. I have used all registers and the PF(100n) only R330 register excluded and I used Tric225 instead of 206. </p><p>I am using it with timer and magnetic contract to drive a pump, I solved the problem of shutting the relay of by using the magnetic contracts connection to cut the power (12v) when the time is on. </p><p>I thought the load (relay) will switch off when input signal is stops. Can you advice me what to change in the circuit. </p>
<p>yes the Triac should switch off so something is keeping it on.<br>But first I need some clarification of your sentence: &quot;I solved the problem of shutting the relay of by using the magnetic <br>contracts connection to cut the power (12v) when the time is on.&quot;<br>What exactly are you cutting the power off from??<br>Also, I am not really sure what it is that is not switching off? is it your relay or the TRIAC?<br>The 547 btw is a transistor and not a triac.<br>Could you perhaps send me a drawing of yr circuit?<br>If you are using a relay, you may as well use that to switch yr load</p>
<p>Hi,</p><p>Yes 547 is a transistor, actually I am a hobbyist. Trying to make home automation. </p><p>I use a timer and a magnetic contact to drive overhead water pump. I made the connections such a way that when I apply power through a push button switch to timer, timer starts the magnetic contact which starts the pump and also provides power to timer. When the time is up timer shuts the magnetic contact, the pump and timer both stops.</p><p>I used this circuit to activate the connection of push button switch. As mobile ringer signal is low used the transistor. But the triac keeps supplying current even after input signal is stopped. </p><p>As I had ideal connections in the magnetic contact which is connected when the contact is off, I used that connection to supply power(12v) to circuit. So as soon as the timer starts, the magnetic contact is activated and power to the circuit is cut off. When the time is up the power to the circuit get restored.</p><p>I think I did it manually, but I plan to use a flip flop circuit in future. Give me some tips on that but now I need to know why the triac keeps the connection on. Thanks for reading.</p><p>Mashiur</p>
<p>Mashiur<br>I admire your energy and drive, but i get the impression your circuit is needlessly complicated. Why not just use 1 transistor and one relay to switch your contact, no need for the Triac circuit</p>
<p>Hi </p><p>It had a lot of fun doing this. Got a PCB printed and have the ability to control 7 switches using this. I have added a xbee module to make it wireless.</p><p>Cheers!!!</p><p>Rituparna</p>
<p>Hello Rituparna,</p><p>Congratulations for your work. I'm in a similar project and I have faced some problems. I sent you a message about this project. If you can help me, thank you very much!</p>
<p>what have u sent the msg on? i don't have anything in my inbox...rituparna89@gmail</p>
<p>looks great. Thanks for posting it. Always good do see what people do with ibbles. Impressibe PCB :-)</p>
<p>Nice Work. Looks awesome.</p><p>Regards,</p><p>Abhishek.</p>
<p>Hi all,</p><p>I have using MOC3043 and BT136-600 (without using snubber circuit due to system will automatically triggered). When the circuit is connected to the fan or digital clock, it works fine. I can control it on or off without any problem. However, when i connect the circuit with CFL, light is flashing. How to solve the problem? </p><p>My circuit is follow MOC3043 datasheet Figure 13. Hot-Line Switching Application Circuit ( http://www.fairchildsemi.com/ds/MO/MOC3043M.pdf) </p>
<p>XenonHK<br>You are touching on a frequently asked question. The fact is that just a regular CFL isn't really suitable to be dimmed by a traditional TRIAC dimmer as it is not merely a resistive load, but a piece of electronic equipment. An incandescant lamp and a CFL are as comparable as a bread toaster and a TV set: both use electricity and that's about it.<br>There are specific dimmers for CFL lamps and dimmable CFL lamps: They usually function by feeding a variable voltage (1-10V) to the CFL controller.<br>That means that if you have such a lamp, you could make an analog out circuit coming from your arduino, that you feed to the dimmable CFL lamp.<br><br>This may help you a bit: </p><p><a href="https://www.google.nl/search?client=ubuntu&channel=fs&q=cfl+dimming&ie=utf-8&oe=utf-8&gfe_rd=cr&ei=MfOKU5O7JYKc-waluoDQDg." rel="nofollow">https://www.google.nl/search?client=ubuntu&amp;channel...</a></p><p>Also this article describes exactly what you are experiencing: </p><p>http://www.nxp.com/documents/application_note/AN10803.pdf</p>
<p>Hi diy_bloke,</p><p>Thanks a lot for your quick reply and your information. I will study it. I would like to ask one quick question on my circuit. Can the my circuit able to handling CFL on/off control, without flickering (no dimming function is needed)? Thanks a lot</p><p>Best regards</p><p>Xenon</p>
<p>Thanks for all your help guys.</p><p>I completed the required circuit and it works great. I tested it with a pedestal fan for 4-5 hours and no heating and things like that.</p><p>I switched to BTA16 - due to its high dv/dt values I was able to remove the issue created due to the transients on the power lines.</p><p>Also I discovered that snubber circuit tend to leak a very minimal amount of current which will not turn the load on but could give a nasty shock. But still its OK and sort of necessary to use them in inductive circuits, along with Safety Fuse and safety warning mentioned appropriately.</p>
<p>good to hear that. Thanks for the feedback. I always appreciate hearing if people got their problems solved :-)<br>The TIC206 is kinda my TRIAC of preference and I haven't had any problems with it.<br>I guess you found out about the charge in the snubber circuit the hard way? :-)<br>We have all been there, but it underlines again the care one should take working with high voltages. One would not really expect to have a capacitor charge on AC :-) . Probably has something to do with phase shifting or whatever, I am no AC crack</p>
<p>Thank you for this nice tutorial. I used BTA16-600C and it worked but for a few minutes. I tried putting heat sink but problem return after few minutes. Do you get same problem ? Do you have some tips for me ? Please :)</p>
<p>Usually problems like this are a faulty soldering connection, a faulty optocoupler or a faulty triac.<br>Are you using it with a microcontroller?<br>Please do the following:<br>Unplug everything<br>check yr connections<br>Dont use yr microcontroller but put a 5 Volt tension on the entrance and connect to the mains again.<br>Let me know what happens</p>
<p>Thanks for this easy to implement tutorial. I have implemented the same stuff using MOC3041 and BT136 TRIAC. I am using 470 and 330 ohms resistance and the things work pretty well.</p><p>However I am facing a strange issue with the snubber circuit, which I had incorporated to get rid of the transients in the line. The transients auto-triggers my TRIAC for a moment which I want to remove. Removing the snubber makes my circuit work well. With the snubber my switch is always ON.</p><p>I removed the MOC3041 from the circuit and no input signals as well but still it is ON always when snubber is present in parallel to TRIAC. Seems like it provides a parallel path to the external load turning it ON.</p><p>Any help would be highly appreciated.</p><p>Thanks,</p><p>Abhishek.</p>
<p>Abishek, thanks for yr kind words. It is indeed odd, but what I do expect is that the 100nF might be a bit too big for yr setting and the BT136 may see it as a capacitive load (though it isnt strictly a load). As a result the current and the voltage might be a bit out of sync, so that at zero crossing there is still a voltage (from the 100nf) that keeps the TRIAC open.<br>There are a couple of solutions to tru: some people use a distinctly different valueset for their snubber: say 33 Ohm and 10nF and you cold try that.<br>100 ohm (even 120 ohm) and 100nF are however tried and tested.<br>The dV/dt is probably too slow for yr BT136.<br>What I suggest is that you try the 33Ohm/10nF combo and see if that solves your problem.<br>You say you need the snubber network to get rid of transients that trigger your TRIAC.<br>Is it the Triac that gets auto triggered, or might it be your moc that is triggering because of the transients?<br>What load are you switching? is it an inductive load?<br>Although I never had problems, the datasheet of the MOC30xx suggest a somewhat more complicated snubber to get rid of transients in an inductive load: </p><p><a href="http://images.elektroda.net/0_1257514629.jpg" rel="nofollow">http://images.elektroda.net/0_1257514629.jpg</a></p><p>The BT136 is a 'sensitive' Triac.<br>I would suggest though that you first try the 33 ohm (or 39 ohm) and 10nF</p>
<p>let me just add that snubber circuits are largely empirical and depend largely on the load you are switching. Sure, there is sort of a general range of what seems to work, but the fact that some people swear by 33/10 and others by 100/100 or 120/100 already show there isn't a one right solution</p>
<p><strong>Issue 1: Snubber Leakage</strong></p><p><strong>Exp:</strong> My snubber circuit is leaking voltage/current and keeping my </p><p>devices turned ON with very less intensity. </p><p>To avoid any possiblity of leakage via 3041 (opto-coupler) I had </p><p>removed it from my circuit entirely. No more IC is present.</p><p>Even now I can see that leakage happening. Initially this leakage </p><p>was high and as per your suggestion reducing the capacitor value </p><p>helped and now its pretty low but is still there.</p><p><strong>Issue 2: Changing resistance shows no further impact on the </strong></p><p>behaviour.</p><p><strong>Exp:</strong>I tried 10 nF capacitor with 39 / 68 / 100 /180 ohm but it </p><p>still glows slightly.</p><p><strong>Issue 3: False Trigering </strong></p><p><strong>Exp:</strong> My circuit activates for a fraction of a second when I turn on </p><p>another heavy load on the same line like an AC cieling fan.</p><p><strong>My Background:</strong></p><p>I am working as a Mobile Software Engineer (Android etc.) for last 9 years. Do not have in-depth knowledge of electronics. But can corelate things based on basic idea, R&amp;D and certainly a bit of common sense. Need to get into more tech depth soon but may be not right away.</p><p><strong>What am I trying to achieve:</strong></p><p>I am trying to make such digitally controlled switches and my range of appliances that should work includes household components like CFL, TubeLights, Cieling and Pedestal Fans, TV etc. </p><p>I do not have to control some really heavy gadgets. I feel that to increase the circuit endurance I might have to end up making different model of switches which I will do later. For now only CFL, Mobile Charger, Cieling Fans and TV control switches should suffice.</p><p>Thanks for all your inputs and your valuable time.</p>
<p>Thanks for your expos&eacute;. You have not chosen the easiest gadgets to switch as a mobile charger and a ceiling fan are inductive loads and a TV is most likely an inductive load. CFL's also carry their own problems and they may have a high starting current.<br>For one thing, I wonder, have you experienced these problems too if you were switching a say 60-100 watt incandescent lightbulb?<br>Secondly, I wonder if yr purpose wouldnt be better served with a relay.<br>Thirdly, as long as you are switching low currents (like a fan or a charger) you could consider a cheap SSR (I published a circuit of that one too).<br><br>But as it is your problem might be related to the MOC3041/BT136 combination.<br>Try the following:<br>1- remove the 330 Ohm resistor and increase the 470 to 560 or 1k and see what that does</p><p>2- if that doesnt do it, build the snubber like you see here: </p><p>http://images.elektroda.net/0_1257514629.jpg</p>
<p>Thanks once again for your prompt reply.</p><p>I think you are correct but since I am working on a Touch Screen Based home automation system I really cannot limit to 1-2 equipments and hence my list unfortunately contains all of those inductive elements :-(.</p><p>To answer you, I DO NOT get any false trigger with fluorescent tube light or a simple light bulb operation. It occurs only when I switch a ceiling fan and that too I turn it ON/OFF deliberately several times, just to test.</p><p>Secondly, I cannot survive with mechanical relays as I cannot keep them turned ON for long time which would be the scenario if someone turns On and electrical equipment. It will reduce the life time of the coil.</p><p>I can switch to SSR but tI have read that they tend to fail in Closed State which is not so safe.</p><p>The other snubber circuit is switching the neutral and not the load. Will try this if I fail to make the one I am currently trying.</p><p>Also I do want to know the exact reason for this so that it does not become a blocker for me and can move to the next level of learning.</p><p>I am gonna try with even smaller capacitor and see if that helps. </p><p>Will post the results in a while. Also one more thought that other folks are also using the same datasheet circuit with no issues, why is it happening with me then :-(.</p><p>Anyways thanks for your time buddy. Let me know if you come up with some other thought. :-)</p>
<p>The fact that the other snubber circuit is switching the neitral and not the laod doesnt really seem that relevant I think. Should give it a try.<br>What also sometimes helps I have been told is to swith M1 and M2.<br>As I understand the MOC series can als sometimes give false triggering and that 'other' circuit should prevent that.<br>The cause of yr problems where others are succesful could very well be product variation. Also, if you happen to have a Tic206 laying around, give that one a try</p>
<p>The market is pretty far from here so will try to get TIC206 in a day or two. Also there is no MOC present at all even then the same behavior. It means it has nothing to do with the MOC.</p><p>Next when no MOC is present there is no connection of the gate terminal to anything so no possibility of false gate trigerring.</p><p>Also smaller cap makes a difference.</p><p>One more thing I want to know is that I am testing using a 3 pin socket or extension.</p><p>In the 3 pin female socket I am plugging in a very small night light indicator and that flickers and glows lightly. Do I have to test using some heavier load or something ?</p><p>Well for now I am clueless and totally lost. Will try it from scratch and will try the TIC206 option as well. Thanks for all your help.</p>
<p>you'd better test with a decent load like a 60 w incandescent bulb</p>
<p>Thanks for the suggestion. I am at work. Will go home and try with a 100 W bulb. I found another guy facing similar issue. Find below the link to his question:</p><p><a href="http://electronics.stackexchange.com/questions/87685/will-snubber-pass-voltage-thourgh-it" rel="nofollow">http://electronics.stackexchange.com/questions/876...</a></p><p>Looking at this I am at least convinced that my circuit is almost correct and there exists no universal snubber. I also got a direction that if I end up making a home-automation project, I am going to create different switches for different types and capacities of loads. I think that will fit my business use-case.</p><p>Thanks for all your help and input. If you have time please have a look at it and let me know how can I decide for different kinds of loads.</p><p>Regards,</p><p>Abhishek</p>
<p>Hi,</p><p>I am able to make it work with BTA16-600B. I could not get the snubber less version so I might end up adding extra snubber for inductive loads. But for smaller resistive loads I am good to go. No more false trigerring. Thanks to higher dv/dt values of the IC.</p><p>I tested my circuit for 4-5 continuously with a pedestal fan and it worked without any issues like heating and all.. For now .. things are fine ..</p><p>Thanks.</p>
<p>Thanks for your inputs buddy and it actually made a difference. I tried with 10nF cap with various resistances. It solved my problem by 80%. It solved the issue of false trigerring to an extent. It still happens but frequency is much less now. But still there is a strange behavior. My circuit leaks some voltage via the snubber and my bulb glows with the minimum possible intensity. I tried connecting a wire-extender. The red indicator Led in that glows with very low intensity. However, when I switch it ON via MOC3041 things work well.</p><p>Ok now I am gonna break my issues into more comments to make you understand it better.</p>
<p>Thanks for the post. So I have implemented a similar circuit with 470ohm resistor and BT136 triad The resistors that i have used are of 1 watt. Correct me if I am wrong but, the wattage of the resistor does not matter where the 470 ohm resistor is placed! and how much current can this circuit handle as in ...can I use this circuit to control may be an AC or a refrigerator?</p>
<p>Hi,</p><p>I am seriously in need of some help. I have made the same circuit with BT136 and i am facing the problem of false trigering. Did you faced something similar ? I am using 470 ohms and 330 ohms resistors as suggested in the post.</p><p>Any help would be highly appreciated.</p><p>Regards,</p><p>Abhishek.</p>
<p>Hi Abhishek,</p><p>I would suggest changing the BT136 to a snubber-less BT like BTA16. I did not face any issues worked fine. How are u firing the triac. just double check the output pins. I am not from a electrical background so cant help you much.</p><p>Thanks</p><p>Rituparna</p>

About This Instructable




Bio: I am a physician by trade. After a career in the pharmeceutical world I decided to take it a bit slower and do things I ... More »
More by diy_bloke:Connect to Carriot with ESP8266 BruteForce codefinding for Infrared RGB LEDstrip Using the 4 pins of the ESP8266-01 
Add instructable to: