I'm trying to modify the following circuit to switch a mains load using a sparkfun esp8266 thing:

original circuit

Credit: https://hristoborisov.com/index.php/projects/switcher-a-wifi-open-source-power-switch/

I've modified it like this (I know the symbol inside the optoisolator is wrong - sorry about that. The hi-link is a solid state mains to 5V DC PSU):

my circuit

It looks like, when triggered, the OI allows the mains to trigger the triac, which switches the main load. Is that OK?

  • 4
    \$\begingroup\$ You will need a resistor between the ESP and optoisolator. \$\endgroup\$ – HandyHowie Nov 17 '17 at 14:57
  • 1
    \$\begingroup\$ Only if you're using the right kind of Optical Isolator can you use it to trigger the mains triac. MOC30xx are most prevalent, where xx is determined by your desires and the mains voltage. \$\endgroup\$ – Asmyldof Nov 17 '17 at 15:09
  • \$\begingroup\$ @Asmyldof I was thinking of the MOC3033. I'm in the UK, so mains voltage would be 230V. For the sake of me learning - what defines whether or not it is the 'right kind' of OI? I'm aware of the basics of how a TRIAC works, but I would expect triggering it with AC in phase with the load to cause at least some chopping. \$\endgroup\$ – Alex Nov 17 '17 at 16:37
  • \$\begingroup\$ @Alex - typically you'll get best results with an optoisolator where the output stage is actually itself a phototriac. Trying to use an ordinary phototransistor one can be very tricky - you may find that you do not reliably trigger both halves of the waveform. There's also a lot of interaction with your snubber circuit or whatever is completing the circuit through the opto's output stage. Be very careful when working on mains powered circuits, especially triac ones where the temptation to probe the mains side of the opto can lead you to violate isolation in hazardous ways. \$\endgroup\$ – Chris Stratton Nov 17 '17 at 21:49
  • \$\begingroup\$ And then you also need to consider a zero crossing version (for cleanest on-off switching) vs. the random-phase version needed if you are trying to do partial-phase dimming by triggering some selected time delay after zero crossing. \$\endgroup\$ – Chris Stratton Nov 17 '17 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.