Triac instead of a relay - Page 1
Forum section: electronics / beginners

author: oliv3r
author_rank: Frequent Contributor
timestamp: May 28, 2025, 09:45:35 am
content: Hello all,I want to build a 'doorbell controller' likehttps://frenck.dev/diy-smart-doorbell-for-just-2-dollar/however I don't want to use a relay (they are big and clunky). Given that doorbell transformers are in the 6 - 24 VAC range, we do not have a safety issue. (Note, that I also want to power the ESP from the same transformer, using a full-bridge rectifier and a capacitor, which is working fine).So very naivily (and pretty dumb) I took a regular triac (bt134w) and "just connected it' (see attachment). Obviously this isn't workingas I didn't even think about the fact 'and where is the gate referenced against'.So then I got stuck a bit, because almost everybody always talks about using a triac for mains voltage switching. Looking a bit into existing schematics, I see a lot of schematics with an opto-isolated triac (MOC3041) but then they use a nother triac to switch (because of mains).The doorbell itself is a low-power load, the transformer is only rated at 9VAC and 1Amp, so switching current is not a problem. But then i still don't know how to hook things together ... or is it really as trivial as to just connect the 9VAC to A1, and use two resistors between neutral and AC on T1/T2? like here?

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 28, 2025, 11:26:52 am
content: The gate has two diodes to A1, and you either have to push current into it, or pull current out of it to trigger the triac. And as a diode, it needs current limiting. Normally the control electronics is also tied to the A1 terminal (preferable the 3V3 or 5V rail, because most triacs are much less sensitive in one of their four quadrants).This conflicts with a full bridge rectifier, but often a simple half bridge can be used. the current for the control circuitry is usually quite low.

author: oliv3r
author_rank: Frequent Contributor
timestamp: May 28, 2025, 06:57:10 pm
content: I guess that's where I messed upSo anyhow, I wonder if I should not just use a MOC3021 and ignore the 'should not be used to drive loads' comment, as they are probably referring to 'big loads on 220V'. I'm driving a doorbell, worst case, a 9VAC solenoid that'll be engaged for 5 seconds (by someone keeping the button pushed for too long, per 6 hours. So it'd be in the off state for most of its life.I'll also look for a simple SSR, which in the end, is exactly what I want anyway, just thought that a triac would be 'cleaner'.Edit: So having found these two parts (solid state relays 'triac output')https://jlcpcb.com/partdetail/OmronElectronics-G3VM_201G1_TR/C6048389andhttps://jlcpcb.com/partdetail/Bc-BC2213A/C596512they look to me identical to the MOC3021, with just different pinouts and specs.What I also found interesting in the BC2213A datasheet, is what I think you tried to explain. IN that they put a 'load' resistor on T1 (or T2), to pull current through, which I think is what you tried to say.But I have no idea how that would make things 'better' (or simply work) as All current goes through my part. Though I did not actually hook it up that way yetI dumbly measurement with a resistance meter to see if it would 'conduct' anything.So 'safety' concerns aside (e.g. a bare triac that's not isolated, I know I could fry my ESP) would the supplied partial schematic actually work? If I connect my AC source, would I see the Triac conducting if the gate is high?

author: floobydust
author_rank: Super Contributor
timestamp: May 28, 2025, 07:08:20 pm
content: The optotriac alone can't take the high (inrush) current of a doorbell solenoid. I'd use a small triac and MOC3021.Zero-cross switching optocouplers MOC303x, 304x have a huge dead zone around zero-cross "inhibit voltage" can be 20V. Not so great for a 24V system, these are for mains applications.

author: oliv3r
author_rank: Frequent Contributor
timestamp: May 28, 2025, 07:19:38 pm
content: Quote from: floobydust on May 28, 2025, 07:08:20 pmIn my case, I've even dealing with 9VAC specifically, so it wouldn't even work. So then either of those SSR's that are listed as 'mechanical relay replacement'. I do see some are triac based, and some are double-mosfet based (push-pull?).Would they both work with 9VAC? I know the triac's have a drop of the diodes, but not sure if a double-mosfet solution would work with VAC, a 'mechanical relay' certainly wouldn't care (apart from the ratings).

