Discrete windowed voltage comparator

Discussion in 'The Projects Forum' started by davep, Aug 2, 2009.

  1. davep

    Thread Starter Member

    Aug 2, 2009
    11
    0
    I realise one option for this is to use a pair of comparators or something like an MC33161 (though RS Components doesn't stock these). For space reasons the Micro8 package (MC33161MD or MC34161MD) would be preferred if I do use this.

    However, I think it may be possible to implement this for the specific case I need using at most four surface mount transistors and possibly save some board space (or money).

    The specification is simple:

    Any voltage within +/- 200mV of ground is OK (you're allowed anywhere between [150mv, 210mv])

    Any other voltage is bad.

    Supplies available are: +7.5V, +5V, 0V (ground), -2V.

    Using a pure voltage source in the circuit (e.g. a battery of e.g. 0.4V or 0.8V) is not allowed.

    Output CMOS/TTL compatible (+5V, 0V).

    The fewer components the better the solution.

    Thanks
    Dave
     
    Last edited: Aug 3, 2009
  2. Oxbo Rene

    Active Member

    Feb 20, 2009
    200
    0
    Sure Dave,
    I'll get right on that ..........
     
  3. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    1) When the input is within ±200mV, should the output be zero volts, or +5V?
    2) What are the extremes of the input voltage (e.g., ±2V, ±5V, ±∞, etc.)?
    3) What does this mean?
    4) Shouldn't this have been posted in the Homework Help forum?
     
  4. davep

    Thread Starter Member

    Aug 2, 2009
    11
    0
    1) Honestly I don't really care - I can always add an inverter if I need one. Let's say +5V for within limits.

    2) The expected limits on the input voltage are [-6V, +0.5V] The datasheet for the original IC (now long obsolete and unobtanium) that I'm trying to replace says this is a grounded emitter input.

    3) Remnants of an early draft left in error - I will edit it out.

    4) I wish it were so :). It would be so nice to loose about 40 years. The comment on fewer components is purely a board space and cost problem.

    FWIW I've nothing against the MC33161 - but it would appear that no-one in the UK stocks them in the Micro8 package. An LM339 (SO-14) or pair of LM311s (2 * SO-8) is a lot of board space in the context of a piggy-back board plugged into an IC socket especially as there will also be quite a lot of logic on there as well (may need to use a GAL or similar rather than a load of 74HC chips).

    Cheers
    Dave
     
    Last edited: Aug 3, 2009
  5. davep

    Thread Starter Member

    Aug 2, 2009
    11
    0
    OK I understand if you don't wish to burn the cycles on this - I've been banging my head on it for a while. It's not a totally trivial problem especially as my current budget (about 28mA total) means I cannot afford (e.g.) 4mA to drive a very stiff voltage divider between ground and -2V.

    I've also considered an op-amp perfect rectifier followed by a comparator, but this is again a lot of board space. I'm pretty certain that this can be done the "old fashioned" way and save space at the same time - I just can't quite work out how.

    Thanks
    D.
     
  6. davep

    Thread Starter Member

    Aug 2, 2009
    11
    0
    The following theoretical circuit works, but the arbitrary voltage sources pose a real problem (see my comments in an earlier post about stiff dividers) for the 0.4V offset for the base of Q2, and I still haven't worked out how to get a 0.8V offset between the emitter of Q2 and base of Q1 (this is a floating offset, not one fixed relative to the rails).

    [​IMG]

    In this case OK input voltages give a 0V output at the collector of Q3, but as I said I can always add an inverter if necessary.

    Dave
     
  7. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    LM393 is a dual comparator, available in an 8 pin SOIC. Have you considered it?
     
  8. davep

    Thread Starter Member

    Aug 2, 2009
    11
    0
    Thank you for the suggestion of the LM393.

    As it happens, I'm already using an LM339 (as distinct from the 393 that you just suggested) for a pair of zero crossing detectors, so I do have a pair of comparators available. But there is a problem that both the LM339 and LM393 share:

    The Source/Emitter of the output Open Drain/Collector is tied to the negative supply. To able to set window comparator limits to [-200mV, +200mV] I would need to connect the negative supply to -2V. This would in turn mean that the output signal would swing from -2V to +5V. I forsee SCR latchup of the logic in rather a hurry if I were to do that.

    As it happens, I don't actually don't think I'll be using the spare comparator in the LM339, so your suggestion of the LM393 is very useful as I can replace the LM339 with an LM393 and get back some board space.

    Thanks again
    Dave
     
  9. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    You said that you need to have a CMOS/TTL compatible output (0V, +5V). Do you need to actually drive a TTL load, i.e., sink significant current when the output is low, or can the load be considered high impedance (i.e., CMOS)?
    You also wanted a solution with no more than 4 transistors. Will this really save space vs a 14 pin SOIC?
     
  10. Oxbo Rene

    Active Member

    Feb 20, 2009
    200
    0
    Apologies Dave;
    This thing you are working on and your skill level are, I'm quite certain, well above my very limited knowledge of electronics. I've been out of it for forty years, and when I was in it, I wasn't too crazy about it.
    I just didn't see any logical request and assumed it was just another of the many request that get asked on here (I want this, build it for me) type deals, and, happened to impulsively make a stupid comment.
    I generally keep my mouth shut, but occasionally open it and most times, find my foot in it.
    Have a nice day,
    Oxbo
     
  11. ifixit

    Distinguished Member

    Nov 20, 2008
    639
    108
    Hi Dave,

    Use a LM311 to build a standard window compartor circuit, it has a pin you can use to reference the output to gnd while -V is -2V and +V is +5V.

    Assuming the supplies are accurate enough you can get the ±200mV reference points with resistor dividers from the -2V and +5V rails to gnd. 1 mA of current each should be enough.

    A discrete transistor cct likely won't work well over temperature due to lack of gain.

    ifixit
     
  12. davep

    Thread Starter Member

    Aug 2, 2009
    11
    0
    You can assume it will be driving CMOS logic

    OK there's not a lot between four SOT-23s and an SO-8 or even an SO-14 to be fair. I don't think it *should* need more than four transistors - just can't work out how :).

    Yes, I know the LM311 has the emitter/drain pin available, and that this solution won't make the reference dance around in the way that a simple common emitter tied to -0.2V would. LM311 is SO-8 or DIP, and would do the job technically - no problem.

    To be honest the easy answer is to use comparators but I've now got the to the stage where I want to see how it could be done elegantly in discrete even if I do end up using those neat MC33161s (two comparators in an SO-8 or Micro-8 which can have below ground references with single rail supply) in the final product.

    Don't bank on it :).

    Dave
    Dave
     
  13. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    Here are two ways you could do it.
    The outputs are complementary to each other.
     
  14. davep

    Thread Starter Member

    Aug 2, 2009
    11
    0
    Thanks Ron,

    That confirms your view that that using e.g. a dual comparator will save space and component count - nice to see it can be done readily with discretes though.

    Thanks again
     
  15. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    The 393 version will have more gain. Both will have jitter if the input hovers at one of the threshold voltages.
     
  16. davep

    Thread Starter Member

    Aug 2, 2009
    11
    0
    Indeed the comparator will more decisive, and jitter can readily be resolved with a touch of +ve feedback.

    Thanks again
     
Loading...