Electronic – arduino – Using zero crossing detector for brightness control of several loads

arduinotriaczero crossing

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?

Best Answer

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

http://playground.arduino.cc/Code/Timer1