Zero cross detector(IC H11AA1) generates a pulse exactly at zero crossing of AC wave. I am trying to control the brightness of several bulbs(nearly 48 loads). I have 5 different states for them. At state 5 triacs will fire instantly. At state 4 triacs will fire after 1960 micro seconds. Same way for all other states with the delay of 1960 micro seconds. The problem is I need different logic instead of delayMicroseconds() method in arduino to avoid the unwanted delay. I need to generate four interrupts with time interval of 1960 microseconds after zero crossing detector interrupt for every half cycle of AC wave. Is there any software or hardware implementation?

  • 1
    \$\begingroup\$ The H11AA1 does not generate a pulse "exactly at zero crossing of AC wave " and is, also, a poor choice for a zero crossing detector since that is what it isn't. Not only that, "1960 microseconds" implies a timing accuracy of about one part in 2000, which is ridiculous for a dimmer. So, it sounds like what you really want is something that will detect the zero crossing and generate a pulse followed by four more pulses about 2 milliseconds apart, with any of the five capable of being detected and used to set the lighting level. Is that right? \$\endgroup\$ – EM Fields Nov 3 '15 at 5:45
  • \$\begingroup\$ H11AA1 does not generate a pulse exactly at zero crossing. I know that too. Thats why I left 100 microseconds at begining and end of each half cycle of AC wave. After that I am dividing remaining time into 5 parts. And now, yes. You are right. I am trying to know something that will generate a pulse at exactly at zero crossing and also followed by four more pulses. Is there a way? \$\endgroup\$ – user2598121 Nov 3 '15 at 16:39
  • 1
    \$\begingroup\$ So, if you know that an H11AA1 can't generate a pulse exactly at a zero crossing, why would you say it could, in the firs t place? \$\endgroup\$ – EM Fields Nov 4 '15 at 1:51
  • \$\begingroup\$ It may not be an exact duplicate, but this question seems very close: electronics.stackexchange.com/q/148078/53375 \$\endgroup\$ – AaronD Nov 6 '15 at 16:03

You should check out the Timer libraries. This will give you access to more accurate timers:



The easiest way to do it in hardware, I think, is to drop the mains voltage down to some reasonable level using a transformer, which will also buy some almost always welcome isolation from the mains, then full-wave rectify the low-voltage sine wave from the transformer, using Schottkys. After that, use a comparator to do the zero-crossing detection and 3 pairs of comparators as window detectors to generate the output pulses at \$ 0^{\circ}, 45^{\circ}, 90^{\circ}, \text{and } 135^{\circ}.\$

The ZCD will generate a pulse at the next zero-crossing, \$ 180^{\circ}\$, and the window detectors will generate the pulses at \$ 225^{\circ}, 270^{\circ}, \text{and } 315^{\circ}.\$

Then at \$ 360 ^{\circ}/ 0^{\circ},\$ the ZCD will generate another zero crossing pulse and the cycle will begin anew.

I'm not sure whether you want to generate eight or ten switch points along the sine wave, but if you need more just add window detectors.

Finally, you could use something like an HC251 to steer the various pulses into the load.


Here's a way better way to do it:

T1 is used to get a low-voltage two-phase signal from the mains, and that signal is full-wave rectified by D1 and D2 and sent to U4, whose output goes low when it detects the low peaks of the full-wave rectified signal, which correspond to the mains' zero crossings.

U4's output is used to trigger U5A, which generates an output pulse with a width equal to: $$ \text {t = 1.1RC}, $$ where 't' is the width of the pulse, in seconds, R is the value, in ohms, of either R1, R2, R3, R4. or R5 (deepending on which one is selected by the Arduino) and C is the value of C1, in farads.

U1-Z is connected to +5 volts, so depending on the Arduino's outputs to U1, as shown on the truth table, 5 volts will be connected to one of the 5 timing resistors for U5A, setting the width of U5A's output pulse, the width of the pulse determining the brightness of the lamps.

When U5A times out, its low going output is differentiated and used to trigger U5B, which will generate the pulses used, ultimately, to fire the TRIACs.

enter image description here


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.