Mains Zero Crossing Detector.
Posted: Thu May 07, 2009 2:49 pm
I am using a 12f675 with a high value single resistor connected between live and pin 6 (GP1).
Vss is connected to Neutral.
There will be an analogue voltage (0 to 5V) present at pin 7 (GP0). The higher the voltage then the lower time delay pin 2 (GP5) will be set high only on mains zero detection,
This attached Flowcode works 98ish percent of the time.
However there are odd times when zero mains is not detected.
GP5 is high for a maximum of 9.2ms, since ½ cycle lasts for 10ms and start of timer is at mains zero then I can’t see why the main zero is missed. Also some cycles are missed when GP5 is high for shortest time of 3ms
My question is:
Are there better ways of mains zero detection other then using port change interrupt?
Or is there a better way of using interrupt for zero detection?
GP2 /Int is used for over current detection, however GP2 is currently shorted to 0V
Vss is connected to Neutral.
There will be an analogue voltage (0 to 5V) present at pin 7 (GP0). The higher the voltage then the lower time delay pin 2 (GP5) will be set high only on mains zero detection,
This attached Flowcode works 98ish percent of the time.
However there are odd times when zero mains is not detected.
GP5 is high for a maximum of 9.2ms, since ½ cycle lasts for 10ms and start of timer is at mains zero then I can’t see why the main zero is missed. Also some cycles are missed when GP5 is high for shortest time of 3ms
My question is:
Are there better ways of mains zero detection other then using port change interrupt?
Or is there a better way of using interrupt for zero detection?
GP2 /Int is used for over current detection, however GP2 is currently shorted to 0V