I want to make a dimmer to control a huge power resistance of 700W. For this, I made a circuit that detected when the wave reaches zero (the circuit above the figure) and another that controls the TRIAC that controls the current that goes to charge.


The zero detection circuit is working fine, but the control circuit does not. I'm controlling everything for Raspberry. The code is only a function that is triggered by the interruption of zero detection. This function waits a certain time (depending on how much I want the wave to pass) and then a pin (which is what goes to the optocoupler and then to TRIAC). However, regardless of the time I put to wait, the output is always the same as the AC input, ie always 220V. Do you have any idea what might be happening?

I've already checked that Raspberry is sending the signal correctly and it is. So I think the problem is on the TRIAC or optocoupler side.

I'm using this components: R2,R8=180R ¼ w, 180R 1w R6,R4=680R ¼ w, 680R 1w R5=39R 3w R5=56K 1w R7=10K ¼ w R1=1M ¼ w C4=100nF C3=100nF 230V ~ C1=10nF 630V~ U1=MOC3021 U2=4N35 U4=BT136 Q1=BC547B

Thank you!!

  • \$\begingroup\$ Please repost the schematic with the grid turned off. It is not legible. Welcome to EE.SE. \$\endgroup\$
    – Transistor
    May 15, 2018 at 22:10
  • \$\begingroup\$ Apart from the schematic being less than legible, I see two independent snubbering / avalanche-limitation schemes in parallel, thus my question: Are you actually measuring the output with a load? Any load at all? \$\endgroup\$
    – Asmyldof
    May 15, 2018 at 22:22
  • \$\begingroup\$ Im sorry, i changed the image. Now you guys can see it? \$\endgroup\$ May 15, 2018 at 22:27
  • \$\begingroup\$ Im so sorry, but i dont know what snubbering is. But anyway, when i measured the output i was using oscilloscope and this resistance load. The tests were made on the physical circuit. \$\endgroup\$ May 15, 2018 at 22:29
  • \$\begingroup\$ Do you have the load attached? Without a low-resistance load attached you will read almost mains voltage due to the snubber and triac leakage. \$\endgroup\$ May 15, 2018 at 22:36

1 Answer 1


Replace R2(in your schematic) with a lower value, 120R worked fine during simulation. If still not working, make sure ZC interrupt occurs every 10ms. enter image description here

enter image description here

enter image description here

  • \$\begingroup\$ At 5v 120R was enough, at 3.3v a 100R should work. Pulse duration should be ~100uS. \$\endgroup\$
    – johnger
    May 16, 2018 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.