Zero-Crossing Control

Last Updated on : 2022-11-24 09:20:13download

This topic describes what zero-crossing control is and how it works.


Zero crossing control is used to close or open the contacts of the relay at the zero-crossing point. This is useful to protect relays from spikes for better service life.


The device detects when the input signal crosses zero in either the rising or falling direction and controls the relay at the zero-crossing point.


The device detects the zero-crossing point to open or close the contacts of the relay at this point. Then, it will start detecting the next crossing event. There are two detection methods:

  • Single-edge detection

    This is a common method. The active edge can be either the rising edge or the falling edge.

  • Dual-edge detection

    This is not a common method. Generally, both the rising edge and falling edge should be the active ones.


  1. Set a time delay t for relay operation on the Tuya IoT Development Platform.
  2. Use the waveform of hardware signals to calculate the cycle T of the AC supply. Then, subtract the time delay t to get the time delay of the hardware timer. The formula is T − t.
  3. Once the device detects the zero-crossing point, it starts the timer that fires after T − t time has elapsed. After the timer fires, the software controls the relay switch so that the device will come on or off at the next zero point.