# LM2903N differential op-amp

#### dembkomj

Jul 9, 2014
6
Hi,
I have a project in which I have two analog DC voltages at different levels, let's say 10V and 2V. I want to have a circuit that takes the difference of these two voltages and produce a single DC voltage, in this case 10-2= 8V DC. I'm a mechanical engineer with basic electrical background, however this is literally my first circuit dealing with op amps. I've built many 12 & 24V DC circuits dealing with relays, resistors, switches, etc, but I'm trying to branch out into the IC world a bit.

After browsing for a chip that would do this voltage subtraction, I purchased some LM2903N dual differential op amps from Mouser.com, and tried one of them out on a solderless breadboard. I wired this up per the spec sheet as such:

Pin 1 = output
Pin 2 = IN1(-)
Pin 3 = IN1(+)
Pin 4 = GND
Pin 5 = not used
Pin 6 = not used
Pin 7 = not used
Pin 8 = 12V DC supply from a "wall wart", 1A rating on it

I'm really just trying to bench test this op-amp by itself before I incorporate it into the rest of my design, however my simple bench test proved that it did not give me the result I was looking for.

Using a Fluke 87V multimeter, I measured 11.4V DC between Pin 8 and Pin 4 of the amp (I have a 1N4004 diode downstream of my power supply for reverse polarity protection). This checked out OK. I then measured 10V DC between Pin 2 IN1(-) and Pin 4, and 2V between Pin 3 IN1(+) and Pin 4, so I know my two inputs are what they should be. However, when I checked the output Pin 1 relative to ground Pin 4 I measured 0.00V. I switched the voltages of Pins 2 and 3 relative to each other to see if that made a difference and I measured Pin 1 to Pin 4 again but got about 0.25V to 0.3V, still not the 8V differential I was expecting to see. I varied the 2VDC by a few volts but the measurement at the output did not move around.

I did not put any external resistors attached to any of the pins of this amp, since I don't want any voltage drop going to the two inputs, I want them to be exactly what they are. Plus the spec sheet states a max input voltage of -0.3 to +36V, and I'm within that window.

Did I understand correctly that a differential op amp produces an analog voltage output that's basically voltage 1 minus voltage 2? I'm sure I'm missing something fundamental here. Could it be my Fluke voltmeter is consuming too many amps when I take my measurement of the output pin? What am I doing wrong or what can I do to produce the results from above? Again, I'm about as rookie as it comes to this stuff, I'm just trying to get me feet wet with the knowledge I have already regarding DC circuitry.

Thanks,
Mike

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
12,516
Hello Mike, welcome to our forum.

There are three mistakes at work here:

1. The LM2903 is not an operational amplifier, it is a comparator. The main difference being that a comparator compares (small wonder) two input voltages and generates a logic level output signal (either logic high which is approx. Vcc or logic low which is approc. 0V) only. It does not amplify in the typical sense.
2. The output of the LM2903 is a so called open collector output. It can go to 0V and draw current, but it cannot source current for a high output voltage. A Pull-Up resistor will be required.
3. Even a real operational amplifier (e.g. the venerable µA741) cannot be used in this way to subtract voltages. An operational amplifier's gain at low frequencies (incl. DC) is on the order of 1000000 or more. Even a tiny voltage difference of 1µV will drive the output all the way to either Vcc or ground (give or take a few hundred millivolts).. You will need a difderential amplifier. This is not diffcultto build from an operational amplifier, see for example here.
Harald

#### BobK

Jan 5, 2010
7,682
The LM2903 is a comparator. It will output a high voltage if the + input is greater than the - input and a low voltage if reversed.

Any op amp can be used as a differential amplifier. It does, however require a specific circuit, like this:

http://www.electronics-tutorials.ws/opamp/opamp_5.html

Edit: Harald beat me to it. All good info there.

Bob

#### dembkomj

Jul 9, 2014
6
Thanks for the insight guys. I didn't even pick up on the fact I'm using the wrong piece of equipment. I saw the word "differential" in the spec sheet and jumped the gun. I searched differential amplifier on Mouser and found some components, however I saw that you have to pay several dollars for these as compared to less than a dollar each for an op amp and a few cents from resistors. It looks like the differential amp is more of a out of the box solution (you pay for it in cost) compared to using resistors and the standard op amp.

Anyways, I'm already using a LM358N dual op amp in some circuitry downstream in the circuitry, would this do the job or should I go for the µA741? It looks like the only benefit of the LM358N is that it can support two sets of inputs, and I only need the one. I have one spare LM358N on hand, so it looks like I will at least try that out using the resistor set up suggested by Harald.

