enter image description here

So bascially, the bottom optocoupler (U5) is the zero cross detector which will send a pulse to pin 3 when a zero is detected and fire an interrupt. This interrupt will trigger a timer which will fire the second optocoupler(U7) when the timer has elapsed (Brightness level will determine the time delay)

Now for my question, I want to know if I connected everything fine, especially the triac part, I am unsure about that

  • \$\begingroup\$ (1) where does R4 connect to? (2) the triac provides a dead short from Live to Ground. The bulb will not light up but something else will. (3) Normally the triac would be on the low side of the load. \$\endgroup\$ – Brian Drummond Sep 16 '16 at 15:04
  • \$\begingroup\$ @Brian: Low-side switching was popular on some of the 1970s disco gear that I saw because they triggered from logic referenced to the neutral line. In SSR applications for industrial use they're always (wait for the rebuttals) put in the live line. \$\endgroup\$ – Transistor Sep 16 '16 at 17:34
  • \$\begingroup\$ @Transistor - as there's opto-isolation, you're right, high side triac should be fine. Thanks. \$\endgroup\$ – Brian Drummond Sep 16 '16 at 17:36


No. Unless your circuit is fully isolated from users, this is dangerous.

Judging on the number of severe mains-safety errors in this circuit, I would advise you not to build mains-interfacing circuits until you are more experienced in electronics. Mains electricity is dangerous and carries the risk of electrocution and causing a fire.


The TRIAC, on the high-voltage side of your circuit, is connected to the ground of the low-voltage side of your circuit. It's also connected through U7 and R3 to what I assume is the Vcc of the LV-side of the circuit. This means the low-voltage side of the circuit may be at mains potential. This is dangerous if it is connected to other systems or accessible by users.

You need to drive the TRIAC using just the high-side part of the circuit. Consider using a dedicated isolated TRIAC driver instead of a normal optocoupler - which won't work properly on AC anyway. (The MOC302XM series comes to mind, but there are many other options of course)

Other issues

  • The PC817 is only rated for 80V collector-emitter voltage. It is completely unsuited for mains use as U7.
  • R2 will pass 23mA RMS, and dissipate 5.3W RMS. It will burn quite impressively.
  • Also, R2 and BR1 need to be rated for mains voltages. R2 in particular is at risk of arc-over if using a cheap, common carbon-film resistor, resulting a nice explosion of U5.
  • You need a fuse on the mains side of the circuit.
  • You might also want a snubber on the TRIAC. (Although you can probably get away without for low-medium power incandescents)
| improve this answer | |

You have the wrong opto-coupler for the triac. You need an opto-triac. Connect up as shown in Figure 1.


simulate this circuit – Schematic created using CircuitLab

Figure 1. Correct opto-triac connection.

Marcelm has already pointed out the hazards with the zero-cross circuit.

The following may be of interest:

| improve this answer | |
  • \$\begingroup\$ See the links added. \$\endgroup\$ – Transistor Sep 16 '16 at 20:26

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.