author: floobydust
author_rank: Super Contributor
timestamp: May 28, 2025, 08:34:36 pm
content: It can work at 9VAC using random phase opto.A small (sensitive gate) triac and non-zero cross opto is what would use. The BT134W + MOC3021 looks good.But not with the mains resistor values given in the datasheet and common circuits, 360-470R etc. but much less, 47-100R I think for the triac to have sufficient gate drive at a few volts.You can use dual mosfets in an AC SSR config, as Nest thermostat does for their 24VAC HVAC outputs.There are specialty AC photomos optos as well Panasonic [https://industry.panasonic.com/ac/cdn/e/control/catalog/semi_eng_selection.pdf]PhotoMOS but these are generally expensive and a bit harder to get.

author: Zero999
author_rank: Super Contributor
timestamp: May 29, 2025, 08:33:29 am
content: A zero crossing opto-coupler will work the same as a random firing opto-coupler.For an inductive load, you don't want zero-crossing, because it results in a high current surge. Ideally you want to turn on as near to the peak voltage as possible. In reality, just use a random firing opto-coupler.

author: floobydust
author_rank: Super Contributor
timestamp: May 29, 2025, 07:28:32 pm
content: Quote from: Zero999 on May 29, 2025, 08:33:29 amThe opto-coupler (zero-cross) inhibit voltage can be large, datasheets give 20V or more as a maximum VIHI find they don't always work with low voltages (not mains), they'll turn on way late in the sinewave, waveform way distorted with quite the buzz from coils.MOC3043 On-Semiand Fairchild as well give VIH=20V max.VishayVO3062VINH12V typ. 22V max.So I would not use them for low voltage i.e. 9 or 24VAC systems.

author: Zero999
author_rank: Super Contributor
timestamp: May 30, 2025, 01:48:06 pm
content: Quote from: floobydust on May 29, 2025, 07:28:32 pmIt should work, the same as random fire, because the voltage will always be below the inhibit voltage. For example, for 9VAC, the peak voltage is 12.7V, so a zero-crossing opto-coupler will never exceed the inhibit voltage of 20V.I wouldn't recommend TRIAC for such low voltages anyway. The conduction voltage drop of just over 1V becomes significant. Back-to-back MOSFETs are far superior for switching low voltages.TOSHIBA make some nice TRIAC output opto-couplers which will drive the doorbell without any components, other than perhaps a snubber.TLP3640Ahttps://www.farnell.com/datasheets/4437340.pdfTLP3553Ahttps://www.mouser.co.uk/datasheet/2/408/TLP3553A_datasheet_en_20230529-1375035.pdfHow about an AC coupled solid state relay? The square wave is 5V 50kHz, generated by your MCU. If this is inconvenient, then you can add a 74HC00 astable, to generate it. The C2 and C3 AC couple it to a voltage doubler to generate 5V DC between the gate and source of the back-to-back MOSFETs. The capacitors are so small, the coupling due to the mains frequency isn't enough to turn the MOSFETs on. The in-built gate capacitance is enough smooth the 50kHz square wave signal. R1 discharges the gates, when the square wave is switched off.

author: Terry Bites
author_rank: Super Contributor
timestamp: May 30, 2025, 03:22:23 pm
content: expect to lose 1-2V across the triac in its on state.

author: Zero999
author_rank: Super Contributor
timestamp: May 30, 2025, 04:55:05 pm
content: Quote from: Terry Bites on May 30, 2025, 03:22:23 pmThat's why I recommend using MOSFETs, at low voltages. TRIACs are only optimal for above 100V or so.

author: floobydust
author_rank: Super Contributor
timestamp: May 30, 2025, 07:02:29 pm
content: Triacs are cheap and tough. Their high blocking voltage with inductive loads makes life easy. No worry about avalanching a mosfet and killing it.But a triac's ~1.2V drop can be more heat (than a good mosfet), dissipate around 1W/amp which is not ideal.I guess it depends on technical excellence verses cost and component count.The usual low cost way for MCU and triac config is the MCU (GND) as a say -5V rail (1/2 wave rectified) from one leg of AC then a GPIO can direct drive a triac gate.But OP is using ESP8266 which needs high WiFi TX current and likely powered by 5VDC wall wart, which gives a CM voltage due to the Y-cap. It's a bit messy.I had reversed engineered a Nest thermostat and have to see if I have their discrete mosfet AC SSR plus system power figured out.It's really ideal - single AC in and switched AC out, with MCU power as well from the 24VAC.

author: oliv3r
author_rank: Frequent Contributor
timestamp: July 10, 2025, 11:40:40 am
content: So I was looking into parts etc and decided to use a signalling relay anyway. They are quite small and might as well use it anyhow.Here's my current schematic (needs some cleaning up) for reference.Feel free to comment ;p but this should do the trick of ringing my doorbell

author: Doctorandus_P
author_rank: Super Contributor
timestamp: July 10, 2025, 12:46:26 pm
content: You've got a problem with your switch. It's good to add a series resistor, both as EMI supression for things that go off board with long wires and to prevent high discharge current from the capacitor (which can damage the switch). However, in the current configuration it's a voltage divider and it's output only goes to half the supply voltage.

author: Zero999
author_rank: Super Contributor
timestamp: July 10, 2025, 12:53:12 pm
content: Yes, perhaps reduce R2 to 100R, which should provide some protection against EMI and still keep the voltage low enough to trigger the MCU input.If one of the contacts is spare and you have no intentiion of using it for anything else, then it's a good idea to connect it in series with the other contact. Two contacts wired in series will break the arc more effectively, have a longer life and be much less likely to weld shut, compared to one.

author: oliv3r
author_rank: Frequent Contributor
timestamp: July 10, 2025, 01:00:02 pm
content: Quote from: Doctorandus_P on July 10, 2025, 12:46:26 pmThanks, Stupid copy/paste mistake, though I've not decided on the exact values of parts yet ... (I'm lazy)Quote from: Zero999 on July 10, 2025, 12:53:12 pmI like that idea, just use the relay as a parallel relay to 'share' the burden. Gotta check if layout-wise this will work nicely though ... (It did :p) Thanks!

