Zero-crossing detector?


Closed Thread
Results 1 to 14 of 14
  1. #1
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263

    Question Zero-crossing detector?

    Still with PBP and the 12F683.

    I've read AN236 and AN521, and searched the forum. I'll have to admit, mains AC directly to a PIC pin, even with huge megohms in series, scares me, but I'm game to try it--assuming the '683 has the same clamping diodes on an input as the 16C5X and 16F87XA devices. (Being mistrustful, I may add external diodes . . . )

    What is your preferred/recommended zero-crossing detection method--circuit and strategy and code?

    I'm looking for (a) transformerless, (b) fewest components, and (c) simplest implementation.

    Thanks!

    Name:  zcd.PNG
Views: 7569
Size:  5.4 KB
    Name:  resistor.PNG
Views: 7053
Size:  5.1 KB
    Attached Images Attached Images
    Last edited by ScaleRobotics; - 14th August 2010 at 19:28. Reason: Added application notes referenced in post
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    966


    Did you find this post helpful? Yes | No

    Default

    My preferred technique is to use a transformer to derive the 5V for my circuit. Use a votage divider to feed the raw stepped down AC to a pin on the PIC for zero cross detection. The code uses the zero cross interrupts to execute whatever it is that I need to do, like a phase control.

  3. #3
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by RussMartin View Post
    Still with PBP and the 12F683.

    I'm looking for (a) transformerless, (b) fewest components, and (c) simplest implementation.

    Thanks!
    Since you're looking for a transformerless design, you have sacrificed isolation from the mains anyway. Go with the resistor directly to the pic approach. For increased safety, break up the resistor value into 3 series resistors.

    Personally, I find the software easier to write if I have positive going transitions for each half-cycle. But to achieve this, you'd need to use an opto with 2 diodes in anti-parallel. I find the PC814 ideal for this.

    Regards,

    Anand Dhuru

  4. #4
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ardhuru View Post
    Personally, I find the software easier to write if I have positive going transitions for each half-cycle. But to achieve this, you'd need to use an opto with 2 diodes in anti-parallel. I find the PC814 ideal for this.
    Thanks for the suggestion! I had thought about using a garden-variety opto and getting half the cycle, but your idea is definitely better.

    It looks as if, using the PC814, I could maintain isolation from the mains. If the output goes to a Schmitt trigger input on the PIC, that should do very nicely.

    How do you factor the opto's diode drop (Vf) into the timing? I think I saw something about this in an article or app note but can't find it now.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  5. #5


    Did you find this post helpful? Yes | No

    Default opto

    I like to use isolation, cheap and reliable with ac opto coupler. AC opto gives + and - cycle detection with 1, 4-pin device and 2 resisters. can get pos or neg pulse at zero Xing.

    don
    amgen
    Attached Images Attached Images  
    Last edited by amgen; - 10th August 2009 at 02:40.

  6. #6
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Thanks, Don.

    I placed a parts order earlier this evening, so I included a dozen of the PC814s.

    Russ
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  7. #7
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by RussMartin View Post
    It looks as if, using the PC814, I could maintain isolation from the mains. If the output goes to a Schmitt trigger input on the PIC, that should do very nicely.
    Remember, since you want a transformerless supply, using an opto is still not going to give you mains isolation. BE CAREFUL!

    Regards,

    Anand

  8. #8


    Did you find this post helpful? Yes | No

    Default transformerless

    you are right, with no transformer, any part of your circuit could be 100 to 200 volts to ground since you can never be sure if the wall plug/receptacle is reversed, (a shock hazard). But that won't matter if no parts of your circuit are exposed to touch.
    I made a nice simple Xformer-less supply for push button pic/fan timer that picks up a 10amp relay. Has worked well over a long time.

    don
    amgen
    Attached Images Attached Images  

  9. #9
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Thats a good circuit Don, but i'd also use a 47E resistor in series with the 0.1 uf cap.

    Anand

  10. #10
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    I guess I wasn't very clear . . .

    I don't need a transformerless power supply for the PIC circuit and associated glue; I was looking just for a transformerless zero-crossing detector.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  11. #11
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Simple but works

    Hi,

    You can also use a NPN inverter from the rectified DC for sharper (inverted zero cross).
    Attached Images Attached Images  
    Last edited by sougata; - 11th August 2009 at 08:39. Reason: If you use a transformer this could be handy
    Regards

    Sougata

  12. #12
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Recently ive been using this idea. That page describes how to run an LED from the mains but with just the capacitor and resistor you can run an AC input darlington opto. Ive been using this method for detecting the presence of AC but it should work fine to detecting a zero crossing too.

    I always use an opto for safety. I did try a huge resistor feeding directly into the PIC which seemed to work fine till i connected the PIC to my laptop through serial and the laptop turned itself off.

    My prefered method is to use the 12V coming from the supply transformer. If you can use a transformer for the supply then you only need 2 extra diodes and a resistor to feed into the PIC.

    As for the code, i dont like using oninterrupt but i do use the interrupt flags. The program doesnt have to check the interrupt after each command that way. It checks it when you want.

  13. #13
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Phase shifts the zero cross

    Hi,

    The zero-cross sensing is mostly used for phase angle control. The Master The circuit you mentioned would essentially phase shift the zero cross signal.

    BTW if you replace this idea with this idea then you get more ideas. Like this idea

    Thanks to the author of the site and The Master
    Last edited by sougata; - 11th August 2009 at 15:00. Reason: Found out later
    Regards

    Sougata

  14. #14
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    I always use an opto for safety. I did try a huge resistor feeding directly into the PIC which seemed to work fine till i connected the PIC to my laptop through serial and the laptop turned itself off.
    For ZC, the resistor is adequate given the PIC has clamp diodes on the inputs. If you need mains isolation for RS232, use optos in the RS232 lines.

Similar Threads

  1. Replies: 6
    Last Post: - 10th September 2008, 10:04
  2. Crossing Page Boundary - Solution
    By Darrel Taylor in forum FAQ - Frequently Asked Questions
    Replies: 1
    Last Post: - 24th November 2007, 02:52
  3. IR detector
    By geckogrotto in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 30th August 2006, 03:16
  4. Crossing Page Boundary .....
    By turkuaz in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 20th March 2006, 07:57
  5. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts