Connect with us

Comparator inputs

Discussion in 'General Electronics Discussion' started by Viad, Sep 30, 2012.

  1. Viad

    Viad

    29
    0
    Feb 9, 2012
    I'd like to design a circuit to do the following but I'm not sure if I'm on the right track ?
    I want to monitor the 230V AC current through two separate conductors so I envisage using two current transformers
    Can I connect these both to the input of a simple comparator so that the output changes state when input A is greater than Input B
    All comparator circuits show a ref voltage, but can a varying voltage take the place of a ref voltage, as described above
    Will the outputs from the current transformers be large enough to operate the comparator inputs
    The currents I wish to monitor will vary between 0 and 60Amp 230V AC and I guess this will give a current transformer output of around 0-30mA

    Any advice would be most welcome
    Alan
     
  2. MrEE

    MrEE

    84
    0
    Apr 13, 2012
    You'd probably want to rectify and filter the output of each current transformer and then apply to a simple voltage comparator such as the LM339.
     
  3. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    A comparator just compares two voltages. There's no requirement that one of those voltages is a fixed reference voltage. You just need to ensure that the two inputs are always within the operating range of the comparator.

    A comparator compares instantaneous voltages. Your current transformers will produce an AC voltage (actually an AC current which you connect across a resistor to convert it into an AC voltage), where the instantaneous voltage is continuously changing, and which reverses polarity.

    The first step in dealing with an AC signal is to rectify it, so that the negative excursions are either ignored, or are converted to positive excursions. This can be done with a diode, but if you need accuracy down to low amps, you need to use a lossless rectifier, based on an op-amp - see http://en.wikipedia.org/wiki/Precision_rectifier and http://www.play-hookey.com/analog/feedback_circuits/full-wave_rectifier.html.

    You might also need some clean-up circuitry if the waveform has spikes or interference on it.

    You could compare the two rectified signals, but this won't give a useful result around the points where the AC waveform crosses zero, because the outputs of both rectifiers will be very close to zero and the comparator won't be able to reliably tell which one has the higher amplitude. It also requires that the signals and transformers are exactly in phase with each other, which would normally be true.

    More often you would convert each rectified AC voltage into a smoothed DC voltage, using the rectified voltage to charge a capacitor, with a resistor across it to allow it to discharge. This should be reasonably accurate if both waveforms are the same type, i.e. a sinewave in this case. This will give a clean comparator output but will affect the timing of the response to changing AC current.

    You can compare the voltages with a comparator like the LM393 (dual) or LM339 (quad). You may find it useful to have two outputs and a deadband. One output would be "A is definitely greater than B" and the other would be "B is definitely greater than A". When they're too close to reliably tell the difference, neither output would be active.

    If you're prepared to do some testing, and give more details of the project, I can give more detailed advice.
     
    Last edited: Oct 1, 2012
  4. Viad

    Viad

    29
    0
    Feb 9, 2012
    Thank you MrEE and especially KrisBlue for your very helpful reply, now that I know it can be done I shall do some testing .
    Thanks again,
    Alan
     
  5. duke37

    duke37

    5,211
    718
    Jan 9, 2011
    You could connect the two DC voltages in series, one oposing the other, so you have made a comparator. A positive voltage on the output could drive an indicator.
     
  6. Viad

    Viad

    29
    0
    Feb 9, 2012
    I'm not sure how that would work Duke 37
    I want to compare the current flowing through two conductors of an AC 230v UK domestic supply.
    I wish to operate a relay depending on which conductor is carrying the most current.
    The value of current isn't important
    For instance if conductor A is carrying the most current then the relay is in it's normally closed position.
    If conductor B is carrying the most current then the relay operates .
     
  7. duke37

    duke37

    5,211
    718
    Jan 9, 2011
    Put a current transformer in each line, rectify the output curents to get DC, load the outputs with a resistors to get a voltage. Connect these two voltages in opposition and feed a relay through a diode so the relay switches when the voltage A is bigger than voltage B.
    This might not be sensitive enough for you and you may have to go to an electronic solution.

    Whatever the solution, you will need a certain sensitivity and will need to cater for large differences in current without damage.
    Hall effect devices are alternatives to transformers and can be installed without cutting wires.
     
  8. Viad

    Viad

    29
    0
    Feb 9, 2012
    Thanks all for help so far, I have a question concerning the current transformers.
    I see ones advertised as input current 30A , input current o-100 A or 60A etc .
    It seems the ratios are similar , for example The 30A transformer will produce 30mA at 30A. The 100A transformer will also produce 30mA at 30A and of course 100mA at 100A
    I can not find an explanation as to the suitability of the different current ratings .
    For example if a project only required to monitor up to 30A then would we chose a 30A transformer or could we also use the 100A transformer with the same results .
    This is puzzling me
     
  9. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,174
    2,690
    Jan 21, 2010
    probably.

    If you're using two of them and comparing the output, make sure you use two of the same unit.

    The higher current one may be less linear at low currents, or there may be some other subtle differences (maybe not so subtle -- maybe it's physically larger?)
     
  10. Viad

    Viad

    29
    0
    Feb 9, 2012
    Thanks Steve, I asked a manufacturer , seems it's price, size and probably subtle differences which don't affect my project.
    To be clear; KrisBlueNZ suggests using an LM339 dual or LM 339 Quad comparator .
    As I only wish to compare two voltages am I correct in thinking that an LM 139 single comparator will do the job ?
    Alan
     
  11. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,174
    2,690
    Jan 21, 2010
    Probably. But the issue is availability. You may find that is is easier and cheaper to use 1/4 of a quad comparator than to locate a single comparator (this particular device). Sure it may be listed on the datasheet, but maybe nobody carries it.
     
  12. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    Steve is right. That's why I didn't suggest a single comparator, although you only need one. The LM393 (dual) is fairly widely available, and is the same physical size as a through-hole single comparator; the LM339 (quad) is even more widely available. Also, they're not all the same internally, and I know from prior experience that the LM393 gives good performance.
     
  13. Viad

    Viad

    29
    0
    Feb 9, 2012
    Thanks Steve and Kris, that makes sense
     
  14. Viad

    Viad

    29
    0
    Feb 9, 2012
    http://electronguide.com/circuits_pages/ACLineCurrentDetector.html
    Hi, after a break of a few months I have returned to my project
    The link is to somebody else's project that I thought I might adapt . I would use two LM1458 and feed the output to a LM393 .I will use YHDC SCT-013-000 current transformers in place of the home made one.
    Can anyone please explain the operation of the first LM 1458 in the example. The Op Amp circuits I have looked at at place the input between + and ground , this one doesn't how does it work, what determines the amplification, and how does the 'ct burden resistor' feature in this circuit, where is it ?
    thanks
     
    Last edited by a moderator: Jan 12, 2013
  15. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    That's a good design. It uses a few tricks so minimise components and simplify the circuit that make it a bit hard to explain though.

    The first op-amp operates in the "inverting amplifier" configuration (Google or Wikipedia it), with a gain of about 200 (100k / 470). Its input is the left hand end of the 470 ohm resistor. This resistor also functions as the burden or shunt resistor.

    It uses a simple AC-to-DC conversion circuit consisting of the diode, capacitor and resistor between the two op-amps. This circuit responds to the peak voltage of the AC signal. This may be good enough for your application, if the AC current signals are clean. What type of loads are you powering from the AC mains?

    You can use an op-amp as a comparator; since you will already have two op-amps in your circuit, you could use a quad op-amp IC and you won't need a separate comparator IC. I recommend the MC34074 (for pretty much all applications actually; I really like that IC).

    If you want a small bias in favour of one of the sources, so that if both mains loads are the same, or are zero, the comparator always chooses a certain option, this can be done fairly easily in various ways. You can also add hysteresis (Wikipedia it) to the comparator so that it doesn't chatter (switch randomly due to small variations) when the two mains load currents are the same, or nearly.

    What power source(s) do you have available for this circuit?

    Have you chosen a relay? If so, can you state the part number and/or a link to the data sheet?

    Answer the questions in this post and I'll draw up a circuit for you.
     
  16. Viad

    Viad

    29
    0
    Feb 9, 2012
    Thanks for the explanation and the offer Krisblue, here goes
    Current flowing through two separate kW hr meters is monitored by two YHDC SCT-013-000 current transformers 100A gives 50mA
    The kW hr meters supply two fuseboards in a domestic situation, one fuseboard is for sockets ,lights etc, the other is for electric heating.
    The power company charge half rate for the heating power
    There is an alternative free source of power available but it can not be connected to both fuseboards at the same time so the idea is to switch the alternative power to whichever fuseboard is drawing the most current
    ( the burden resistors could be two different sizes to account for the different tariffs)
    I think I would prefer the power and lights fuseboard to be the default board
    I can tie the output of the comparator to a small pcb mounting relay ( I happen to have a box of, 12V 40mA ) using a transistor.
    This in turn will operate a larger 40A contactor to switch the loads
    The maximum alternative energy is 5kW 22Amps there about
    A tricky part... once the current being drawn exceeds 22A I don't suppose it matters which fuseboard is drawing the most current neither by how much, the alternative energy could be switched to either.
    I would like to keep the switching to as little as possible, I don't think it is necessary to switch small loads, anything below a few hundred watts , 400w perhaps needn't be monitored
    Yes hysteresis is a good idea and also 'capacitor/resistor' circuitry would be good to slow things down, as it doesn't need to be switching precisely at every change of current, it would be better in fact if it didn't.
    I intended to operate it using a voltage regulator at 12V
    This will all be built into a small enclosure along with the contactor
    If you require any other details please don't hesitate to ask

    I really look forward to your circuit
    thanks
     
    Last edited: Jan 14, 2013
  17. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    I'm not totally clear on what you want to do. I've mostly designed something that MAY do everything you want. It would be best if I describe it to you, and you tell me whether it's right or not. I'll do that tomorrow. Your last post was very helpful but I still need one other piece of information.

    You say that the maximum current in the alternative energy circuit will be about 22A, but what is the maximum current in the other circuit?
     
  18. Viad

    Viad

    29
    0
    Feb 9, 2012
    KrisBlue hope this helps
    Utility company supply power to a domestic household
    Utility company fuse is a maximum of 100A
    Within the household the supply is split between to fuseboards
    Each fuseboard is separately metered
    The fuseboard supplying the heating load is charged $ Y per kW hr
    The fuseboard supplying the power points and lights etc is charged $ 2xY per kW hr
    A wind turbine supplies power up to its limit of 5kW 22Amp
    The turbine power can not be connected to both fuseboards at once as that would effectively connect the two meters etc together
    To make best use of the turbine power its output would need to be switched to whichever fuse board was using the most power
    The loads on either fuse board will of course be changing depending what is connected and the time of day ( electric heating load will be timed )
    I suppose either load could reach the maximum of the service fuse 100A , that is unlikely but it could happen in a large house
    The thing is that I suspect it is irrelevant what the current is doing in either fuseboard once the load is taking more than 22A
    ie once fuseboard 'A' is drawing 22A then there is no point in switching to fuseboard 'B' if it happens to be drawing more than fuseboard 'A' because the turbine can only supply a maximum of 22A
    To accomodate the difference is price per unit between the two fuseboards the burden resistor on the ct connected to the heating fuseboard would need to be half the size of the resistor connected to the sockets and lights fuseboard, or accomplished by some other means.
    thanks
     
  19. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    Thanks for those answers.

    I'm afraid I'm still not sure what you want, but here's what I have so far.

    I'm not sure whether this circuit will do everything you want. Have a look at the description and let me know.

    I haven't worked with current transformers before, so if you use this circuit, be prepared to do a bit of testing, measurement and experimentation. I hope you have Skype and are prepared to spend some time on this project, because this will probably be required! Do you have access to an oscilloscope? It will probably be needed.


    [​IMG]


    Currents in two mains circuits are monitored by T1 and T2 which have a ratio of 100A:50mA. The maximum current of interest in either phase is 22A RMS which translates to 11 mA RMS or 15.6 mA peak.

    U1A and U1B convert this current into a voltage. The 12V supply is split by RH1 and RH2, forming a voltage rail called VAR (amplifier reference voltage) which is about 2.8V. This is done to keep the voltages at U1A and U1B's inputs inside the power supply rails so they can amplify correctly.

    U1A operates as an inverting conductance amplifier, which converts an input current (coming from T1) into an output voltage, which is relative to VAR. An op-amp with negative feedback (through RC1) adjusts its output voltage to keep its inputs at the same voltage. When current out of the bottom pin of T1's secondary is negative, U1A's output will provide an equal current in the opposite direction through RC1 to keep the inputs at the same voltage.

    U1 is an ON Semiconductor MC33179P quad op-amp with high current outputs that can easily supply enough current to match the 15.6 mA coming from the current transformer. To force 15.6 mA through RC1, U1A's output must go about 4.2V positive with respect to VAR, i.e. to about +7V.

    When the current from the bottom end of T1 is positive, U1A's output cannot swing low enough to match the current; it will just bottom out, and the two 1N914 diodes across the current transformer will limit the differential input voltage to about +/- 0.8V and prevent damage to U1A.

    So U1A's output is biased at 2.8V (from VAR) and swings positive in response to negative current from the bottom end of T1's secondary, translating a peak current from T1 of 15.6 mA into a peak voltage of 4.2V relative to VAR.

    U1A's output cannot go higher than about 9V so the U1A circuit block cannot reproduce peaks that exceed about 23 mA at T1 secondary, which corresponds to a mains current of about 32A RMS.

    The other side of the mains current waveform is not used, and only the peak current of the mains waveform is measured, so it's assumed that this current is a sinewave (or at least that both phase current waveforms have the same shape or are at least symmetrical above and below zero). This is true if the loads have a power factor of 1, which is true of heating loads and incandescent lighting loads, but not necessarily true of energy-efficient lights and fluorescent lighting, and switching power supplies such as those used in computers and electronic consumer appliances.

    The output of U1A is rectified by DR1 and smoothed by CT1. There is a voltage loss of about 0.7V in DR1.

    The voltage on DR1 cathode represents the measured phase current, relative to about 2.1V (VAR minus one diode voltage drop).

    U1B operates identically but measures the current in mains circuit 2.

    RT1, VRF and RT2 form a voltage divider that taps off about half of the CT1 voltage; this is fed to one input of U1C, which compares two voltages. Its other input is fed with about half the CT2 voltage (which represents the current in the second mains circuit).

    U1C's output drives QI which acts as an inverter and produces a voltage at its collector that swings almost fully from one supply rail to the other. When QI.C (collector of QI) is high, current through RL causes LED1 to light, indicating that the current in mains circuit 2 is higher than that in mains circuit 1, and current through DH produces a voltage of 0.7V on DH's anode.

    An adjustable amount of this voltage is taken off by VRH (hysteresis setting trimpot) and fed to the bottom of the RT3/RT4 voltage divider, providing hysteresis in the comparator.

    Here is the hysteresis action described in detail.

    Assume the VCT1 (voltage on CT1) is much higher than the VCT2. U1.10 (U1 pin 10) will be much higher than U1.9, so the output at U1.8 will be high. (U1C is used as a simple voltage comparator.) There is no base bias for QI so QI is OFF, and RP pulls QI.C to zero volts. There is no voltage on VRH, so the RT3/RT4 voltage divider divides the voltage between CT2 and 0V, and the result feeds U1.9.

    Now assume that the mains phase 2 current increases steadily. The voltage on CT2 increases steadily until VU1.9 is higher than VU1.10; when this happens, U1.8 will go low. This turns QI ON, and current flows through RL, LED1 and DH, producing a single diode voltage drop (about 0.7V) on DH.A (anode of DH). An adjustable portion of this voltage (adjusted by VRH) now appears on the bottom of the RT3/RT4 voltage divider, causing VU1.9 to increase further. This produces the clean switching action that is characteristic of hysteresis, because VCT2 now has to decrease further before U1C will switch back the other way.

    VRF adjusts the voltage division in the RT1/VRF/RT2 divider so that one or other phase can be favoured. That is, when VCT1 and VCT2 are equal, and ignoring the effect of the hysteresis circuit, adjusting VRF causes U1.10 to see a greater or lesser portion of VCT1, so that the comparison is biased in favour of one phase or the other.

    So VQI.C is high when the phase 2 current is higher than the phase 1 current, and otherwise is low. This voltage is fed through RD to CD which provide a delay to prevent rapid switching. (The hysteresis in the comparator stage will also tend to prevent rapid switching.) The time delay of the RD/CD circuit is roughly equal to RD (in ohms) multiplied by CD (in farads), which is 330e3 * 100e-6 which is 33 seconds. This is only approximate. To change this delay, vary CD, not RD.

    U1D operates as a Schmitt trigger (a voltage detector with hysteresis). The trigger voltages are about 1/3 and 2/3 of the supply rail, i.e. 4V and 8V, and these thresholds apply to VCD. RSF provides the hysteresis; it adjusts U1D's threshold voltage (U1.12) according to the output state. The output on U1.14 is the opposite of U1.13 (because it's an inverting Schmitt trigger), so when the phase 2 current is greater than the phase 1 current, VCD is high, and U1.14 is low, turning ON QR and activating the relay.

    Therefore the relay closes when the phase 2 current is higher than the phase 1 current.
     

    Attached Files:

    Last edited: Jan 14, 2013
  20. Viad

    Viad

    29
    0
    Feb 9, 2012
    Kris, that's brilliant, a more intricate circuit than I expected, I will have to order the MC3317P so it will be a while before I can try it out and report back. I'm not too hot on electronics but I do have an oscilloscope, not sure why you say 'i hope you have Skype' ?. Thanks also for the detailed description of its operation, I think it will do what I want, but I need to read your description through a few more times and of course try it out.
    Thanks for going to all that trouble, I will try it out as soon as possible.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-