+ Post New Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 20 of 41
  1. #1
    Advanced Member level 1
    Points: 2,432, Level: 11

    Join Date
    Aug 2016
    Posts
    424
    Helped
    66 / 66
    Points
    2,432
    Level
    11

    Mains setpoint monitoring basic circuit: best choice.

    Hello everyone,

    I need to monitor the mains with setpoint and I need an isolation too. I need a digital signal as output. When the mains is above the setpoint, I get a '1' and when below the setpoint I get a '0'. I am using opamp (with hysteresis) for the monitoring.

    Click image for larger version. 

Name:	20190501_131610.jpg 
Views:	25 
Size:	397.8 KB 
ID:	152770

    Click image for larger version. 

Name:	20190501_131558.jpg 
Views:	15 
Size:	386.8 KB 
ID:	152771

    I have posted two basic circuits that I think maybe cost effective that I would like to choose from but if you have a better circuit, I'm open to your suggestion.

    The circuit with a transformer is basically a switched mode converter with no feedback.

    Please what do you think of the circuits I have posted? If you were to select one from the two, which would you prefer? If you have a better circuit, please suggest to me.

    Thanks in anticipation.
    -------------
    --Akanimo.

    •   AltAdvertisement

        
       

  2. #2
    Advanced Member level 5
    Points: 9,710, Level: 23
    d123's Avatar
    Join Date
    Jun 2015
    Posts
    1,717
    Helped
    401 / 401
    Points
    9,710
    Level
    23

    Re: Mains setpoint monitoring basic circuit: best choice.

    Hi,

    Not an expert, anyway. Wouldn't circuit 1 be more cost-effective (less parts), lower current draw and smaller PCB requirements? What about a transformer, a voltage reference and a comparator? Why an op amp rather than a comparator, any reason, it saves a voltage reference could be one?


    1 members found this post helpful.

  3. #3
    Super Moderator
    Points: 256,580, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,758
    Helped
    13612 / 13612
    Points
    256,580
    Level
    100

    Re: Mains setpoint monitoring basic circuit: best choice.

    Presently the OP circuit doesn't provide hysteresis (positive feedback missing). Both circuits seem to have a fixed threshold ("setpoint"). In this case, a circuit with digital isolation (e.g. opto coupler) seems preferable. It however requires an isolated Vcc supply which also acts as reference voltage. Primary supply can be derived from the rectified mains voltage.


    1 members found this post helpful.

  4. #4
    Advanced Member level 1
    Points: 2,432, Level: 11

    Join Date
    Aug 2016
    Posts
    424
    Helped
    66 / 66
    Points
    2,432
    Level
    11

    Re: Mains setpoint monitoring basic circuit: best choice.

    Quote Originally Posted by d123 View Post
    Hi,

    ...
    What about a transformer, a voltage reference and a comparator? Why an op amp rather than a comparator, any reason, it saves a voltage reference could be one?
    I was thinking that a line frequency transformer would make the circuit unnecessarily bulky and so I tried to avoid it.


    Quote Originally Posted by FvM View Post
    Presently the OP circuit doesn't provide hysteresis (positive feedback missing). Both circuits seem to have a fixed threshold ("setpoint").
    ...
    I read the information somewhere that an Opamp with a network of two resistors as in the diagram introduces hysteresis. I have realized that I interchanged the inverting and the noninverting terminals of the opamps. That was a mistake.

    I'd probably go for the circuit with the optocoupler as you two have recommended. I'd be powering the monitoring circuit with the output of the reference pin of a UCx845. I'd also be using it as the voltage reference for the comparator. The optocoupler phototransistor would be biased with the secondary side output voltage of the flyback.

    I would like to improve on the circuit. Please I need your support. Thanks.
    -------------
    --Akanimo.



  5. #5
    Super Moderator
    Points: 79,409, Level: 68
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,005
    Helped
    4344 / 4344
    Points
    79,409
    Level
    68

    Re: Mains setpoint monitoring basic circuit: best choice.

    Things to consider:
    1. the current to the opto-coupler LED needs to be limited - add a series resistor.
    2. be very careful with 'ground' as the input part of the circuit is not isolated. As shown in the first schematic, you would either have a 'live' output or an exploded IC.
    3. think about where the supply for the op-amp, or better still a comparator comes from and whether is is isolated.

    You could make the whole input side 'live' and derive the comparator supply from the rectified AC, it would be a low cost option but you would have to add a stabilized reference voltage (a Zener diode maybe) because deriving the reference and measured voltage from the same source would not be reliable.

    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.

  6. #6
    Advanced Member level 1
    Points: 2,432, Level: 11

    Join Date
    Aug 2016
    Posts
    424
    Helped
    66 / 66
    Points
    2,432
    Level
    11

    Re: Mains setpoint monitoring basic circuit: best choice.

    Quote Originally Posted by betwixt View Post
    Things to consider:
    1. the current to the opto-coupler LED needs to be limited - add a series resistor.
    Yes, I'll do that. I'm also thinking of connecting a capacitor across the bottom resistor of the rectified mains voltage divider to help reduce the ripple that the opamps see at the signal input.
    2. be very careful with 'ground' as the input part of the circuit is not isolated. As shown in the first schematic, you would either have a 'live' output or an exploded IC.
    Oh! Thanks Brian for pointing this out... The ground symbol that references the opamps powersupply on the diagram is a mistake. I sketched the circuit without the opamp power pins.
    I hurriedly drew the Vcc and Gnd pins when I wanted to post the schematic.
    3. think about where the supply for the op-amp, or better still a comparator comes from and whether is is isolated.
    My initial plan was to power the opamp with a voltage that is output at the "Vref" pin of the power management IC that I am controlling the power supply with. It's not isolated anyways.

    You could make the whole input side 'live' and derive the comparator supply from the rectified AC, it would be a low cost option but you would have to add a stabilized reference voltage (a Zener diode maybe) because deriving the reference and measured voltage from the same source would not be reliable.
    The Vref pin output voltage is actually a stable 5V reference. I think that it will be adequately stable if I use a fraction of that voltage as my opamp setpoint.

    How about PCB ground isolation? The ground of the flyback primary and the ground of mains monitor combined, is it a good idea?
    -------------
    --Akanimo.



  7. #7
    Advanced Member level 5
    Points: 9,710, Level: 23
    d123's Avatar
    Join Date
    Jun 2015
    Posts
    1,717
    Helped
    401 / 401
    Points
    9,710
    Level
    23

    Re: Mains setpoint monitoring basic circuit: best choice.

    Hi,

    I was thinking - maybe accuracy-wise, not an alternative - about if the op amp could be replaced with a suitable voltage (series) Zener diode after the resistive divider, that way a pre-isolation side supply might be avoided and it could be used to create the digital on/off? Probably not accurate enough. Not sure if I'm asing a question or making a suggestion...

    Haven't considered in detail actual implementation of this voltage reference in your circuit, but I believe the TL431 might be used as a comparator instead of the op amp here, too, for the sake of making another suggestion just in case it's of interest.


    1 members found this post helpful.

  8. #8
    Super Moderator
    Points: 256,580, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,758
    Helped
    13612 / 13612
    Points
    256,580
    Level
    100

    Re: Mains setpoint monitoring basic circuit: best choice.

    TL431 (or may be LM385-Adj. for lower quiescent current), primary supply derived from rectified mains and a high transfer factor opto coupler would be also my solution. But we didn't yet hear accuracy requirements.


    1 members found this post helpful.

  9. #9
    Advanced Member level 5
    Points: 18,871, Level: 33
    Achievements:
    7 years registered
    crutschow's Avatar
    Join Date
    Feb 2012
    Location
    L.A. USA Zulu -8
    Posts
    3,643
    Helped
    865 / 865
    Points
    18,871
    Level
    33

    Re: Mains setpoint monitoring basic circuit: best choice.

    What is the main's voltage and what accuracy do you need.
    Zapper
    Curmudgeon Elektroniker


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  10. #10
    Super Moderator
    Points: 74,927, Level: 66
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,191
    Helped
    3461 / 3461
    Points
    74,927
    Level
    66

    Re: Mains setpoint monitoring basic circuit: best choice.

    Hi,

    I did a lot of mains measurement designs.

    Call me pedantic, but in my eyes it makes a big difference to monitor
    * mains voltage or mains current
    * mains RMS voltage
    * mains rectified average voltage
    * mains voltage waveform
    * mains frequency
    * mains overtones
    * or something else.
    It needs to be defined.
    Mains voltage may be almost pure sine, but there is no must. In reality it will be distorted, there will be noise, there will be transient spikes. Thus every method will show different result, and different threshold levels (varying with distortion)
    And what additionally needs to be defined: timing behaviour and hysteresis.

    The given schematics is something inbetween RMS and rectified average .... somehow undefined.
    Neither the one nor the other.

    Thus if you give your task to different designers, it will lead to different behaviour.

    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

        
       

  11. #11
    Advanced Member level 1
    Points: 2,432, Level: 11

    Join Date
    Aug 2016
    Posts
    424
    Helped
    66 / 66
    Points
    2,432
    Level
    11

    Re: Mains setpoint monitoring basic circuit: best choice.

    Quote Originally Posted by d123 View Post

    I was thinking - maybe accuracy-wise, not an alternative - about if the op amp could be replaced with a suitable voltage (series) Zener diode after the resistive divider, that way a pre-isolation side supply might be avoided and it could be used to create the digital on/off? Probably not accurate enough. Not sure if I'm asing a question or making a suggestion...
    This sounds like a good idea but I can really picture how to implement the idea. Please explain it in more details.

    Haven't considered in detail actual implementation of this voltage reference in your circuit, but I believe the TL431 might be used as a comparator instead of the op amp here, too, for the sake of making another suggestion just in case it's of interest.
    Yes, the TL431 can be used as a comparator. I am going to run a simulation, then build and test it with maybe 30Vdc from a benchtop PSU and see how it behaves. Then, hopefully, I'll upgrade it to the mains voltage. But I am just wondering whether I can achieve adequate hysteresis with it.

    Quote Originally Posted by FvM View Post
    TL431 (or may be LM385-Adj. for lower quiescent current), primary supply derived from rectified mains and a high transfer factor opto coupler would be also my solution. But we didn't yet hear accuracy requirements.
    I have looked at the LM385-Adj datasheet but it seems it cannot be used as a comparator. It would be a really nice implementation to have it do the job.

    I require an accuracy of +-2%.


    Quote Originally Posted by crutschow View Post
    What is the main's voltage...
    Specifications are that the mains voltage fluctuates from 190Vac to 250Vac at the target location of use. I need to select a setpoint of the mains voltage that I desire operability.

    Quote Originally Posted by KlausST View Post
    …in my eyes it makes a big difference to monitor
    * mains voltage or mains current
    * mains RMS voltage
    * mains rectified average voltage
    * mains voltage waveform
    * mains frequency
    * mains overtones
    * or something else.
    It needs to be defined.
    Mains voltage may be almost pure sine, but there is no must. In reality it will be distorted, there will be noise, there will be transient spikes. Thus every method will show different result, and different threshold levels (varying with distortion)
    And what additionally needs to be defined: timing behaviour and hysteresis.

    The given schematics is something inbetween RMS and rectified average .... somehow undefined.
    Neither the one nor the other.
    ...
    Klaus
    I am monitoring RMS voltage indirectly from the rectified mains voltage. I'd factor in diode drops and I'll provide a lot of filter capacitance to reduce ripple content to a tolerable level. Talking about noise, I have been wondering whether I should tap the rectified mains voltage for the power supply (SMPS) or I should have a separate bridge rectifier for this circuit to try and keep away from the noise within the power supply primary.

    Timing behaviour? Please elaborate on what you mean.
    -------------
    --Akanimo.



  12. #12
    Advanced Member level 3
    Points: 5,198, Level: 17

    Join Date
    Feb 2014
    Posts
    719
    Helped
    245 / 245
    Points
    5,198
    Level
    17

    Re: Mains setpoint monitoring basic circuit: best choice.

    Regarding Lm385 see figure 23 and 24 of the data sheet for comparator application. Same but inverted compared to TL431 which shouldn’t matter for an isolated AC application.



  13. #13
    Advanced Member level 5
    Points: 9,710, Level: 23
    d123's Avatar
    Join Date
    Jun 2015
    Posts
    1,717
    Helped
    401 / 401
    Points
    9,710
    Level
    23

    Re: Mains setpoint monitoring basic circuit: best choice.

    Hi,

    Regarding series Zener, it may not work how I'd thought, sorry about that... Image (only to show what I meant) is from Talking Electronics, How a Diode Works. I thought it would be switch-like, I'd need to simulate one this evening to see if it actually is or not.

    Attachment 152809

    This short article, Shunt regulator monitors battery voltage, says: "A TL431 shunt regulator is a perfect choice for many applications. You can use it as a comparator with hysteresis by taking advantage of its inner voltage reference along with few additional components. You can use this comparator with hysteresis, like a Schmitt trigger, as a simple battery monitor (Figure 1)." As a battery monitor, it looks more parts than the op amp you have.



  14. #14
    Super Moderator
    Points: 74,927, Level: 66
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,191
    Helped
    3461 / 3461
    Points
    74,927
    Level
    66

    Re: Mains setpoint monitoring basic circuit: best choice.

    Hi,

    I am monitoring RMS voltage indirectly from the rectified mains voltage.
    No.
    This simply is impossible.
    You just monitor an undefined voltage signal and multiply it with a factor to get a value that looks like a RMS value.
    But as soon as the waveform changes the factor should be adjusted - which most probably you don't do.
    If you want to call it RMS you need to: square - average - squareroot.

    The waveform changes... although in our region we have a very stable and clean mains supply, the sine is distorted. It's not easy to recognize this just by looking at the scope. Here the sine has a flatened top, caused by the rectifiers. And it's enough to make it impossible to get an +/-2% accurate RMS value with a non RMS measurement method.

    Some values (I know it's not compareable with mains sine).
    Take a square wave with variable duty cycle:
    At 0% both RMS and average shows the same: 0%
    At 100% both RMS and average show the same: 100%
    But with 50%: the RMS value shows 70.7% while the average method shows 50%.
    And both values are correct!

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



  15. #15
    Advanced Member level 1
    Points: 2,432, Level: 11

    Join Date
    Aug 2016
    Posts
    424
    Helped
    66 / 66
    Points
    2,432
    Level
    11

    Re: Mains setpoint monitoring basic circuit: best choice.

    Quote Originally Posted by KlausST View Post
    Hi,


    No.
    This simply is impossible.
    You just monitor an undefined voltage signal and multiply it with a factor to get a value that looks like a RMS value.
    But as soon as the waveform changes the factor should be adjusted - which most probably you don't do.
    If you want to call it RMS you need to: square - average - squareroot.

    The waveform changes... although in our region we have a very stable and clean mains supply, the sine is distorted. It's not easy to recognize this just by looking at the scope. Here the sine has a flatened top, caused by the rectifiers. And it's enough to make it impossible to get an +/-2% accurate RMS value with a non RMS measurement method.

    Some values (I know it's not compareable with mains sine).
    Take a square wave with variable duty cycle:
    At 0% both RMS and average shows the same: 0%
    At 100% both RMS and average show the same: 100%
    But with 50%: the RMS value shows 70.7% while the average method shows 50%.
    And both values are correct!

    Klaus
    How about this approximation ad regards bridge rectification where the rectified output is about the same value as the peak:
    Vdc=1.414*(Vac - 2*Vd) approx.?

    Where Vd is a rectifier diodes drop.

    The accuracy here is +-2% of the setpoint voltage and not for the entire continuum of instantaneous values.

    - - - Updated - - -

    Quote Originally Posted by asdf44 View Post
    Regarding Lm385 see figure 23 and 24 of the data sheet for comparator application. Same but inverted compared to TL431 which shouldn’t matter for an isolated AC application.
    Unfortunately for me, I'm not going to be feeding it with an isolated AC. I don't think it's going to be of much use as a comparator in this case.
    Last edited by Akanimo; 3rd May 2019 at 11:00.
    -------------
    --Akanimo.



  16. #16
    Super Moderator
    Points: 79,409, Level: 68
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,005
    Helped
    4344 / 4344
    Points
    79,409
    Level
    68

    Re: Mains setpoint monitoring basic circuit: best choice.

    I'm guessing the AC frequency and waveform purity are not particularly important in this application. I think the way I would do it is to use a capacitive dropper AC supply to power a low power comparator driving an opto-coupler for output isolation. The reference input can come from a Zener diode and measured input divided from the supply rail. It would make a low component count and fairly accurate monitor.

    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

        
       

  17. #17
    Advanced Member level 1
    Points: 2,432, Level: 11

    Join Date
    Aug 2016
    Posts
    424
    Helped
    66 / 66
    Points
    2,432
    Level
    11

    Re: Mains setpoint monitoring basic circuit: best choice.

    Quote Originally Posted by d123 View Post
    Hi,
    ...
    This short article, Shunt regulator monitors battery voltage, says: "A TL431 shunt regulator is a perfect choice for many applications. You can use it as a comparator with hysteresis by taking advantage of its inner voltage reference along with few additional components. You can use this comparator with hysteresis, like a Schmitt trigger, as a simple battery monitor (Figure 1)." As a battery monitor, it looks more parts than the op amp you have.
    I've run a simulation and I could achieve some hysteresis. I'll still do a board test for certainty.
    -------------
    --Akanimo.


    1 members found this post helpful.

  18. #18
    Advanced Member level 5
    Points: 9,710, Level: 23
    d123's Avatar
    Join Date
    Jun 2015
    Posts
    1,717
    Helped
    401 / 401
    Points
    9,710
    Level
    23

    Re: Mains setpoint monitoring basic circuit: best choice.

    Hi,

    Quote Originally Posted by Akanimo View Post
    I've run a simulation and I could achieve some hysteresis.
    You say "some"... Must ask: Is wide-ranging hysteresis (between VthL and VthH) possible with the part or does it seem to have a somewhat limited/restrictive range?



  19. #19
    Super Moderator
    Points: 74,927, Level: 66
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,191
    Helped
    3461 / 3461
    Points
    74,927
    Level
    66

    Re: Mains setpoint monitoring basic circuit: best choice.

    Hi,

    How about this approximation ad regards bridge rectification where the rectified output is about the same value as the peak:
    Vdc=1.414*(Vac - 2*Vd) approx.?
    This means peak value measurement.
    It is even less precise than your previous method, because it takes only a very short time of the fullwave into account. All the rest of the time the signal is ignored.

    The accuracy here is +-2% of the setpoint voltage and not for the entire continuum of instantaneous values.
    It seems you mix accuracy and precision.
    If you don't need accuracy but precision to be within +/-2% for a small area around the setpoint...then this eases design.
    Depending on waveform distortion you may have a good chance that your first solution may work.

    Rectified average, RMS, peak....
    You may calculate one value from the other when you know the waveform.
    Without waveform information it simply is impossible to calculate one from the other.

    Use excel to do a simple simulation:
    Let's use a sine with 10% third overtone.
    V(t)= sin(t) + 0.1 × sin(3 × t + phi)
    Phi is phase shift.
    RMS calculation gives a constant value independent of phi.
    Every other method will vary the output value depending on phi...even if the amplitude of both sine is constant.


    You are free to use to choose your own solution, I just want you to warn that your solution may not be that accurate as you expect.

    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.

  20. #20
    Advanced Member level 5
    Points: 18,871, Level: 33
    Achievements:
    7 years registered
    crutschow's Avatar
    Join Date
    Feb 2012
    Location
    L.A. USA Zulu -8
    Posts
    3,643
    Helped
    865 / 865
    Points
    18,871
    Level
    33

    Re: Mains setpoint monitoring basic circuit: best choice.

    Here's the LTspice simulation of a basic circuit using a TL431 reverence as a switch to generate an output from an opto isolator.
    R_Hyst gives a hysteresis of about 2Vac for the value shown.
    Pot U3 adjusts the trip point.
    For the setting shown, the output is high for 220Vac and low for 210Vac.

    Note that this circuit detects the peak AC voltage.
    To detect the true RMS would require the addition of a true RMS conversion IC.

    Click image for larger version. 

Name:	Capture.PNG 
Views:	14 
Size:	36.5 KB 
ID:	152815
    Zapper
    Curmudgeon Elektroniker


    1 members found this post helpful.

--[[ ]]--