Author Topic: Comparators output when both inputs are at same potential  (Read 11934 times)

0 Members and 1 Guest are viewing this topic.

Offline HSPalmTopic starter

  • Regular Contributor
  • *
  • Posts: 106
  • Country: no
Comparators output when both inputs are at same potential
« on: March 08, 2017, 09:10:09 am »
What is a comparators output when both inputs are at the same potential? Could be anything, depending which way that particular comparators offset voltage swings?

What I want is a detection circuit that detects whether current is flowing in a conductor or not. So I drop a current sensing resistor in line with the voltage supply and use the voltage drop across it as inputs on the comparator. But with no current flowing, the inputs will be at the same potential (or will the input impedance of the comparator load the resistor?), can I count on the comparators output to switch between load/no-load?

I attached a picture of the basic circuit in question. I gladly take suggestions on alternatives, too.
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4228
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Comparators output when both inputs are at same potential
« Reply #1 on: March 08, 2017, 09:15:05 am »
The answer is 'it depends', on the type of comparator, the day of the week, the temperature, ambient electrical noise, and any other factor which can possibly influence an electronic device. If you simply connect a comparator across a sense resistor, the output at zero current will be unpredictable.

Normally a comparator circuit will employ a small amount of hysteresis to avoid this. Have a read on this general topic, and I think you'll find the answers you're looking for.

Offline HSPalmTopic starter

  • Regular Contributor
  • *
  • Posts: 106
  • Country: no
Re: Comparators output when both inputs are at same potential
« Reply #2 on: March 08, 2017, 09:30:02 am »
The answer is 'it depends', on the type of comparator, the day of the week, the temperature, ambient electrical noise, and any other factor which can possibly influence an electronic device. If you simply connect a comparator across a sense resistor, the output at zero current will be unpredictable.

Normally a comparator circuit will employ a small amount of hysteresis to avoid this. Have a read on this general topic, and I think you'll find the answers you're looking for.

Thanks Andy, looking into it now.
Am I wrong thinking that I'm over-complicating things? If there was a mosfet with ultra low Vgs-on that would be ideal, but of course it doesn't exist. I just need a logic high when current passes through a conductor, I feel I'm overlooking something.
 

Offline kg4arn

  • Supporter
  • ****
  • Posts: 271
  • Country: us
Re: Comparators output when both inputs are at same potential
« Reply #3 on: March 08, 2017, 10:36:37 am »
Maybe try a different architecture. Amplify the shunt voltage drop with a difference amplifier. Follow this with a comparator referenced to a stable voltage and implemented with proper hysteresis. Just a thought. I don't know how the pros do it.
 

Offline daqq

  • Super Contributor
  • ***
  • Posts: 2302
  • Country: sk
    • My site
Re: Comparators output when both inputs are at same potential
« Reply #4 on: March 08, 2017, 12:04:38 pm »
When both values are equal (assuming there is no hysteresis built in the comparator) you will get an unknown state that will depend on the comparator. With one that has a hysteresis you will get the previous state.

Quote
I just need a logic high when current passes through a conductor, I feel I'm overlooking something.
Well, there are other methods you can use for current sensing that do not have a voltage drop, such as hall effect current sensors. Or there are various current sensing ICs that are great for this purpose. They are generally some kind of shunt resistor amplifier. See: http://cds.linear.com/docs/en/application-note/an105fa.pdf for a few hints.

