Simple LM311 Voltage Comparator circuit question

Discussion in 'The Projects Forum' started by Markw996, Aug 21, 2011.

  1. Markw996

    Thread Starter New Member

    Dec 20, 2009
    14
    0
    Hi,

    I have been experimenting with building a voltage switch using the simple comparator circuit below.
    It simply measures the supply voltage and turns on the relay when it gets up to 10 volts, then off again when it drops back down to around 9 volts.

    The problem I am encountering is that when the supply is initially applied, regardless of whether it is 8 volts or 11 volts, the relay is triggered for about 500ms before the circuit settles down to correct operation, other than that it works perfectly.

    Are my capacitor values wrong, or am I missing something as I can't understand why the circuit is not working as expected on initial turn on?

    [​IMG]

    Thanks,
    Mark.
     
  2. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    The problem appears to be associated with your reference voltage tied to the positive input. The 4.7 microfarad capacitor takes a finite amount of time to charge to the final value following the application of power. Until it reaches its final value, your reference voltage is low insuring that the comparator driving your relay buffer transistor.

    hgmjr
     
  3. Adjuster

    Well-Known Member

    Dec 26, 2010
    2,147
    300
    The rather big (100uf) cap across the 5.1V Zener and fed by 470ohms will add a few more tens of ms delay on power-up.
     
  4. Markw996

    Thread Starter New Member

    Dec 20, 2009
    14
    0
    Do you think I am wasting my time with this circuit due to the requirement to monitor the same voltage as the supply?
    (I cannot separate it in this project, as it must go inline on a 2 wire DC power supply)

    Is it salvageable or should I mabe be using a microcontroller instead of a comparator?
    If it is salvageable then how best to modify it?

    I just wanted something simple as I'm not that experienced when it comes to electronics design.
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Change the 10k resistor on the left to 1k, and that problem will go away.
    Even easier, just remove the 3.3k resistor below it.
     
  6. Adjuster

    Well-Known Member

    Dec 26, 2010
    2,147
    300
    Won't that radically change the voltage at which the circuit switches (the OP requires operation at 10V)?
     
    SgtWookie likes this.
  7. Adjuster

    Well-Known Member

    Dec 26, 2010
    2,147
    300
    I would suggest reducing the capacitor across the Zener and IC1 Pin8 from 100uF to say 4.7uF, and reducing the capacitor from the pot slider to ground from 4.7uF to 100nanofarads, or even omitting it altogether.

    The use of a comparator for this sort of task is pretty standard, but specific power supply "watchdog" parts are available and could do the job more neatly. In my opinion a microcontroller would be overkill for this unless you have other things for it to do, but then I am probably out of date on these matters.

    Incidentally, the circuit as shown looks as if it will energise the relay with a low input voltage, but turn it off when the voltage rises. This may not be a good strategy, as the relay cannot operate when the supply voltage drops too far- do you really want it this way around?
     
  8. Potato Pudding

    Well-Known Member

    Jun 11, 2010
    684
    92
    The Zener connected to the positive input that seems to used as a limiter would only come into play if the supply reached 20 Volts?

    And start up for timing I think that the 4.7μF connected to the negative input is the one that is holding your circuit on for so long.

    I haven't tested that theory yet.
     
  9. ifixit

    Distinguished Member

    Nov 20, 2008
    639
    108
    Yes it is salvageable.

    If pin 3 rises more slowly than pin 2 during power-up then the relay can be activated for a short time until all caps have charged. Your design needs to ensure that pin 3 comes up to voltage first ahead of pin 2.

    The sample voltage on pin 3 is 0.248 of the supply voltage. e.g. 18 x .248=4.46V, 10 x .248=2.48V. Therefore the adjustable reference on pin 2 needs to be set to 2.48V to put the relay on as the supply passes through 10V.

    The zener and cap in parallel with the 3.3K are not required.

    The other caps will delay the turn on of the relay during initial power-up. Is that okay?

    After power-up there will be no delay in relay drop-out if the supply goes below the reference V.

    Regards,
    Ifixit
     
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yeah, I goofed - the coffee hadn't finished perking yet. :rolleyes:

    Reducing all the caps to 0.1uF or less will help to get rid of the problem.

    [eta]
    Actually, the relay gets energized until the input voltage exceeds ~10v. Is that what you intended?

    If it's a 12v relay, operation below ~9v won't be reliable, as relays usually require roughly 2/3 to 3/4 of their rated voltage in order to engage.
    [eta]
    Change your feedback resistor connection from the inverting input to the noninverting input.

    [eta]
    See the attached image; that's what would happen with your current version if the caps were reduced. I'm starting the input voltage at 8v, ramping up to 12v, then back down to 7v. Note Ie(q1) - the emitter current of Q1; that's basically what's going through the coil of the relay.

    I'm going to swap the inverting and noninverting inputs, and post that revision next.
     
    Last edited: Aug 21, 2011
  11. Potato Pudding

    Well-Known Member

    Jun 11, 2010
    684
    92
    Unless they create an Oscillator.

    That one I tested.
     
  12. Markw996

    Thread Starter New Member

    Dec 20, 2009
    14
    0
    Thanks to everyone who responded, I am starting to understand a little better how the circuit works now.

    Adjuster & Potato Pudding were correct that the capacitor from pin 2 to GND was the problem, upon removing it completely the problem went away.
     
  13. Potato Pudding

    Well-Known Member

    Jun 11, 2010
    684
    92
    Some days I get it right, but only some days.

    I am glad that I could help.
     
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    The schematic attached is the same as the previous, except I used a comparator symbol with the inverting and non-inverting inputs swapped.

    Note that now the hysteresis is working as desired, and the relay does not turn on until Vcc reaches ~11v, and turns off when Vcc drops below 10v.
     
  15. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Gee, I didn't realize it had gone to a 2nd page; I'd just kept editing my previous post. :rolleyes:
     
  16. Markw996

    Thread Starter New Member

    Dec 20, 2009
    14
    0
    I've redrawn my circuit in LTSpice, and I'm trying to learn the basics so I can check it myself and see what effect changing component values has.

    Just to get me started (as I know nothing about how to simulate it yet) does my circuit look like it would work?

    I ask as I've tried a few simulations and it doesn't work, although at the moment I can't even find a potentiometer in the library, and I can't even set the voltage correctly as I always end up with a graph showing around 270KV !! :eek:

    Thanks,
    Mark
     
  17. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    The LTC1841's maximum recommended supply voltage is 11v. The absolute maximum is 12v, but you don't want to be operating at absolute maximums. Your non-inverting input can exceed the positive rail voltage, which is generally considered poor form.

    Your comparator output is not connected to anything.

    LTSpice does not come with a pot. You can use a pair of resistors. The Yahoo! LTSpice Users' Group has lots of models and help available. I have a pot model, but I'm to tired to look for it at the moment.
     
  18. Markw996

    Thread Starter New Member

    Dec 20, 2009
    14
    0
    Unbelievable, how could I miss that :mad:
     
Loading...