If I want unity gain it looks like I want R1=R2=R3=R4. I will give this a try in a little bit a share my results. Thanks again for your helpful comments.

Regards,
Mike

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
12,516
An LM358 will be fine as long as you observe the operating conditions according to the datasheet.
Most notable among these are:

• Common modfe input votage range = Vcc-2V
• High level ouput voltage = 26V @ Vcc=32V -> Vccc-4V
• Low level output voltage = 20mV

#### dembkomj

Jul 9, 2014
6
Hi guys,
First off thanks for the help. I was able to construct the differential op amp circuit and have had good initial results. All four resistors in my circuit are equal, therefore I have unity gain. I have attached some measurements, and have been able to get the Vout=V2-V1 for the most part.

However, you will see that I can't get my Vout to get down to 0V, but it's getting clipped at around 0.8V. You will see my measurements of V2, V1, and Vout, all measured on the pins of the amp by my oscilloscope. I then added an expected Vout result by manually taking the difference of V2 and V1. As you'll see, the measured Vout doesn't follow the calculated result down to 0.0V. I do not understand why that is happening, I tried swapping out the LM358 but obtained the same results. I did not measure it, but my Vcc with respect to ground is about 13V DC. Does something on the spec sheet relate to the voltage limiting? Do I need another model op amp?

Thanks again.
Mike

#### Attachments

• lm358_measurements.zip
588.9 KB · Views: 126

#### LvW

Apr 12, 2014
604
Mike, I´ve got the impression that you are using a single supply voltage. Correct?
And - at the same time - you expect an output as low as 0 volts?
In any case, it would be best to show us your circuit including supply voltages.
The we can try to solve your problem.

#### dembkomj

Jul 9, 2014
6
You'll see below and in the schematic I have a main 12V power supply that powers the amp, and powers two pressure sensors thru a 5V converter. The 5V converter is from this manufacturer:

http://www.riorand.com/automotives/...-5v-10a-50w-power-supply-for-car-vehicle.html.

Here's a basic schematic of my circuit. I have a main 12V (actually about 13-14V) DC power supply that supplies power to the LM358 op amp. This same power supply goes into a 12V to 5V converter (, and the steady 5V is the excitation voltage for two pressure sensors. The ground between the main power supply and 5V converter is common. This ground also is connected to the ground pins of the pressure sensors. The pressure sensors are scaled for 0-60 psi, with a +0.5-4.5V output signal. I am sending the outputs of the two pressure sensor voltages into the op amp, and I the Vout of the amp will tell me the difference in voltage of my two sensors, which I can then correlate with differential pressure between the sensors.

I'm using 1k ohm resistors on the op amp due to the fact that each sensor can source 2.5mA max. R=V/I = 4.5/0.0025 = 1800. Divide that by 2 gives 900 ohms for each resistor value in the amp arrangement. The closes value I had on hand were the 1k ohm resistors. These have a 5% tolerance, so I've measured the true values of each resistor. R1=983, R2=958, R3=978, R4=958.

While typing this response, I thought that maybe I needed to feed each pressure sensor output signal thru another op amp in a buffer configuration, and then into this differential op amp. This did not affect the results any. Note, my measurements from above were measuring the pressure sensor output voltage signals before they went into the R2 and R3 resistors.

Regards,
Mike

#### Attachments

• differential pressure voltage switch.jpg
29.4 KB · Views: 235
Last edited:

#### Laplace

Apr 4, 2010
1,252
The source of the problem may arise from the sink current specification for the LM358. See highlighted portion of attached datasheet.

It may be necessary to increase the value of the resistors by a factor of a thousand or more to reduce the sink current to a few microamps. Alternatively, use a dual polarity power supply (±12 V) and ground reference the sensor signals.

#### Attachments

• LM358_Sink-Current.png
117 KB · Views: 196

#### dembkomj

Jul 9, 2014
6
What about connecting a 10k ohm pull down resistor from the output of the amp to ground (0V)? I've read some other examples where this was not done, and the Vout would only get down to 0.6V or so, but adding the pull down resistor brought it down to 0V or very close, within a few mV.

#### Laplace

Apr 4, 2010
1,252
A pull down resistor may help somewhat if the sink current is reduced to the microamp range. But I would go for the second wall wart instead.

#### dembkomj

