Connect with us

comparator oscillating

Discussion in 'Electronic Design' started by Walter Harley, Nov 22, 2003.

Scroll to continue with content
  1. (...I know, you read the subject line and you think "duh, of course it is.")

    I'm having an unexpectedly hard time getting a comparator circuit to work,
    and would appreciate a bit of insight into what I'm doing wrong.

    The context is that I'm trying to design a circuit to detect presence of a
    musical instrument signal and turn on the power to a battery-powered device.
    So, I want a circuit that will run on 9v, with max current draw of less than
    20uA or so. It needs to turn "on" with signal levels of as low as 20mV
    peak. The input impedance needs to be at least 1MEG, hopefully higher.
    Frequency response can be awful: it's fine, even desirable, to only detect
    signals from 50Hz to 2kHz.

    So, that was the context. Here's the present problem. I've got a very
    simple comparator circuit, that is the first stage of this control device.
    And I can't keep it from oscillating, around 1MHz, no matter what I do.
    Below is one version of the circuit. I've played with all the values, with
    no luck. I've put bypass capacitors everywhere I can think of, including
    the + input of the comparator (but that one was only 10nF). I've run it off
    bipolar supplies, even though the TS393's common mode range includes ground.
    All leads are short, but it is breadboarded on one of those spring-clip

    I assume that if I got my resistances low enough I would swamp whatever
    capacitive effects are causing this. But the whole point of this exercise
    is to be low power. I assume that other people are using micropower
    comparators successfully... what am I missing? Do I need to actually build
    a PCB with guard traces, or air-wire the whole thing, before I know whether
    it works?


    | | | |
    .-. | | .-.
    3.3M | | | | | |
    | | | | 10k| |
    '-' | | '-'
    | | | |
    | |\| TS393 |
    o---|+\ | |
    | | >--|--------o
    .------o----------|-/ | |
    |1M | | |/| | |
    .-. | | | | |
    | | 47pF | | | ___ |
    | | | o-----|---|-|___|--'
    '-' | | 3.3k| | 3.3M
    | --- .-. | |
    | --- | | | ---
    | | | | | ---
    | | '-' | | 0.1uF
    | | | | |
    created by Andy´s ASCII-Circuit v1.22.310103 Beta
  2. Robert Baer

    Robert Baer Guest

    In no particular order:
    1) Why the positive feedback (3.3M)? Is this to create some
    2) Those damn spring "prototype" boards should be banned. Lots of
    inductance in each line and lots of capacitive coupling between lines.
    Trash it and get some "cheese boards" from Radio Shack (the small
    phenolic pre-drilled boards with copper donuts for soldering).
    I call them "cheese boards" because phenolic is so soft, brittle, and
    chee-eap (cheasie).
  3. Spajky

    Spajky Guest

    put a small capacitor (few 10 pf) between chip output & - input ...
    shoud prevent selfoscillating ...

    -- Regards, SPAJKY
    & visit site -
    Celly-III OC-ed,"Tualatin on BX-Slot1-MoBo!"
    E-mail AntiSpam: remove ##
  4. I read in that Robert Baer
    yes, it's recommended to stop oscillation. Why doesn't it in this case?
    I think there is far too much feedback, considering that the + input is
    biased to Vcc/1001. I'd recommend putting a 330 ohm in series with the
    ground end of the 3.3 kohm and connecting the feedback 3.3 Mohm to the
    top end of the 330 ohm. Maybe even lower than 330 ohm.
  5. Ted Wilson

    Ted Wilson Guest

    Hi Walter

    As already suggested, do away with the spring-clip breadboard - they
    have all sorts of parasitics that can really screw things up in
    applications like this. If I were you, I would build it as a
    rat's-nest to start with, keeping leads as short as practical, until
    you start to make some progress.

    If you're running off a single 9V supply, then you've got about 9mV
    hysteresis, which I don't think is excessive here.

    I'm not familiar with the TS393 but, be warned, some comparators can
    be absolute bitches to stablilise, (to the extent that there are a
    couple I will now no longer use)!


  6. Consider that there is positive feedback with an attenuation of 1001
    around what is potentially an amplifier with a gain of over 1001. This
    wouldn't matter if the amplifier was held in saturation by a bias of a
    volt or so, but it's only held by 9 mV (which might be 5 mV, depending
    on Vcc, which we aren't told). A switch-on transient, or even a random
    noise spike, is quite likely to push it into the linear region,
    whereupon the positive feedback makes it certain to oscillate.

    I haven't used the device the OP is using, but I don't have any trouble
    with 339s, or even the ancient but fast 710 (it's used in a piece of
    test gear I was trying to diagnose), in breadboards.
  7. Fred Bloggs

    Fred Bloggs Guest

    He should consider a much larger ac-feedback to push the comparator over
    and hold it over for a minimum amount of time. This is accomplished by
    paralleling the 3.3M feedback resistor with something like 1nF+R- split
    the 10K pull-up resistor to series 4.7K and run 1nF+47K series branch
    from the 4.7K junctions to the (+) input. Keep the 3.3M DC feedback from
    OUT to IN(+). The main thing here is that the capacitor 50us time
    constant smoothes the voltage dv/dt at its tail as the inputs approach
    small differential. This will quench oscillation due to self-sustaining
    transient response due to circuit construction-up to a point that is.
  8. Thanks for everyone's feedback. I will try the approaches suggested
    (hopefully this afternoon) and report back.

    Answers to some questions:
    - yes, Vcc is 9v (sorry, thought I'd said so).
    - The TS393 is STMicro's low-power CMOS equivalent to the LM393; apparently
    a clone of TI's TLC393, although the claimed specs are slightly better. The
    inputs have ESD protection diodes, so I can feed a ground-referenced AC
    signal in (through an appropriately high impedance) and not worry about
    adding DC bias or clamping it to not go below ground. I just detect the
    positive peaks and ignore the negatives.
    - yes, as John surmised, the reason for the positive feedback was to get
    hysteresis to reduce oscillation.
  9. I've been tinkering with some 741's and 393's lately and haven't had any
    oscillation problems using those white plastic solderless breadboards.
    Most resistor leads were full uncut length and no particular care with
    power connections or bypassing caps, just a nice fat electrolytic on the
    power rails. AFAICT, the only difference between my circuit and the
    OP's is that I didn't use the 393 near the ground rail like that.

    I used a 741 biased at 2.50V for high signal gain, the input signal is
    AC coupled into the 741. The output of the 741 is DC coupled to one
    input of the 393. The other input of the 393 is biased 10mV higher than
    where the 741 idles. Any AC signal fed to the 741 that comes out
    swinging at least 20mV generates a nice 5V squaire wave on the 393's
    output to be fed into a micro. Works great in my breadboarded
    ultrasonic range finder, it's been pinging my shack's ceiling for a
    couple of weeks. ;-)

    I think the OP should be more critical of his input by biasing the 393
    higher and avoiding feeding it an input that drops below Vss. Relying
    on input protection diodes is probably never a real good idea. Maybe
    the TS393 is inferior to the LM393 and more prone to oscillation?
  10. Mac

    Mac Guest

    You haven't shown any such serial high impedance. I was assuming that your
    input was going to go directly to the inverting terminal of the
    comparator. If that is the case, the diodes will blow your impedance when
    the signal goes negative. Probably there is an additional series resistor
    planned for the input? Or you are going to disconnect the 1M resistor from
    ground and feed the input through it?
    I'm sure a smaller hysteresis resistor would help. Did you put an
    oscilliscope or DC voltmeter (tricky!) on the inputs to see what they were
    doing? That is, is it possible that the input bias currents and offset
    voltages are conspiring together to put your two terminals right at the
    switching threshold?

    I'm too lazy to look at the datasheet for the part, but with 1 Megohm in
    series with the inverting terminal, you have one millivolt per nano-amp of
    bias current. Combine that with an unfavorable Voffset, and a small
    difference at the terminals (by design), and you might have a recipe for

  11. Yes, that's exactly the plan. For the sake of illustration, I omitted the
    input signal (since it doesn't have anything to do with the oscillation) and
    shorted it to ground. You're right that otherwise the diodes would blow.

    But remember that in the normal (output high) state, the power supply is
    draining through the hysteresis resistor. I can't get much smaller and keep
    my current budget.
    Yeah, I considered that. But you're right, it's hard to measure. The
    scope's input resistance of 1M is way too low. The ohmmeter should be okay,
    but it seems to skew things too. I thought about trying to hook up another
    opamp, but it would have the same issues.

    The TS393 is a CMOS comparator; it specs around 1pA of bias current. So
    induced bias voltage should still be in the uV range. Vos (specified at a
    max of 5mV) could be an issue; but that wouldn't cause instability, it would
    only change the region where it showed up, right? I sort of counted myself
    lucky that the oscillation was showing up for me now, rather than after I'd
    made a few dozen of these :)

  12. The TS393 is different in that it's a CMOS component, lower power than the
    LM393. (And higher input and output impedance, so probably more susceptible
    to random capacitances.) It might be inferior to a TLC393, TI's CMOS
    equivalent; its specs are better than the TLC393, but I don't necessarily
    trust specs.

    But, I tried it with bipolar rails, which is equivalent to biasing the
    inputs right in the middle of the power supply. Made no difference to the
    oscillation :-(

    And anyway, in the circuit where it's oscillating, I'm not feeding it an
    input signal; the input is shorted to ground. So it's sitting right at the
    rail, but not below; the diodes are not coming into play.

  13. James Meyer

    James Meyer Guest

    Just noticed that the device is a dual. Are you doing anything to the
    unused section to ensure that it is solidly forced on or off?

  14. Mac

    Mac Guest

    I would try probing the non-inverting terminal with the oscilliscope. What
    have you got to lose? Put the probe on AC coupling, or even use a
    capacitor in series with the probe. When you do this, does the oscillation
    go away? Get worse? Remain unchanged? What do you see on the scope? a 9mV
    sqare wave? ;-)
    It seems like you should have around 9mV at the non-inverting terminal
    when the output is low, and 18mv when it is high. That should be enough to
    exceed the offset volgate. Still, as an experiment, you could try using a
    smaler feedback resistor, or increase the 3.3k one. This would just be a
    diagnostic. Does this make the oscillation go away? I understand that you
    ultimately want a low-power solution, but you'll have to figure out what's
    going on first, which means you'll have to experiment. ;-)

    The other thing that sounded promising that someone suggested was adding a
    high-pass function to the feedback. That could be done without blowing
    your power budget.

    Good luck!

  15. I read in that Walter Harley
    More positive feed back could make matters worse. It depends whether
    your comparator is running into its linear (amplifier) region or not. I
    suspect that it is, and if so, you need less hysteresis, not more.
    OHMMETER?!! What ARE you doing?
    No. Your hold-off is only 9 mV nominally, and could easily be less, due
    to tolerances. 5 mV of offset could turn your comparator on, when it
    becomes an *amplifier* with positive feedback.
    Yes, that could have happened.
  16. Try the mods above? The f'back resistor has gone,
    the 3.3k is upped to 6.8k, the output pullup has
    increased to 100k, and with a 1uF from o/p to 0v.

    The 393 is slugged into a (sort of) 1/2-wave rectifier,
    with an 18mV threshold, fast attack and slow decay time.
  17. Okay, some more results... so far, negative.

    John W.: taking the feedback down (3.3M -> + in -> 3.3k -> feedback ->
    330R -> ground, where "feedback" is 3.3M from the output pin) didn't work.
    Still oscillates.

    Spajky: up to 47pF from output to - input, no change. Still oscillates.

    Fred B.: Taking an additional AC-coupled feedback from midway between Vcc
    and out, no change. Still oscillates. I used 10nF rather than 1nF as you'd
    suggested, but if I understand your logic, this should have still worked.

    Jim M: the unused comparator section has both inputs tied to ground, output

    Honest, I'm not trying to be ornery! This thing is very persistent... Mind
    you, it doesn't always oscillate as soon as I turn it on, but I can always
    provoke it into an oscillatory state, perhaps by turning it off and on
    repeatedly, perhaps by ungrounding and then grounding the input resistor,
    perhaps by touching a circuit node. Once it starts, it won't stop. The
    frequency varies between 500kHz and 2MHz depending on what circuit
    configuration I'm testing.

    I'm close to giving up and trying a different circuit approach, but it's
    annoying that I can't get such a simple thing to work! Before I give up:

    John W., I'll try even less feedback (100R instead of 330R).

    Mac, I'll give a look at the + input with the scope, AC-coupled.

    Tony W., I'll try the circuit you suggest, with the higher pullup resistor
    and the cap to ground.

    Again, thanks, everyone!

  18. Have you tried not using a feedback resistor at all? After looking my
    circuit over, I use negative feedback to establish the gain for my 741.
    I don't use any feedback on the 393. The 393 is intended as a
    comparator and AIUI doesn't behave exactly like other op-amps. Try it
    without the feedback resistor and see if that doesn't stop the

    Here's a couple of links that might be usefull to you:

    I also have a nice big TI pdf file with loads of op-amp theory and info.
    If you want I can e-mail it to you.
  19. James Meyer

    James Meyer Guest

    How about taking one unused input to ground and the other to the plus

  20. Fred Bloggs

    Fred Bloggs Guest

    You did this?
    Please view in a fixed-width font such as Courier.

    | | |
    | | |
    3.3M | 4.7k
    | | 1n |
    | | |
    | | 4.7k
    | | |
    | | |
    | |\| |
    +-----|+\ |
    | | >-----------+-->
    | | | |/|
    | | | |
    | | | |
    | | | |
    1M === 3.3k |
    | 47p | |
    | | | |
    | | | |
    | | | |

    If this oscillates then there is something fundamentally wrong that
    you're overlooking. Double check the pinouts, power the circuit with a
    9V batt, use a 0.1u ceramic for the bypass -not film, use ohmmeter to
    check that all components actually make a connection to corresponding
    pin on IC, verify component values, put all component GNDs right at the
    IC GND, cover circuit with foil, move it away from any signal
    generators, power supplies or anything else you have going on, use an
    isolated VOM to monitor output at first- and don't forget a dose of
    common sense.
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