Page 1 of 1

Zero crossing detector hardware.

Posted: Sat Nov 11, 2017 3:48 pm
by alanwms
If you want to pick up the zero point of the AC mains, a novel method (see attachment) is to use an opto isolator with two emitters reverse connected in parallel. The only time a positive signal is available, is when both LED emitters are not conducting (mains is at zero).
RB0 interrupt will be evoked every time the AC gets to a zero condition.

The main transformer uses a diode to supply the rest of you circuitry via the 5v regulator so no extra transformer is required.

Uses -
Light intensity control
Accurate timing (divide by 50 for 1 second action (60 USA)
Counting
Mains synchronizing (Grid inter-tie etc)
State programming - Allows an interrupt to gather I/O information. Could eliminate the requirement to use input icons making the program easier to read.
Zerocross.jpg
Zerocross.jpg (54.67 KiB) Viewed 5380 times
State Machine.jpg
State Machine.jpg (59.54 KiB) Viewed 5380 times

Re: Zero crossing detector hardware.

Posted: Sat Nov 11, 2017 3:54 pm
by kersing
It would be nice if you could attach a flowchart to complement the screen shots. Screen shots can be hard to read...

Re: Zero crossing detector hardware.

Posted: Sun Nov 12, 2017 1:26 am
by alanwms
Not sure if my particular code will add anything so I have increased the resolution for a partial look at the development of "states" in the interrupt routine which can be used to determine what to do in the main program.