Discrete windowed voltage comparator

Thread Starter

davep

Joined Aug 2, 2009
11
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:

Ron H

Joined Apr 14, 2005
7,063
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?
Any voltage for various reasons I'd like to have a function windowed voltage comparator.
4) Shouldn't this have been posted in the Homework Help forum?
 

Thread Starter

davep

Joined Aug 2, 2009
11
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:

Thread Starter

davep

Joined Aug 2, 2009
11
Sure Dave,
I'll get right on that ..........
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.
 

Thread Starter

davep

Joined Aug 2, 2009
11
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).



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
 

Thread Starter

davep

Joined Aug 2, 2009
11
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
 

Ron H

Joined Apr 14, 2005
7,063
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?
 

Oxbo Rene

Joined Feb 20, 2009
201
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.
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
 

ifixit

Joined Nov 20, 2008
652
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
 

Thread Starter

davep

Joined Aug 2, 2009
11
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.

This thing you are working on and your skill level are, I'm quite certain, well above my very limited knowledge of electronics.
Don't bank on it :).

Dave
Dave
 

Thread Starter

davep

Joined Aug 2, 2009
11
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
 

Ron H

Joined Apr 14, 2005
7,063
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
The 393 version will have more gain. Both will have jitter if the input hovers at one of the threshold voltages.
 

Thread Starter

davep

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

Thanks again
 
Top