That said, assuming you have a microcontroller available, there are plenty of them that have a built in good ADC with an amplifier that could be used for something like this (though you'd have to respect the maximal voltage).

Please also note that the LM393 has an open collector type output.
Believe it or not, pointy haired people do exist!
+++Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Comparators output when both inputs are at same potential
« Reply #5 on: March 08, 2017, 12:13:53 pm »
One method could be detection of the physical connection
of the load, like its presence, or a wire connected. Via use
of a photo detector or photo reflector solution.

Other methods could be TDR test of connection. Or simple AC
detection of additional capacitance.


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 5871
  • Country: de
Re: Comparators output when both inputs are at same potential
« Reply #6 on: March 08, 2017, 12:20:11 pm »
You'll need to be more specific.

You need to define a threshold that sets a no current/current limit. When you've defined that, you can start playing around with input biasing and hysteresis.

 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Comparators output when both inputs are at same potential
« Reply #7 on: March 08, 2017, 12:27:42 pm »
You need to define the minimum detectable current.
Then you offset the comparators input by some mV using some resistors. The offset puts the comparator into the "off" state if no current flows, if the current is large enough to provide enough mV in the other direction, the comparator turns "on". You'll have to take the comparators inherent offset and hysteresis voltage into your calculations. Say, if you can provide about >= 15mV voltage drop over the resistor at minimum detectable current, this approach should work.
Safety devices hinder evolution
 

Online BrianHG

  • Super Contributor
  • ***
  • Posts: 7733
  • Country: ca
Re: Comparators output when both inputs are at same potential
« Reply #8 on: March 08, 2017, 12:49:37 pm »
How much current do you need to detect and how much power do you need to pass?

 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1438
Re: Comparators output when both inputs are at same potential
« Reply #9 on: March 08, 2017, 02:29:49 pm »
Hi,

The output state of a comparator when it's two inputs are exactly the same voltage is zero (a low) in theory and that is because of the internal gain that will not have anything to amplify, however in practice the output state is simply undefined.  What this 'undefined' means is that you have to change the circuit a little to make sure that condition is avoided completely.  This is not hard to do and has been done for years now, and that is to add some positive feedback which adds hysteresis to the comparator.  There's no reason why this wont work unless you have a lot of noise.

The way to add hysteresis is to add a large value resistor from the output of the comparator to the non inverting input, but making sure that the non inverting input has some resistance in series with it so that the hysteresis resistor can change the non inverting input voltage when the output changes state.  For a really quick example, say a 1k series and 100k feedback resistor which would add about 1 percent hysteresis.  This should not affect the circuit too badly and will also keep it from constantly flipping states when there is some noise present.

In any circuit that detects current you probably dont want to detect 1 picoamp anyway, you probably want to detect something like 1ma or more.

Another important consideration is the initial current setting, size of sense resistor, and offset drift.
Whenever you set it to a certain value you are depending on the offset voltage to stay constant.  This might not happen with the wrong choice of op amp or comparator part number.  Your sense resistor has to drop enough voltage to allow the comparator to detect it properly over the expected temperature change.  For some current levels this means that the circuit goes from hobby level to precision level, where the circuit has to be carefully designed, taking all aspects of the comparator into consideration as well as specifics about the environment.

Just to note, there are some very low input offset and low drift op amps out there, which might be a better choice than using a run of the mill comparator.

Last but not least, the speed of response may be important so you have to look into that also.  This is basically about how fast you need to detect that current once it does appear.

« Last Edit: March 08, 2017, 02:35:10 pm by MrAl »
 

Offline HSPalmTopic starter

  • Regular Contributor
  • *
  • Posts: 106
  • Country: no
Re: Comparators output when both inputs are at same potential
« Reply #10 on: March 08, 2017, 03:19:28 pm »
Thanks guys, lots of great help I've gotten here.

The current will vary some because the load is not something fixed, but >100mA for sure will do the trick. The sense resistor is not yet decided upon, but I want to keep it low enough value so I can chose 0603 size and not worry about power rating. But the sense resistor must also be large enough so the voltage drop is considerably larger than the comparator offset voltage. I played around with LT1011 in LTSpice but I cannot get it to switch its output. I have traced both inputs with respect to ground and they cross each other with +/- 7mV on each side which should be more than sufficient with a max Voffset on LT1011 of 0.5mV?
 

Offline Fgrir

  • Regular Contributor
  • *
  • Posts: 154
  • Country: us
Re: Comparators output when both inputs are at same potential
« Reply #11 on: March 08, 2017, 03:30:08 pm »
The comparator won't work properly with both inputs (7V) above it's supply voltage (5V).  You need at least 0.8V headroom over the entire operating temperature range.

EDIT: That 0.8V headroom requirement is for the LT1017 shown in your circuit.  For the LT1011 you mention in your post you'd need 1.5V.
« Last Edit: March 08, 2017, 03:38:14 pm by Fgrir »
 

Offline HSPalmTopic starter

  • Regular Contributor
  • *
  • Posts: 106
  • Country: no
Re: Comparators output when both inputs are at same potential
« Reply #12 on: March 08, 2017, 05:09:55 pm »
The comparator won't work properly with both inputs (7V) above it's supply voltage (5V).  You need at least 0.8V headroom over the entire operating temperature range.

EDIT: That 0.8V headroom requirement is for the LT1017 shown in your circuit.  For the LT1011 you mention in your post you'd need 1.5V.

Oops, I chose another comparator in the component list and forgot to switch datasheet.
Thank you, that did the trick. Now I have a setup to experiment with.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 5871
  • Country: de
Re: Comparators output when both inputs are at same potential
« Reply #13 on: March 08, 2017, 06:20:52 pm »
Quote
The sense resistor is not yet decided upon, but I want to keep it low enough value so I can chose 0603 size and not worry about power rating.

Good luck with finding 0603 0.033 ohm parts.

 

Offline Fgrir

  • Regular Contributor
  • *
  • Posts: 154
  • Country: us
Re: Comparators output when both inputs are at same potential
« Reply #14 on: March 08, 2017, 06:32:34 pm »
Good luck with finding 0603 0.033 ohm parts.
A quick search on Digi-Key shows 8 different choices in stock, not sure what you think the problem will be...
 

Offline HSPalmTopic starter

  • Regular Contributor
  • *
  • Posts: 106
  • Country: no
Re: Comparators output when both inputs are at same potential
« Reply #15 on: March 09, 2017, 08:40:25 am »
I always go for E12 series passives, even though I know in most cases E24 and other oddities won't add much extra cost. I don't see the problem here either.

A quick search on Digi-Key shows 8 different choices in stock, not sure what you think the problem will be...
9 if you don't filter by cut-tape packaging :)
« Last Edit: March 09, 2017, 09:15:05 am by HSPalm »
 

Online BrianHG

  • Super Contributor
  • ***
  • Posts: 7733
  • Country: ca
Re: Comparators output when both inputs are at same potential
« Reply #16 on: March 09, 2017, 09:18:58 am »
I was going to recommend changing your resistor and comparator for a diode and PNP transistor with 2 resistor, but since you say you only have room for a single 0603 resistor and my solution would mean you loose 0.7v on your 7v source, I think this isn't for you.
 

Offline HSPalmTopic starter

  • Regular Contributor
  • *
  • Posts: 106
  • Country: no
Re: Comparators output when both inputs are at same potential
« Reply #17 on: March 09, 2017, 10:28:28 am »
I was going to recommend changing your resistor and comparator for a diode and PNP transistor with 2 resistor, but since you say you only have room for a single 0603 resistor and my solution would mean you loose 0.7v on your 7v source, I think this isn't for you.

Could you elaborate a bit more? I'm trying to keep component count and component size down, in general. With current sense resistor, correct biasing and hysterises I'm up to 4 resistors.
 

Online BrianHG

  • Super Contributor
  • ***
  • Posts: 7733
  • Country: ca
Re: Comparators output when both inputs are at same potential
« Reply #18 on: March 09, 2017, 11:41:00 am »
My idea was: (Using symbols from your first schematic)

Tie the Emitter of a PNP transistor to VCC in your circuit.
Tie the Base of the transistor to 7V in your circuit.
Tie a 1k ohm resistor between the Base and Emitter.
Tie a 10k resistor from the Collector to GND.
The Collector of the transistor is now your EN signal.

When you have an electrical load on the 7V, it will pull the Base down, by maximum 0.8v (Base to Emitter acts like a diode here), switching on the transistor pulling up the EN to VCC.

Notes about this circuit:
1.  Choosing a sot-23 transistor like DSS5320T-7 will allow you to drive no more than 300ma safely on the 7V.  You can add a silicon diode & series resistor + additional resistor to the base with a cheaper 2N3906 to raise this maximum current, but it is 3 more parts.
2.  For the 1k, this circuit will sense loads beginning at 1ma, if you want to lower this sensitivity, change the 1k to a 100 ohm.
3.  For the EN output, since your VCC might be more than 5v, add a resistor divider there to create a logic safe output level.

When not driving any load on 7V, this circuit consumes 0 power.  This is good for battery powered apps where you want to interrupt and wake up a CPU.

 

Offline HSPalmTopic starter

  • Regular Contributor
  • *
  • Posts: 106
  • Country: no
Re: Comparators output when both inputs are at same potential
« Reply #19 on: March 09, 2017, 11:48:18 am »
My idea was: (Using symbols from your first schematic)

Tie the Emitter of a PNP transistor to VCC in your circuit.
Tie the Base of the transistor to 7V in your circuit.
Tie a 1k ohm resistor between the Base and Emitter.
Tie a 10k resistor from the Collector to GND.
The Collector of the transistor is now your EN signal.

When you have an electrical load on the 7V, it will pull the Base down, by maximum 0.8v (Base to Emitter acts like a diode here), switching on the transistor pulling up the EN to VCC.

Notes about this circuit:
1.  Choosing a sot-23 transistor like DSS5320T-7 will allow you to drive no more than 300ma safely on the 7V.  You can add a silicon diode & series resistor + additional resistor to the base with a cheaper 2N3906 to raise this maximum current, but it is 3 more parts.
2.  For the 1k, this circuit will sense loads beginning at 1ma, if you want to lower this sensitivity, change the 1k to a 100 ohm.
3.  For the EN output, since your VCC might be more than 5v, add a resistor divider there to create a logic safe output level.

When not driving any load on 7V, this circuit consumes 0 power.  This is good for battery powered apps where you want to interrupt and wake up a CPU.

Thanks Brian. I was ready to sketch up this suggestion when I felt the need to ensure we're on the same page.
7V on my first schematic is the supplied voltage. VCC is where I will hook up a load after the sense resistor, there is no other supply at VCC.
 

Online BrianHG

  • Super Contributor
  • ***
  • Posts: 7733
  • Country: ca
Re: Comparators output when both inputs are at same potential
« Reply #20 on: March 09, 2017, 11:53:02 am »
Then you need to swap the VCC and 7V in my instructions.  If you like, draw up a schematic to verify first.  Though, getting it backwards wouldn't do much...
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19520
  • Country: gb
  • 0999
Re: Comparators output when both inputs are at same potential
« Reply #21 on: March 09, 2017, 01:25:27 pm »
What's the supply voltage to the LM393?

Note that the LM393 needs both of its inputs to be 2V below its power supply voltage to work properly.
 

Offline HSPalmTopic starter

  • Regular Contributor
  • *
  • Posts: 106
  • Country: no
Re: Comparators output when both inputs are at same potential
« Reply #22 on: March 09, 2017, 01:58:58 pm »
Then you need to swap the VCC and 7V in my instructions.  If you like, draw up a schematic to verify first.  Though, getting it backwards wouldn't do much...
Sorry Brian, I don't seem to be able to put together anything reasonable from your description. Would you mind rather telling me how the circuit is intended to work? For the most part I'm wondering where you get the 0.8V voltage drop, without limiting the output current.


What's the supply voltage to the LM393?

Note that the LM393 needs both of its inputs to be 2V below its power supply voltage to work properly.
Thanks, it was already suggested and it did the trick raising its supply voltage.

 

Online BrianHG

  • Super Contributor
  • ***
  • Posts: 7733
  • Country: ca
Re: Comparators output when both inputs are at same potential
« Reply #23 on: March 09, 2017, 02:32:25 pm »
Ok,

If you were to tie 7 volts to the Emitter of a PNP transistor,
Connect a load, say a lamp, to the Base of that transistor, and the other side of the lamp to the GND,
The voltage the lamp connected to the Base will be getting 6.3v, that is the internal switch on voltage of the Base, IE, the 1 diode voltage drop.  The lamp will receive 6.3v instead of 7v, but, it will always stay on.

Now, when I say that you shouldn't go above 300ma, IE, a strong lamp, you will burn out the transistor, both in heat and Base-Emitter junction.

If you don't connect anything to the Base, the Collector (current sense output) is freely pulled down to GND by the 10k resistor in my design, but, if you connect the lamp to the Base, this pulling down on the base turns on the transistor and pulls the output Collector to the 7v connected to the Emitter.  This is your load sense output.  With a connected load/lamp, the base is turned on and the Emitter goes high.  (If you run this at 7v, then the high output will be 7v.  If you are feeding a logic level MCU, a series resistor may be used is the MCU input has diode clamps, or, 2 resistors on the output using the center tap will divide the output voltage to a safe level in place of the 10k.) 

You should be able to try this out with a 2N3906, however, with that transistor, make sure your load, IE lamp doesn't go above 50ma, or the transistor will blow.

Once you are comfortable with this, we can take a look at adding either a power diode or just a beefier transistor if you need to support loads of 1 or more amps.

There is no comparator in this design.  The transistor is your comparator...
« Last Edit: March 09, 2017, 02:44:17 pm by BrianHG »
 

Online BrianHG

  • Super Contributor
  • ***
  • Posts: 7733
  • Country: ca
Re: Comparators output when both inputs are at same potential
« Reply #24 on: March 09, 2017, 03:02:51 pm »
As for the comparator design, if you can place the Rsense resistor to the GND instead of the 7v, then all you need is a 5v comparator with 0v support inputs.  As for the + input on the comparator, just place a resistor to GND and another to the 5v and you should get a switch working once enough Rsense goes high enough.  This circuit also allow you to use any voltage for 7v like my transistor design since the comparator only needs 5v, or 3.3v if you have a 3.3v, or even less mcu supply.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf