Author Topic: Voltage Difference Detector (>100mV) from two different sources.  (Read 11927 times)

0 Members and 1 Guest are viewing this topic.

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Voltage Difference Detector (>100mV) from two different sources.
« on: February 23, 2014, 06:03:03 pm »
Hi,

I am trying to build a little circuit that will detect a voltage difference that is greater than 100mV
between any two batteries.  I though it would be easy but it turns out to be more complicated
than the project it will be used in...

I am using an opamp (lm358n) in its differential amplification setup in order to find the difference
of the voltages applied on its inverting and non inverting inputs.  I have built a little split supply
circuit which powers the opamp with Vcc+ and Vcc-

I am also using a custom voltage reference of 100mV with a 3.0V reference transistor and a
adjustable voltage divider.

I will be comparing the 100mV reference with the output of the differential opamp.
So far so good.  Everything works fine, but,

The problem is that the difference of the two sources could be either positive or negative,
depending on which opamp terminal you have connected the higher voltage source.
(I discovered that afterwards... that's why I've also built a split supply circuit.)

So my question is:
Is there an electronics configuration equivalent to the mathematics ABS(x) function?.
Or even better is there a way to do the same thing by powering the opamp with a single supply?

I have found the following solution but it uses two more op-amps (!) and a diode.
http://www.ti.com/lit/an/sboa068/sboa068.pdf

One of the authors is David Jones...   Synonymy?   :)

Thanks.
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #1 on: February 23, 2014, 07:47:41 pm »
Ok,

To answer my own question... it seems that there is no easy way around that problem.
A possible solution is the following IC from Analog Devices :

http://www.analog.com/library/analogdialogue/archives/44-04/absolute.html
http://www.analog.com/static/imported-files/data_sheets/AD8276_8277.pdf

So I would need the AD8276 to take the difference, then the AD8277 to take the absolute
value and finally a comparator to compare the result with a reference!  All these just to
check an absolute voltage difference. 

Arduino...
 

Offline joe912

  • Newbie
  • Posts: 8
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #2 on: February 23, 2014, 08:56:30 pm »
I see two ways to easily do it off the top of my head.
1. Do as you said but with two differential amplifiers.  One battery to the inverting input and one to the non-inverting inupt.  And on the other opamp reverse the inputs.  Take the outputs of both the amplifiers and feed them to seperate 100mV comparators and take those outputs to an OR gate.

2. Use a differential amplifier but shift the ground reference of the non-inverting side up to some voltage, say 1.0V. This should give you an output of 1.0V + voltage difference.  Take the output of that amplifier and feed it into a windowed comparator set at .9V and 1.1V.  See http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00050759.pdf section 6.

 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #3 on: February 23, 2014, 09:32:02 pm »
Hi,

Thanks for your suggestions.
Solution 1 uses too many parts as well as the one with the absolute value double op amps.

I like the second solution better.  I was trying to do something like that but I was not sure
about the "shifting the ground" part.  I assume that I will be able to use a single supply in
this way, correct?

Can you explain a bit more on how to shift the ground up?  Shall I use a voltage divider
and connect its output to the non inverting terminal as well, leaving R4 in place?   
(Node of R2 and R4 in the graph below?)




Thank you!
 

Offline joe912

  • Newbie
  • Posts: 8
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #4 on: February 23, 2014, 10:03:24 pm »
Take the ground pin of R4 and tie it to 1.0V.

I found this appnote from TI that talks about it too.
http://www.ti.com/lit/an/sboa038/sboa038.pdf
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #5 on: February 23, 2014, 10:08:32 pm »
I see, ok thanks.
I will try it.
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #6 on: February 24, 2014, 10:33:50 am »
Almost impossible to build with any reasonable accuracy for the 100mV range.

I cannot use a resistor divider to lift the ground because my supply will be a battery
and will range from 8.2V down to 6V.

I've tried to use the output from the 3V reference transistor so I can lift it up to 3V. 
I've connected the ground pin of R4 to the collector of the 3V reference but the 3V
becomes 2.770V and it is no longer stable when I change the supply voltage.
It changes about 30mV for the full range (8.2-6.0V)

No simple solution in the horizon.
Any other ideas?
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #7 on: February 24, 2014, 10:38:36 am »
Is a bipolar supply out of the question?
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #8 on: February 24, 2014, 10:44:14 am »
It will be a portable device so I would prefer to avoid including a split rail supply because most
of them divide the voltage in half.

Do you have any easy solution with a split rail supply?  Just curious...
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #9 on: February 24, 2014, 12:12:17 pm »
Sorry just read the thread properly, thought you were having a problem of driving near zero
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #10 on: February 25, 2014, 03:55:35 am »
I messed around a little with your circuit idea and come up with the attached.
Don't know if its got to many parts for your requirement but thought I'd give it a shot. Criticisms welcome as I am by no means an expert