author: Zero999
author_rank: Super Contributor
timestamp: July 10, 2025, 01:09:38 pm
content: Quote from: oliv3r on July 10, 2025, 01:00:02 pmParallel is better for higher current and lower voltage drop, but you might be better with series, because the bell produces a high voltage spike, when turned off.Check the current draw of the bell. If it's much less than the rating of the relay contacts, then definitely go for series connection.

author: 5U4GB
author_rank: Super Contributor
timestamp: July 10, 2025, 01:35:45 pm
content: Quote from: oliv3r on May 28, 2025, 07:19:38 pmIf you use an SSR / SSR module, be careful where you buy them from, the ones all over Aliexpress mostly usefake Omron SSRsand you often have no idea what you're really getting because the specs are just text cut&pasted from who knows where, e.g. a claimed DC-capable SSR with zero-crossing switching. OTOH of you buy legit stuff from a reputable supplier it won't be cheap. Relays are much less sexy than anything solid-state but they're also pretty straightforward, just on or off without lots of special-case considerations. If you want someone else to do the work, you can get optoisolated relay modules off Ali that you can drive directly from the 3.3V of the D1 for a dollar or so.(OK, the on/off is a generalisation, you can get finicky with what type of load you're switching and what sort of metal do you need the contacts to be made of and so on, but for this low-power low-voltage load it's just an on/off switch).

author: oliv3r
author_rank: Frequent Contributor
timestamp: July 10, 2025, 01:44:14 pm
content: Quote from: Zero999 on July 10, 2025, 01:09:38 pmThat's interesting that I hadn't thought of yet. I can imagine that with parallel connection, we'd only get half the load on the relay contacts, increasing the lifetime. I don't see however how we can benefit from a serial connection on the relay however? The high voltage spike will have to go through both connections will it not? And since they won't close at exactly the same time (I assume), the one closing second will get the full load of everything? Can you explain this benefit more? To me it feels like the worst of both, except that will will add additional welding protection, because if one relay is welded, the other one still switches ... but that would result in a doorbell continuously ringing, while annoying, not horrible

author: Zero999
author_rank: Super Contributor
timestamp: July 10, 2025, 05:40:34 pm
content: Quote from: oliv3r on July 10, 2025, 01:44:14 pmFrom Google AIConnecting relay contacts in series can increase voltage and breaking capacity, but it doesn't necessarily improve current switching capabilities. Series connections are used to divide the voltage across multiple contacts, which can prevent arcing and contact erosion, particularly with high-voltage or inductive loads. However, there are limitations, as contacts may not open or close simultaneously, and excessive heat can build up during switching if not properly managed.This is only partly true. It can increase current capacity, in the case of DC, when it's not uncommon for a relay to have a lower current rating at a high DC voltage and series connection can actually increase the current rating. Smaller relays also tend to benefit more because they contacts will tend to open more at the same time, compared to larger relays.Google AI isn't so keen on parallel connectionConnecting relay contacts in parallel can increase the current capacity but introduces potential issues. While it can double the current capacity, it's generally not recommended due to the risk of one relay failing and potentially damaging the other, or causing arcing and welding of contacts.I suppose with two contact sinseriesparallel, it increases the chance of a contact welding. It will reduce the losses and increase the current capacity though.Take from the above what you want.

author: floobydust
author_rank: Super Contributor
timestamp: July 11, 2025, 03:40:09 am
content: I had an engineering boss metallurgical engineer and he gave me shit for paralleling any contacts (relay, or switch).In parallel, contact sets are never mechanically identical - so one always makes first, another breaks first and lifetime/current-interrupting are not increased.

author: oliv3r
author_rank: Frequent Contributor
timestamp: July 11, 2025, 08:20:32 am
content: Cool that there's no clear consensusThe argument that they never close or open at exactly the same time is something I can certainly agree with. Even contact debouncing would be 'different' and out of sync. However, that could also be considered an advantage. Energy flow will be more stable more quickly.The serial variant I still don't get. The only advantage I can see is higher assurance it will close/open. E.g. if one relay is welded, the other still disconnects. So assurance is higher.But we're talking 9VAC with 1 AMP max (due to the power supply being rated at 1 AMP. The relay is rated at 125 VAC, 30VDC (1500 V impluses), though 1A is the max switching current, and 2A is the max carry current. OTH, it's a doorbell, and if it fails in 3 months I'll source a better relayI could also limit the current of the transformer/solenoid/bell to ensure it stays within specs.I do wonder what the current spikes would be when opening/closing the relay...