I want to detect the zero crossing of three phase supply... in order to dim the three 1000 watts bulb using three trial... in order to detect zero cross interrupt is required.. but two interrupt can't run at the same time... it is possible to build three phase zero cross dimmer using arduino.. please advice... I have a single phase zero cross dimmer code ..
#define triacPulse 5
#define SW 4
#define aconLed 13
int val;
void setup() {
pinMode(2, INPUT);
digitalWrite(2, HIGH); // pull up
pinMode(triacPulse, OUTPUT);
pinMode(SW, INPUT);
digitalWrite(SW, HIGH);
pinMode(aconLed, OUTPUT);
digitalWrite(aconLed, LOW);
}
void loop() {
// check for SW closed
if (!digitalRead(SW)) {
// enable power
attachInterrupt(0, acon, FALLING);
// HV indicator on
digitalWrite(aconLed, HIGH);
} // end if
else if (digitalRead(SW)) {
detachInterrupt(0); // disable power
// HV indicator off
digitalWrite(aconLed, LOW);
} // else
} // end loop
// begin ac int routine
// delay() will not work!
void acon()
{
delayMicroseconds((analogRead(0) * 7) + 200); // read AD1
digitalWrite(triacPulse, HIGH);
delayMicroseconds(50);
// delay 50 uSec on output pulse to turn on triac
digitalWrite(triacPulse, LOW);
}
Mohamoodameen:
I want to detect the zero crossing of three phase supply... in order to dim the three 1000 watts bulb using three trial... in order to detect zero cross interrupt is required.. but two interrupt can't run at the same time... it is possible to build three phase zero cross dimmer using arduino.. please advice... I have a single phase zero cross dimmer code ..
The three phases don't cross zero at the same time.
If you use an Arduino UNO there are only two external interrupts so you may need to use Pin Change interrupts. Study how to set up those interrupts or install a third-party library to do it.
Other models have more interrupt pins. Read the attachInterrupt() reference.
Ive never seen a 3 phase bulb. Most industrial lights 1000w are either high pressure sodium or metal halide that use 2 of the 3 phases and a capacitor. Due to the way they work im not sure they can be dimmed. (newer leds are generally not 1000w).
It would be interesting to see what type of light you have.
johnwasser:
The three phases don't cross zero at the same time.
If you use an Arduino UNO there are only two external interrupts so you may need to use Pin Change interrupts. Study how to set up those interrupts or install a third-party library to do it.
Other models have more interrupt pins. Read the attachInterrupt() reference.
Sir I am using delaymicrosecond inside the interrupt .. when other interrupt occurs it is queued until the previous interrupt delay microseconds finish or next interrupt is also serviced.. please explain
Mohamoodameen:
Sir I am using delaymicrosecond inside the interrupt .. when other interrupt occurs it is queued until the previous interrupt delay microseconds finish or next interrupt is also serviced.. please explain
That is just how interrupts work. Don't use a delay in your ISR to time your pulse. Use a timers to trigger a separate ISR when you want the pulse to end.