Jul 9, 2014
6
Laplace, this morning I substituted all of my 1k ohm resistors with 2.2M ohm resistors and magic, it works now! I did not need to add a pull down resistor nor a second wall wart. I can get the differential voltage out to get low as 0.008V, which is perfect for my application.

Thanks everyone. With me being new to IC's, I'm realizing the countless possibilities with op amps alone, I think they are the next best thing since sliced bread.. Being a mechanical engineer, I'm used to working with designs I can see and understand. It literally boggles my mind how these IC's are manufactured and how they can fit all of this micro circuitry in a package so small. Simply amazing!

Take care,
Mike

#### BobK

Jan 5, 2010
7,682
I'm using 1k ohm resistors on the op amp due to the fact that each sensor can source 2.5mA max. R=V/I = 4.5/0.0025 = 1800. Divide that by 2 gives 900 ohms for each resistor value in the amp arrangement. The closes value I had on hand were the 1k ohm resistors. These have a 5% tolerance, so I've measured the true values of each resistor. R1=983, R2=958, R3=978, R4=958.
This is where you went wrong. The resistors should be LARGER than one that would draw 2.5mA over the full voltage range, otherwise the sensor will not be able to provide the current needed through the resistor to make the voltage difference between the two sensors.

R = V / I
R = 5 / 0.0025 = 2000

Anything larger than 2000 should work okay. I would have used 4.7K or 10K.

Bob

#### Laplace

Apr 4, 2010
1,252
Anything larger than 2000 should work okay. I would have used 4.7K or 10K.

That would help to keep the sensor output linear rather than going into saturation. However, the problem was not a non-linear sensor but rather whenever the measured inputs were nearly equal and the difference output was expected to be near zero. The output of the op-amp would never go to zero.

#### BobK

Jan 5, 2010
7,682
Except that it went only to 0.8V, which is way higher than need be, and after making the resistors larger it started working, not quite to zero but close enough.

Bob

#### Laplace

Apr 4, 2010
1,252
...not quite to zero but close enough.

So would the output have been close enough to zero with 4.7K resistors?

#### BobK

Jan 5, 2010
7,682
Not sure, but at least the current draw would not exceed the specs of the sensor.

Bob

#### 808Dave

Oct 3, 2014
14
I came upon this thread while looking for a circuit to use to adapt 12V pressure transducers to replace typical variable-resistance types that have been around in the automotive world for so long. I've got a problem with chronic failure of those older versions, when used with biodiesel in particular, since it's SO good at making glop out of many kinds of rubber that are otherwise considered "fuel resistant." Anyway, a few ebay sellers list a wide variety of 0.5-4.5VDC senders that have no "rubbery" parts to begin with (or so they claim). So my challenge is to adapt such senders to one or two gauge scenarios. One uses the aforementioned, old-school, purely-resistive sender type. IIRC it wants to be connected to a sender with something like a 90-0 ohm range, or thereabouts - 90 ohms when relaxed, and 0 when at full rated pressure. The second gauge I still need to select, but would like it to be a generic LED panel-voltmeter. I'm thinking I'd somehow calibrate it to read "0" (volts, for psi) at sender input of 0.5V, and "30" (volts, for psi) at 4.5V sender input.

The circuit above from Mike/dembkomj looks like it might be close to what I need, and offer some nice extras for my second application, once it's 'fixed' with the larger matching resistors per discussion. That fix would be based on whatever my sender/sensor current max is, yes? Anyway, I am thinking I could use this to check fuel pressure on either side of a fuel-filter (these are prone to clog quickly under some circumstances) as well as to directly check the differential pressure across the filter, which would be awesome, simply telling me whether I need to change a fuel-filter, or leave it alone and see what's stopped my fuel pump back in the tank, etc. Is that circuit indeed applicable to my needs?

Also, wanted to confirm that a "regulated" supply isn't really needed for the op-amp power as is shown the circuit - vs typical vehicle battery-alternator power, since spec sheet shows Vcc OK for a wide input range.

And would a 7805 be my best bet for the +5V to the new senders, since I won't need to handle much current?

For the first application (resistive sender) I am now realizing I should dig into the gauge a little to see what the basic movement is; if it's a voltmeter movement, then I can treat both of these as essentially the same design. I'll look at that this weekend if weather permits...

Mahalo - Dave

Last edited:

Oct 3, 2014
14
anybody?

#### davenn

Moderator
Sep 5, 2009
14,011
hi there

welcome to EP

Sorry, I never saw your post a couple of weeks ago

regards
Dave