+ Post New Thread
Results 1 to 15 of 15
  1. #1
    Advanced Member level 5
    Points: 34,243, Level: 45
    Achievements:
    7 years registered

    Join Date
    Sep 2008
    Location
    cambridge
    Posts
    7,114
    Helped
    514 / 514
    Points
    34,243
    Level
    45

    Accurate mains zero cross detector circuit without optocoupler

    Hi,
    We need an accurate mains zero crossing detector, but cannot use "wear-out" components such as opto-couplers. Do you agree that the attached circuit will be very good?, since it uses matched transistors, and also has Base_collector diodes to sweep out the minority carriers quickly.
    The micro will be able to calculate the point of zero cross from the signal from the NPN collectors.

    •   AltAdvertisement

        
       

  2. #2
    Advanced Member level 5
    Points: 40,618, Level: 49

    Join Date
    Mar 2008
    Location
    USA
    Posts
    6,550
    Helped
    1924 / 1924
    Points
    40,618
    Level
    49

    Re: Accurate mains zero cross detector circuit without optocoupler

    Decades ago we used an integrator (for phase shift,
    we wanted a 90 degree timing pulse for SCR motor
    control firing) followed by a comparator. For a zero
    crossing you could just use a single supply comparator
    and stop-diodes (Schottkies) to protect the input?
    We took the sine wave off one of the transformer
    secondaries.



  3. #3
    Advanced Member level 5
    Points: 19,285, Level: 33
    Achievements:
    7 years registered
    crutschow's Avatar
    Join Date
    Feb 2012
    Location
    L.A. USA Zulu -8
    Posts
    3,703
    Helped
    880 / 880
    Points
    19,285
    Level
    33

    Re: Accurate mains zero cross detector circuit without optocoupler

    but cannot use "wear-out" components such as opto-couplers.
    Why do you call that a "wear-out" component?
    Provided they are used well within their ratings, opto-couplers are just as reliable and long-lasting as most other solid-state devices.
    Zapper
    Curmudgeon Elektroniker



  4. #4
    Advanced Member level 3
    Points: 6,800, Level: 19

    Join Date
    Feb 2014
    Posts
    975
    Helped
    332 / 332
    Points
    6,800
    Level
    19

    Re: Accurate mains zero cross detector circuit without optocoupler

    It seems you micro isn't isolated so why even talk about an opto? Run your line/neutral dividers into a comparator with diode clamps as dick suggested.

    Or maybe do it all digitally? Perhaps condition the AC input with an inst amp or opamp in differential configuration and send it to the micro ADC?


    1 members found this post helpful.

  5. #5
    Super Moderator
    Points: 80,975, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,420
    Helped
    3728 / 3728
    Points
    80,975
    Level
    69

    Re: Accurate mains zero cross detector circuit without optocoupler

    Hi,

    Why do you call that a "wear-out" component?
    Provided they are used well within their ratings, opto-couplers are just as reliable and long-lasting as most other solid-state devices.
    From my experience I can say that I now try to avoid optocouplers. A lot of years ago I used optocouplers (high quality brand types) for an industrial circuit. Operating for about 5 years 7/24 with about 50% duty cycle. They degraded to 20% of the inital CTR until the function failed. We had a couple of optocouplers from the same batch in stock, so we could compare them.

    Klaus

    I forgot to mention: They were operated at the lower end of recommended current.
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    2 members found this post helpful.

  6. #6
    Advanced Member level 5
    Points: 34,243, Level: 45
    Achievements:
    7 years registered

    Join Date
    Sep 2008
    Location
    cambridge
    Posts
    7,114
    Helped
    514 / 514
    Points
    34,243
    Level
    45

    Re: Accurate mains zero cross detector circuit without optocoupler

    Thanks, I think we will do it with comparators....we will need hysteresis to stop chattering , which will mean an offset in the pulse from which we must derive the zero cross..but we can calibrate that out.



  7. #7
    Super Moderator
    Points: 80,975, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,420
    Helped
    3728 / 3728
    Points
    80,975
    Level
    69

    Re: Accurate mains zero cross detector circuit without optocoupler

    Hi,

    I did a lot of precise phase control units in the past.
    The most phase error was caused by the ZCU.
    The problem is that the waveform around zero cross will change with load (in a mains system).
    Also the zero cross is jittery / noisy.

    Thus we always decided to use filters to reduce some ringing around zero cross.
    The best "simple" solutions used resistive divider plus comparator.

    My more advanced solutions used a PLL that followed the mains frequency and reduced the high frequency jitter.

    One problem we faced with phase control units was that "switching ON the SCR / Triac" often caused additional edges in zero cross detection.

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  8. #8
    Advanced Member level 5
    Points: 34,243, Level: 45
    Achievements:
    7 years registered

    Join Date
    Sep 2008
    Location
    cambridge
    Posts
    7,114
    Helped
    514 / 514
    Points
    34,243
    Level
    45

    Re: Accurate mains zero cross detector circuit without optocoupler

    Thankyou for the advice.
    We have now done it with comparators with some hysteresis as attached.(LTspice sim and pdf schem)

    Though i fear we will need a negative supply for the comparators.....since the input pins are not allowed to go less than GND-0.3V....and even a Schottky cant gaurantee that...even if it did, Schottkys have leakage current which would mess things up.
    Last edited by treez; 28th January 2020 at 11:00.



  9. #9
    Super Moderator
    Points: 83,016, Level: 70
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,645
    Helped
    4535 / 4535
    Points
    83,016
    Level
    70

    Re: Accurate mains zero cross detector circuit without optocoupler

    You can do it with one comparator: feed a portion of L and N to the comparator inputs, the output will go high or low as the line polarity changes. You then use a capacitor coupling from the comparator output to recover a ZC pulse. It only needs one comparator and it doesn't have to be 'open collector'.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.


    1 members found this post helpful.

  10. #10
    Advanced Member level 5
    Points: 34,243, Level: 45
    Achievements:
    7 years registered

    Join Date
    Sep 2008
    Location
    cambridge
    Posts
    7,114
    Helped
    514 / 514
    Points
    34,243
    Level
    45

    Re: Accurate mains zero cross detector circuit without optocoupler

    Thankyou very much for your advice, i have just re-done it for one comparator...and no negative supply needed, as attached LTspice sim and pdf schem



  11. #11
    Advanced Member level 3
    Points: 6,800, Level: 19

    Join Date
    Feb 2014
    Posts
    975
    Helped
    332 / 332
    Points
    6,800
    Level
    19

    Re: Accurate mains zero cross detector circuit without optocoupler

    Yeah that circuit is actually pretty simple (one HV divider) if you're ok with the compromise that it doesn't switch at zero. It does give an individual pulse at each crossing (rather than an edge) if that's what you need.

    Also easy is to divide down both line and neutral, bias the result to mid-supply and feed it into a comparator. Use AC coupled hysteresis that decays in 10ms and you'll have 'perfect' edges at exactly zero. Or use asymetric hysteresis (diode in the hysteresis path) and you'll have one 'perfect' edge and one phase shifted edge.


    1 members found this post helpful.

  12. #12
    Super Moderator
    Points: 83,016, Level: 70
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,645
    Helped
    4535 / 4535
    Points
    83,016
    Level
    70

    Re: Accurate mains zero cross detector circuit without optocoupler

    I was actually thinking of connecting 'L' to one comparator input and 'N' to the other so it forces the polarity to reverse and if both inputs are weakly biased at half supply, it will give a square wave out at exactly zero crossing. The problem I can see is if you capacitively couple the output to give a spike as the edges change, the pulses will also be rising or falling. If you can live with alternate (positive going) crossing detections that would be fine, it you need to detect crossing in both directions your MCU would have to be directly coupled (no capacitor) and look for rising and falling edges. If you are using a PIC, there is already a facility to interrupt on rising or falling edges, you just have to swap the selected edge after each detection.

    If you use a PIC with a built in comparator you don't need an external one at all.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



    •   AltAdvertisement

        
       

  13. #13
    Advanced Member level 5
    Points: 34,243, Level: 45
    Achievements:
    7 years registered

    Join Date
    Sep 2008
    Location
    cambridge
    Posts
    7,114
    Helped
    514 / 514
    Points
    34,243
    Level
    45

    Re: Accurate mains zero cross detector circuit without optocoupler

    I was actually thinking of connecting 'L' to one comparator input and 'N' to the other so it forces the polarity to reverse and if both inputs are weakly biased at half supply, it will give a square wave out at exactly zero crossing.
    Thanks Betwixt, may I ask do you mean like in the attached? (Ltspice sim and pdf schem attached)….also the zcd signal….
    The rising edge of the signal is within 5us of the zero cross….it looks good . Though the way I have done it here…each comparator’s inputs linger for 10ms at a very close voltage to each other…and noise might come into it.

    - - - Updated - - -

    (BTW i muiltiplied the comparator output voltage by 100 to make it stand out in the sim "scope shot")



  14. #14
    Super Moderator
    Points: 83,016, Level: 70
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,645
    Helped
    4535 / 4535
    Points
    83,016
    Level
    70

    Re: Accurate mains zero cross detector circuit without optocoupler

    No, I meant a single comparator not two. The idea being that the AC is applied across the + and - inputs so you get a sudden reversal at zero crossing and the comparator gets a double whammy of the reference falling as the monitored input increasing or vice versa. The output should be a square wave with rising and falling edges aligned with zero crossing. If your MCU looks for alternate rising then falling edges it will know when zero crossing occurs. Most PIC devices (I think that is your preferred manufacturer) have edge detection built in and you can swap from rising to falling as soon as an edge is detected so it is ready for the next one.

    Some PICs also have built in analog comparators so you can do the job in very few components.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.


    1 members found this post helpful.

  15. #15
    Advanced Member level 3
    Points: 6,800, Level: 19

    Join Date
    Feb 2014
    Posts
    975
    Helped
    332 / 332
    Points
    6,800
    Level
    19

    Re: Accurate mains zero cross detector circuit without optocoupler

    Yeah once you have two high voltage resistor chains (probably a substantial portion of circuit size/cost) you might as well do something like this (there are a few different clamping structures you could use. You could even rely on the diodes in the comparator if they're specified for current).

    Click image for larger version. 

Name:	Capture.PNG 
Views:	8 
Size:	54.5 KB 
ID:	157540


    1 members found this post helpful.

--[[ ]]--