johnny78
Full Member level 5
hi Guys
im using this method to detect presence of mains supply (220v AC)
on the MCU side i have set the internal pull ups & detect the presence by reading the status of the input pin
sometimes it fails to detect mains & the MainsDetectV going 0
the main problem is at my place it works fine since years without any problem but sometimes at other places it keep doing problems detecting mains
what may get different on other places i dont know
i've noticed 2 problems
1:when mains present sometimes the mainsDetect goes 0 & re goes 1 & i've tried to use 1uf cap instead of the 22u i use & i see my detection blinking between 0 & 1 so i think using bigger capacitor may solve this issue
2: when no mains present i saw once the detection reading 1 & this is impossible to happen because i use internal pull ups & no mains present to drive the optocoupler led(is it possible that the internal pull up resistors of the MCU are damaged? or the led of the pc817 is damaged ? or maybe i have low ac mains present which may appears like that mains is present)
is there any chip to do this detection for me?
of how to enhance my circuit
i think of alot of reasons may cause this problem but actually i cant see any of this problems happens here at my place it only happens when i install my device
at another place which i dont have tools to test or try
any ideas will be great
thanks in advance
Johnny
im using this method to detect presence of mains supply (220v AC)
on the MCU side i have set the internal pull ups & detect the presence by reading the status of the input pin
Code:
if (digitalRead(MainsDetect) == LOW) { // && (TurnOnDelay2V) == 1) {
MainsDetectV = 1;
}
if (digitalRead(MainsDetect) == HIGH) {
MainsDetectV = 0;
}
the main problem is at my place it works fine since years without any problem but sometimes at other places it keep doing problems detecting mains
what may get different on other places i dont know
i've noticed 2 problems
1:when mains present sometimes the mainsDetect goes 0 & re goes 1 & i've tried to use 1uf cap instead of the 22u i use & i see my detection blinking between 0 & 1 so i think using bigger capacitor may solve this issue
2: when no mains present i saw once the detection reading 1 & this is impossible to happen because i use internal pull ups & no mains present to drive the optocoupler led(is it possible that the internal pull up resistors of the MCU are damaged? or the led of the pc817 is damaged ? or maybe i have low ac mains present which may appears like that mains is present)
is there any chip to do this detection for me?
of how to enhance my circuit
i think of alot of reasons may cause this problem but actually i cant see any of this problems happens here at my place it only happens when i install my device
at another place which i dont have tools to test or try
any ideas will be great
thanks in advance
Johnny
Last edited: