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.
Zero crossing detector hardware.
-
- 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.
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
― C.S. Lewis
-
- 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.
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 (35.23 KiB) Viewed 5372 times