Shop OBEX P1 Docs P2 Docs Learn Events
Zero crossing detector for AC line voltage? — Parallax Forums

Zero crossing detector for AC line voltage?

NakNak Posts: 36
edited 2009-12-11 20:33 in Accessories
Greetings,

As a getting-started project with my Propeller Education Kit I have been tinkering with the idea of a digitally-controlled light dimmer. As the first step, I need to build a circuit that can sense the zero crossing of the AC line voltage and output a logic-level signal that I can read on one of the propeller's digital IO pins. Looking at other DIY projects on the Web, I found a circuit design using a DF04M bridge and and a 4N33 optocoupler and I ordered up the parts. Today I tried assembling it and testing at each stage that the circuit was working as expected.

But, right away I ran into an issue where the circuit does not seem to behave correctly.

When I run the AC current across the bridge, and then connect the bridge's + and - outputs across a 1M resistor so I can look at the output on an oscilloscope, I see a waveform that looks like this:
_ _ _
/ \ / \ / \
---

---

Rather than the expected waveform:
_ _ _
\ / \ / \ / \
- - - -

In other words, it looks like output from a half-wave rectifier rather than a full-wave rectifier. What is the likely cause of this? Did I get a bad bridge from Digi-Key or perhaps damage it while handling it? Or have I simply connected it up wrong?

-- Kaelin

PS: Sorry the ASCII art seems unintelligible... Basically it's looking like the AC sine simply has its lower half chopped off instead of rectified to a positive voltage.

Post Edited (Nak) : 12/6/2009 1:36:33 AM GMT

Comments

  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-12-06 02:03
    Take a Look at this web page

    You have to have a Optic Sensor that is made to be used on AC voltage

    I have used this Optic Sensor and it works very well

    You do have to use two 120000 ohm resisters one on each input pins for 120 [url=mailto:volts@.0005]volts@.0005[/url] amps or 5 millamps

    The part that you want to use is a H11AA1 optic sensor Data_Sheet

    http://www.sullivan-county.com/ele/triacs2.htm


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 12/6/2009 2:43:30 AM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-12-08 17:18
    Perhaps take a picture of your scope image? In the mean time, if you're running AC voltage into the bridge ~ terminals and then checking the +/- outputs you will get a spiked DC voltage at that point. The signal is no longer AC. Where are you connecting the opto? The opto you specified is for DC and would need to be protected from reverse voltage if using an AC input, so usually you would put a diode in reverse bias to the LED on the outside of the opto package to handle this, or, they do make optos that can directly read an AC signal.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • NakNak Posts: 36
    edited 2009-12-09 20:50
    The H11AA1 component recommended by sam_sam_sam looks like it would be simpler to incorporate than the circuit diagram I found. I have some sitting in a Digikey shopping cart while I research some part numbers for another project I'm starting up.

    Of course I would still like to understand what is going on with the circuit I built. What I did was hook up the bridge ~ terminals to an AC power cord with some 10K resistors, then put the +/- outputs from the bridge through a (1M I think) resistor and the oscope probes across the resistor. The output looked like the bridge was acting as a half-wave rectifier rather than a full-wave one.

    THEN for some reason I decided it would be a good idea to look at the signal coming into the bridge on channel two and so I put a second oscope probe across the AC input one the "outsides" of the resistors. As soon as I applied power to this setup, I got an impressive spark shooting out of the wall socket and one of the breadboard wires coming from the AC power cord melted in a heartbeat! I don't understand why this happened, as I had previously tried looking at the wall current with a trivial circuit consisting of a 1M resistor between the AC leads and that seemed to work fine. SO at that point I decided to pack up my project until I could seek expert advice... smile.gif

    The 4N33 opto was eventually supposed to be attached to the rectified output from the bridge (so then DC, but still at some high voltage) and then drive a 3.5V signal line to be attached to my microcontroller. But of course I never got that far, as I want to comprehend what is going on with the bridge first.

    PS: I'll try attaching a scope image if Chris or someone will first explain to me where I went wrong with that AC short... I'm a little reluctant to risk damaging the oscope playing with 120V AC power!

    Post Edited (Nak) : 12/9/2009 8:56:19 PM GMT

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-12-09 22:46
    You say the output looked half-wave rectified as opposed to full-wave...but do you understand the difference and how it would look on a scope? Also, I am unclear why you put the resistors across the leads, especially on the AC side and the 1M across the DC side.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • NakNak Posts: 36
    edited 2009-12-09 23:41
    Chris: As I am fundamentally a software guy, all of what follows may be completely wrong. Try not to start laughing too hard... smile.gif

    In my woefully limited understanding, the resistors on the AC side are there to control the current levels presented to the bridge. (I think of them as little soda straws stuck into a big pipe of fast-flowing current.) On the bridge output side, the 1M resister is there simply to complete a circuit without making a short (e.g. a "dummy" load).

    As to what the waves should look like, fully rectified should look like the negative half of the AC sine wave is "reflected" back into the positive domain (with little flat spots between the humps caused by some latency/loss inherent in the circuit). What I get instead looks like the bottom half of the AC sine wave was simply chopped off (with the flat spots perceptibly wider than the humps they lie between).
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-12-10 21:21
    Nak,

    Well, you are correct about the waveforms, and given that I cannot explain what is happening except to say, I would take the resistors out of the equation and try again.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    Check out the new Savage Circuits TV!
    ·
  • NakNak Posts: 36
    edited 2009-12-10 22:44
    Chris: So if I do that, the amperage through the bridge IC is controlled by... what... I guess the resistance of the DC circuit coming out of the bridge?

    And also "tapping" the AC input b/w two resistors acts as a voltage divider, is that correct? So without them the whole hot circuit will now be at 120V potential?

    Sorry but my grasp of this analog stuff is woefully tenuous. I am trying to learn!

    PS: Hmm, so it just occurred to me that maybe with the 1M resistor on the DC side the total resistance of the circuit was so high that there simply wasn't enough current to drive the bridge properly? I was thinking of them as two separate equations but really they're not... When I get home I'll look up the specs of the bridge and try to run those numbers. Gah!

    Post Edited (Nak) : 12/10/2009 10:52:36 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-12-11 18:54
    Nak,

    My best advice if you want to experiment with bridge rectifiers and checking the signals coming out of them would be to use a transformer first. Go to Radio Shack (or any electronics supply store) and buy a transformer with a 120VAC primary and a 6V – 12V secondary. Then get a bridge rectifier for it. While you’re at it I would also recommend a couple of inline fuse holders and fuses rated at 1/4A or 250mA. You should connect an AC power cord to the primary side through one fuse and be sure to use electrical tape, or better yet, heat shrink tubing to make sure no live (hot) parts are exposed. On the secondary connect the two outer wires (if there are three, ignore the center tap) to the AC inputs on the bridge. Use the other fuse on either of the secondary lines to provide protection. Now you can test your DC signal coming from the bridge @ low voltage and low current. If you short something you’ll blow a fuse (buy extras). I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    Check out the new Savage Circuits TV!
    ·
  • NakNak Posts: 36
    edited 2009-12-11 20:33
    Thanks Chris, that is excellent advice. smile.gif I didn't expect this part of the project to present such a challenge and was anxious to get on to the part where I play with my new propellers!

    I should know better...
Sign In or Register to comment.