Zero crossing detector hardware.

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
alanwms
Posts: 67
Joined: Tue Sep 16, 2008 2:09 pm
Location: Minnesota USA
Has thanked: 4 times
Been thanked: 17 times
Contact:

Zero crossing detector hardware.

Post 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 5283 times
State Machine.jpg
State Machine.jpg (59.54 KiB) Viewed 5283 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Zero crossing detector hardware.

Post by kersing »

It would be nice if you could attach a flowchart to complement the screen shots. Screen shots can be hard to read...
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

alanwms
Posts: 67
Joined: Tue Sep 16, 2008 2:09 pm
Location: Minnesota USA
Has thanked: 4 times
Been thanked: 17 times
Contact:

Re: Zero crossing detector hardware.

Post 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.
Attachments
Flowcode state.jpg
Flowcode state.jpg (35.23 KiB) Viewed 5273 times

Post Reply