V1 is the power supply and varying it from 8.2 to 6V still produces the desired output
V3 represents the differential voltage you are trying to discriminate and here it goes from -200mV to +200mV over 200ms.
U1 is the differential amp performing the subtraction and its "ground" reference is lifted to 1/2 the power supply by U3 which is used to provide a "lowish" impedance "ground"
U2 is the closest reference I could find in LTspice to your 3V ref so R8, R6, R5 and R10 will need to be modified to suit your ref voltage. R6 and R5 should be trimmers so you can adjust the "trip" points.
"out" is where the final output is at. It is high when the input voltage is within the tolerances and low when outside of them.

Also attached is the LTSpice asc file, just delete .txt off the end


The attached waveforms are all measured with reference to VG, the "virtual ground" created by U3. The output wave form is referenced to actual ground

It's just the basics in that I haven't fully stress tested it so I don't know how stable it is or if excessive currents exist in certain parts under certain conditions


« Last Edit: February 25, 2014, 03:57:18 am by AlfBaz »
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #11 on: February 25, 2014, 07:53:57 am »
Hi,

Thank you for taking the time to find a solution.  I will try the circuit on breadboard.  I don't
like simulators.  Many things can go wrong...

It looks like that in this version of the circuit I would have to use a lower value reference
voltage, something like 1.5V because its connected to virtual ground which has been lifted
to half the supply.  Near to 3V in the case of low battery.

What is the purpose of D1 and D2 at the output node?
Thanks.
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #12 on: February 25, 2014, 08:46:27 am »
What is the purpose of D1 and D2 at the output node?
Without them if one of the op-amps is driving low and the other driving high, as is the case when one of the thresholds have been passed, you have a short circuit.

PS
Let us know how it bread boards
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #13 on: February 25, 2014, 08:52:43 am »
It looks like that in this version of the circuit I would have to use a lower value reference
voltage, something like 1.5V because its connected to virtual ground which has been lifted
to half the supply.  Near to 3V in the case of low battery.
Given the predicted input and output swings are very small in comparison to the voltage supply range you may be able to get away with biasing the virtual ground point closer to 0V, giving you the head room your ref needs.

For example changing R12 to 50k will give you a VG of just over a volt
« Last Edit: February 25, 2014, 08:57:14 am by AlfBaz »
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #14 on: February 25, 2014, 09:32:11 am »
Quote
Without them if one of the op-amps is driving low and the other driving high, as is the case when one of the thresholds have been passed, you have a short circuit.
Indeed...

I will try it and report back the results.   :)
Thank you.
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #15 on: February 28, 2014, 05:40:16 pm »
The results are that I've managed somehow to kill the reference voltage transistor I had... :'(
LP2950CZ 3.0V

The output was quite unstable until I used a 1uF input and a 10uF output coupling capacitors.
After that the output was rock solid at 3.001V with loads up to 10mA.  To test it I was powering
another small circuit (with no capacitors. only a jfet and a couple of LEDs).  I am not sure how
I fried it.  From 4V to 6V it continues to regulate properly but after 7V its output increases
proportionally.  I guess that is a sign of a broken reference, correct?

Maybe I forgot to discharge the capacitors, I don't know.

What is the best way to protect a voltage reference?
Shall I put a protection diode from its output to its input?

Thanks.
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #16 on: March 01, 2014, 04:39:31 pm »
Hi,

I have replaced the reference voltage and the circuit almost works...

(I am using the circuit from Alfbaz, reply#10.  Virtual ground is produced by U3,
and Ref+ and Ref- values are measured from Th+, Th- relative to ground.
I am using the LP2950CZ 3.0V reference which has an input, an output and a ground pin.
Input is connected straight to Vcc (no R7 like in the schematic) and the ground to the
virtual ground from U3.  I have also decoupled the output pin of the reference with a
capacitor to ground.  I tried the virtual ground as well but I get the same problem)



While the 3V reference voltage, the virtual ground and the Ref +100mV voltages are pretty stable,
the Ref -100mV is not!  It changes in a linear way from 7V to 12V.

I cannot find the reason.   |O   Can somebody please help?

I have made a plot with all the measured voltages that shows the problem better.




The circuit works accurately only with the input voltage it was calibrated on.  By calibration I mean the
3V reference resistor divider that produces +100mV and -100mV above and below to the virtual ground.

From the graph you can see that the Ref+ is parallel and equidistant to Virtual Ground which means
that is always correct no matter the input voltage Vcc.  The problem is with Ref- that changes with
respect to Virtual ground!

The plotted line on the left graph should have been a straight horizontal line...
Can you please help me solve the puzzle?

« Last Edit: March 01, 2014, 07:01:13 pm by hgg »
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7369
  • Country: nl
  • Current job: ATEX product design
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #17 on: March 01, 2014, 11:08:41 pm »
I really wonder why you use opamps as comparators, while there are comparators. There is even the LM392 if you want to solve it with 80's technology.
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #18 on: March 01, 2014, 11:58:50 pm »
I really wonder why you use opamps as comparators, while there are comparators. There is even the LM392 if you want to solve it with 80's technology.
used the op-amps out of pure laziness. The circuit was meant as proof of concept rather than a final design and as is evident from Hgg's results the circuit seems to have fundamental flaws

I think the problem is voltage from the 3V ref to Vg is relatively fixed but from Vg to ground its changing proportionally to the supply as U3's output is dependent on it's input divider supplied from Vcc
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #19 on: March 02, 2014, 06:29:56 am »
I have replaced the reference voltage and the circuit almost works...
Does this mean you now have 2 refs?

If so, another hack to the circuit that should work is placing the second 3V ref as an input to U3. This will steady Vg regardless of Vcc's variation and give th- a decent reference.

You may even be able to do away with U3 altogether as I can't imagine the current drawn from this second reference to be any more than a couple of milliamps.

One problem you may re-encounter is as Vcc drops you may not have enough voltage drop across the reference feeding the divider. The data sheet for your device gives a worse case required difference of 600mV at 100mA load current so it may be a lot less in this case
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #20 on: March 02, 2014, 06:48:22 am »
Quote
another hack to the circuit that should work is placing the second 3V ref as an input to U3.

Alfbaz, you will not believe it, but I just woke up with the exact same solution!  :)
A good night sleep always helps!

