You need to Create a Project and stay online at least 60min in Editor for posting a Topic.
Please verify my AC driver circuit using OPTO & TRIAC
839 17
aledrus 1 year ago
Hi As I've introduced myself in the previous post, I am quite new at this. I have some experience with using relays to drive an AC load, but here I want to not use 5V or 12V altogether. So I recently discovered that I could use an optotriac + triac combo to drive a load like a relay. I need someone who has more experience to teach me if I've done something wrong here and if so, what did I miss? GPIO signal is a 0/3.3V signal. This is to drive an inductive/resistive load. (I built this circuit using a breadboard without the AC connected. With a multimeter on the AC pads, I measured infinite ohms when GPIO is low and about 12 MOhms when GPIO is high. I am expecting 0 ohms when GPIO is high, like a relay would - but as I understand the triac resistance depends on the current going through. Anyway, I am not confident with this circuit because of this) Thank you in advance! ![AC load driver with triac](//image.easyeda.com/pullimage/4xjPAvqBa1hGNLHWhhZ6rTsKsUlpH83CbRyMH3DD.png)
andyfierman 9 months ago
Please  re-read my earlier posts and study the examples, datasheets, apps notes, wikipedia page and the simulations that I referred you to before proceeding any further with this project. You are working with lethal voltages but you clearly do not properly understand the operation of the devices and therefore the circuit and that is a very dangerous place to be.
andyfierman 9 months ago
No. The resistor should be replaced by an open not a short circuit! Did you not study the schematic examples in the datasheet and apps notes that I  referred you to?
aledrus 9 months ago
@andyfierman Oh I see, thanks for your reply. I actually removed a resistor there based on your earlier comment to the original post above: > Your circuit is correct except that as I said: "The resistor from A1 to Gate of the triac appears to be unnecessary." > That is your 470R resistor, RA2. I am currently a bit confused, but I will put it back and see how it goes. Thanks!
andyfierman 9 months ago
Stuff blows up because you have shorted the triac gate to the bottom end of the triac and so connected mains directly across OPTO1 in series with AC_RA1 and whatever your load is. See where my mouse pointer is in the image below: ![image.png](//image.easyeda.com/pullimage/Jvw6yyXhyB9U5pi51zknwg6x2s7k3LdEa5f9lCqz.png)
aledrus 9 months ago
I don't know if this matters, but the little light on the power supply (image below) blinks when I try to supply RA2 (base of the NPN BJT) a 3.3V from the power supply. The 3.3V supplies both RA1 and RA2. It's fine when RA2 is disconnected. I think it means there is a short/fault/overcurrent in the system but all it supposedly does is supply an LED in the MOC, so I can't understand why. ![image](https://photos.app.goo.gl/MuyKQYiddVvhqvaV6) [https://photos.app.goo.gl/MuyKQYiddVvhqvaV6](https://photos.app.goo.gl/MuyKQYiddVvhqvaV6)
aledrus 9 months ago
I don't know if this matters, but the little light on the power supply (image below) blinks when I try to supply RA2 (base of the NPN BJT) a 3.3V from the power supply. The 3.3V supplies both RA1 and RA2. It's fine when RA2 is disconnected. I think it means there is a short/fault/overcurrent in the system but all it supposedly does is supply an LED in the MOC, so I can't understand why. ![image](https://photos.app.goo.gl/E4JseokCcSsAKtP27) [https://photos\.google\.com/photo/AF1QipMILSDoPCgkhX\_Fuu9OwX9kbuBL0swgYgJ\_t72e](https://photos.google.com/photo/AF1QipMILSDoPCgkhX_Fuu9OwX9kbuBL0swgYgJ_t72e)
aledrus 9 months ago
@andyfierman Hi Andy! Thanks for your reply. I really thought I've replied to you but I think I must have postponed it until I managed to test it. I realise it's been months but real life got in the way. I've just built the circuit on a board, the schematic is as attached. ![eda.png](//image.easyeda.com/pullimage/KX8DxdCnNQNmWHKMV1pzlJzNURSxEMU65ES1ro7B.png) I took your advice and tried to design it for a working IF of 15 mA. I used R = (3.3V-1.5V) / 0.015A = 120 ohm for between VCC and Pin 1 of the MOC. I also forgot to add the 1mA from the base, but taking the Figure 2 LED Forward Voltage vs Forward Current at 16 mA should be about 1.4V voltage drop I figured the 1mA from the base is negligible (I hope that's right) The DC side (left) works to ground pin 2 of the MOC3023. Without load on the pad (AC1), the voltage switched from 0V to 230V as expected. When I put a load on the pad AC1 (I tried to supply an old 250W computer PSU), the 390R AC_RA1 blew up. I think it has something to do with it being an ordinary resistor rather than a higher wattage one. But in the datasheet (Figure 12 of [MOC3023M - 6-Pin DIP Random-Phase Triac Driver Output Optocoupler (250/400 V Peak) (onsemi.com)](https://www.onsemi.com/pdf/datasheet/moc3023m-d.pdf)) it does not specify what wattage of the resistors should be used. Do I need a special resistor? I thought it would be the TRIAC BTA08 that would be doing the AC switching rather than the MOC3023 itself (which I assume switches the TRIAC), so not much current would need to pass through AC_RA1 to cause it to blow. I am learning a bit more but I have just realised that I still don't know what's my problem.
andyfierman 1 year ago
@aledrus, "A few items, I don't currently have a 30Vac supply so I won't be able test that." Triacs are bidirectional (and almost symmetrical) so you only need a DC supply. :)
andyfierman 1 year ago
aledrus 1 year ago
andyfierman 1 year ago
@aledrus, Note (2) in the MOC30xx datasheet states: "All devices are guaranteed to trigger at an IF value less than or equal to max IFT. Therefore, recommended operating IF lies between max IFT (30 mA for MOC3020M, 15 mA for MOC3010M and MOC3021M, 10 mA for MOC3011M and MOC3022M, 5 mA for MOC3012M and MOC3023M) and absolute maximum IF (60 mA)." Therefore you should design for an IF of something like (15mA+60mA)/2 = 37.5mA, say between 35mA and 40mA. Looking at **Figure 2. LED Forward Voltage vs. Forward Current** in the datasheet, if you: 1. connect QA emitter directly to ground; 2. increase DC_RA1 to (3.3V-0.6V)/1mA = 2.4k;  3. reduce the 3.3k resistor to (3.3V-1.5V)/36mA = 48 Ohms, so choose 47 Ohms then that will drive almost exactly 35mA through the LED in the MOC3021, requiring a current from GPIO into the base of QA of about 1mA. However this is a very power hungry solution requiring 3.3V*(1mA+35mA) = 118.8mW just to turn the triac on. This also means that there will be a step change in 3.3V supply current of 36mA every time the triac is turned on or off. This will require additional 3.3V rail decoupling of between 10uF to 100uF, placed across the top end of the 47 Ohm resistor to ground at the emitter of QA. Although this may not be a problem if the 3.3V supply is well regulated, the design is also poor from the point of view of regulation of IF. With a series resistor of 47 Ohms any change in the 3.3V supply voltage will produce a large swing in the LED current. You could design for a working IF of say 23mA (series resistance of about 75 Ohm) but probably not much lower since the LED forward drop will increase at lower temperatures and so may limit the lower end IF achievable. You would be better to use the MOC3023 with its max IF of 5mA and design for a working IF of say 15mA. For the components around the mains side of the MOC302x  please refer to Figure 12. Typical Application Circuit in the datasheet for recommendations. Note that the 0.05uF cap could be reduced to 0.047uF. The load of course can be placed in either the "HOT" or "GROUND" side which in your case correspond to Live and Neutral. * Your project is private so only you can see it. * You have prefixes for two resistors RA2 and RB1. It is not clear which resistor in your screenshot that these prefixes and values refer to. * The resistor from A1 to Gate of the triac appears to be unnecessary. Please check Fig 14 in: [https://www.st.com/resource/en/application_note/dm00096037-how-to-select-the-triac-acs-or-acst-that-fits-your-application-stmicroelectronics.pdf](https://www.st.com/resource/en/application_note/dm00096037-how-to-select-the-triac-acs-or-acst-that-fits-your-application-stmicroelectronics.pdf)<br> <br> and the other documentation in: [https://www.st.com/content/st_com/en/products/thyristors-scr-and-ac-switches/triacs/standard-and-snubberless-triacs/bta08.html#documentation](https://www.st.com/content/st_com/en/products/thyristors-scr-and-ac-switches/triacs/standard-and-snubberless-triacs/bta08.html#documentation)<br> <br>
eichenlaubl 1 year ago
@eichenlaubl I took a look at the data sheet and realized neither your original drive circuit or my simplified version is adequate as they provide less than 1ma current and more than 10 ma is required. If you let me know what you are providing GPIUO with I will design in driver for you.
eichenlaubl 1 year ago
@aledrus I am not familiar with the triac but can offer some advice on your drive circuit. I believe it will function as designed. However it is more complex than necessary. You can discard Ra1 Ra2 and Qa. Connect GPIO to pin 2 of the opto isolator. This will reverse the on/off states from your original design. To keep the on/off states the same, connect the 3.3K from pin 2 to ground and connect GPIO to pin 1. <br> <br> <br> <br> <br> <br>
andyfierman 1 year ago
Why not try connecting a bench supply set to say 30V with a 1A current limit across the AC terminals in either polarities and see if you can short out the PSU by turning your triac on and off?
andyfierman 1 year ago
Please check the device datasheet and apps notes: [https://www.onsemi.com/pdf/datasheet/moc3023m-d.pdf](https://www.onsemi.com/pdf/datasheet/moc3023m-d.pdf)<br> <br> [https://www.onsemi.com/pub/collateral/an-3003.pdf](https://www.onsemi.com/pub/collateral/an-3003.pdf)<br> <br> The MOC3021 is specified for 240V mains so you can ignore Fig 7.