I have a circuit where i detect zero-crossing (Mains EU 230V 50Hz) with opto to arduino(interrupts). Then I need to delay (from 0 to 10 milliseconds) it to trigger Triac gate. but then I need another arduino to tell the first one how long the delay should be.

The variable delay should be like mapping 0-5V to delay time. so 0V no pulse(delay is indefinite) and 5V = no delay and 2,5V delay should be somewhere 5milliseconds.

I am not that good in electronics but i know that AC phase control can be done without first arduino. I have been checking 555 timers but am a bit lost.

So the end circuitry should be zero crossing triggering every 10 milliseconds (have this already with short pulses of 5V) to circuit where I would with PWM or 0-5V set the delay 0 to 10 milliseconds and send again a pulse out (DONT HAVE) to trigger Triac. Or at least point me to direction I should look into. Is timer 555 the right way or something else?

  • 2
    \$\begingroup\$ Why would you add a 555 timer when the microcontroller can do the timing internally much more accurately? \$\endgroup\$
    – Transistor
    Commented Feb 23, 2019 at 18:24

1 Answer 1



simulate this circuit – Schematic created using CircuitLab

Figure 1. A rough layout of the standard way of controlling the triac. The schematic does not show the details of the triac snubber circuit.

How it works:

  • R1 / C1 provide a filter for the PWM input to convert it to a zero to 5 V analog input.
  • The micro resets a timer on every zero cross.
  • The output is switched on some time after the zero cross. For a 0 - 1023 analog input we can just take the input value and multiply by 10 to get the required number of microseconds delay to turn on the opto-triac.
  • The opto-triac provides the required electrical isolation between the microcontroller and the mains.

Do not take short-cuts with mains isolation. Do it properly or injury to personnel may occur or damage to equipment. Screw stuff into an insulated box. Terminate wires properly. Use fuses.

  • \$\begingroup\$ What is U1 micro? or you mean some mcu? For snubber on load i already have it. also have the full wave bridge to 4N35 an there i have ZC trigger. \$\endgroup\$
    – user213736
    Commented Feb 23, 2019 at 19:21
  • \$\begingroup\$ just saw the comment above :) This I have already with interrupts on ZC with Arduino micro. Everything is working like it should :) I am trying to find a way to simplify the design not to use too many arduinos. If there is a way to do it without one. It doesnt need to be a 555 can be some dedicated IC if it exists. I just need to implement delay between ZC trigger and trigger to Triac according to input. :) Oh and thank you for the answer! \$\endgroup\$
    – user213736
    Commented Feb 23, 2019 at 19:29
  • \$\begingroup\$ The Arduino platform is a microcontroller with some peripherals used to power and program it. In most cases, once it is programmed you are only using the micro. It's not clear from your question why you think you need more than one Arduino. \$\endgroup\$
    – Transistor
    Commented Feb 23, 2019 at 21:07
  • \$\begingroup\$ well one for ZC detection and one to control the delays.......I need more of them in my house (for heating elements with AC fan control) right now they are on or off and i would like to implement PID controller for each of them (each room one heater so i can control different temp in each room). So one Arduino Mega with more instances of PID controller one for each of the rooms. and with Mega to send 0-5V for the delay in firing Triac in how much would be needed.......already tested one room and cheaper than only on/off :) so mainly dedicated IC if exists :) \$\endgroup\$
    – user213736
    Commented Feb 23, 2019 at 21:28
  • \$\begingroup\$ But why would you not perform the ZC detection and triac control in the one device? \$\endgroup\$
    – Transistor
    Commented Feb 23, 2019 at 21:36

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.