How to Calculate a Slow Switch (Relay)

The typical use of a zero cross detector can be to control a mains relay. As relays have a response time that will be larger than the delay from the zero cross sensing to the actual crossing one technique can be to add a delay to the handling, i.e., sense the crossing on falling edge and make the relay close on rising edge.

To do this, the response time of the relay and the frequency of the mains has to be known. These values can either be known from the manufacturer, or measured in a lab or by the AVR itself.

The measurement can be implemented into the AVR software. By using the zero cross detector it can easily sample the frequency of the signal and with some few external components it can also measure the relay response time. This will give a universal system that can adapt to almost any AC mains frequency and relay response time. It will also continue being correct even if the relay response time or frequency will change over time.