The graph helped me to find the problem.  A single reference will provide a regulated Vref+ and when
passed through U3 a regulated Vgnd as well.  At least in theory.  I will try it in a while.  Breakfast time...
Thanks again!

NANDBlog thank you as well.  I will use comparators in the final stage of course.
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #21 on: March 02, 2014, 07:32:52 am »
What I thought was to use the single reference that I had for both Vcc and Vgnd but it
doesn't work that way...  Just tried it.

[/quote]Does this mean you now have 2 refs?[[/quote]
I had just one.  You are right though, I will have to use two different references because they will be
using different grounds.  I am not using shunt references but a 3V 100mA LDO so loading would
not be a problem I think. 

It becomes apparent why a precise multimeter is a must for electronics design.
The UT61E is not bad actually, but now I want more precision!  :)
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #22 on: March 02, 2014, 08:05:43 am »
It becomes apparent why a precise multimeter is a must for electronics design.
The UT61E is not bad actually, but now I want more precision!  :)
LOL, I have this urge to issue the mandatory warning about getting into precision.. Once you start...
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #23 on: March 02, 2014, 08:42:32 am »
Indeed!
The more you get involved in design the more you become a precision junky.   :)

There are however natural barriers that will stop you.  Like the astronomical prices of the
very precise multimeters...   :)

For the virtual ground reference I think I will use the  LM285Z-2.5 reference diode.
In the datasheet it says that it has a 0.6R dynamic impedance.  Does this mean
that I can bypass the opamp buffer and use it directly as a virtual ground?

(I am trying to build the circuit with the least parts as you can see...)
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #24 on: March 02, 2014, 09:49:54 am »
For the virtual ground reference I think I will use the  LM285Z-2.5 reference diode.
In the datasheet it says that it has a 0.6R dynamic impedance.  Does this mean
that I can bypass the opamp buffer and use it directly as a virtual ground?

(I am trying to build the circuit with the least parts as you can see...)
That part there can handle up to 20mA and I cant see a situation where the load for it will be anywhere near that, so yeah I can't see why you cant do away with the buffer
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #25 on: March 02, 2014, 09:59:27 am »
Great!  I will order some of them next week and try again.
Thank you!
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #26 on: March 03, 2014, 04:06:15 pm »
While waiting for the voltage references to arrive....

In the datasheet of the LM311 there is a way to balance its voltage offset error.  If you can use this
method and instead of balancing it, you make it higher up to 100mV then you can connect the two
input voltages and there you go!  You have a voltage difference detector with just one part. 
A dual comparator.  One voltage to one comparator and the other voltage to the other but with its
terminals reversed.
   Both voltages to both comparators but with their terminals reversed.

One problem though.   I cannot achieve an out of balance voltage greater than 30mV....




The potentiometers with the closest values I had where 1K and 10K.  The diagram uses a 3K.
Do you think that this might be the reason?

Do you know what is the maximum offset correction that the LM311 can take?
« Last Edit: March 03, 2014, 04:17:51 pm by hgg »
 

Offline hggTopic starter

  • Frequent Contributor
  • **
  • Posts: 960
  • Country: gr
Re: Voltage Difference Detector (>100mV) from two different sources.
« Reply #27 on: March 07, 2014, 06:41:46 pm »
I've tried, but its quite difficult to do it with only the offset error of the LM311.

Anyway, the 2.5V vref arrived and lifting the ground as well with a voltage reference did it.
Perfect rock solid +/- 100mV voltage difference detection!

Thank you guys for your help!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf