• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Differential Amplifier

Status
Not open for further replies.

Chris_P

New Member
Hi, I am very inexperienced with electronics and need some help working out the components I need. I am measuring temperature with an LM335 and an Atmega16. The Atmega16 has differential inputs on it's ADC but I want more accuracy and have been told I need a differential amplifier.

I want to convert voltage in the range 2.4815-3.4815V into 0.0-5.0V. Please correct me if I am wrong. I think if I make a 2.4815V reference for the (-)input and connect the LM335 to the (+) input and have a gain of 5x I should get the correct output. But I have no idea what component to use for the differential amplifier. I have been looking through parts lists on Digi-Key and other sites and am lost in all the specs of them.
 

dknguyen

Well-Known Member
Most Helpful Member
I'm not sure if a differential amplifier would do very much unless you are transmitting over long cables since the LM335 is a single-ended output, and the output of the diff amp is also single-ended (this means you can't make fully effective use of the differential ADC inputs).

You can use an op-amp.
http://www.phys.ualberta.ca/~gingrich/phys395/notes/node110.html

Temperature changes very slowly (has a very slow bandwidth) so almost any op-amp will do.

I don't know of a differential amplifier that also outputs differential signals, but it probably exists (and is a lot more complicated). Maybe someone else knows.

How much accuracy do you need? Is it a temperature sensor after all and temperature changes slowly (you can oversample by a serious amount to increase accuracy) and most applications only require temperature to be so accurate (most of us don't need the temperature much more accurate than to within a couple degrees). The main reason for differential as far as most temperature sensors go is noise over very long cables.

What I'm saying is just gauge how much accuracy you really need (scaling up the output to fit your ADC range is a good way to increase virtual accuracy and is so simple when it's all single-ended that it is a given), but take a step back and think if you really need all this differential stuff. The datasheet says the sensor is accurate to within 1 degree at room temperature and 3 degrees over the full range. All the effort to increase the accuracy might be pointless if you can already achieve this accuracy without all the hardware- it might make it even worse since the more components in the signal path, the more offset and gain errors get introduced.
 
Last edited:

Chris_P

New Member
dknguyen said:
You can use an op-amp.
http://www.phys.ualberta.ca/~gingrich/phys395/notes/node110.html

However, I'm not sure if a differential amplifier would do very much unless you are transmitting over long cables since the LM335 is a single-ended output, and the output of the diff amp is also single-ended (this means you can't make fully effective use of the differential ADC inputs).

I don't know of a differential amplifier that also outputs differential signals, but it probably exists. Maybe someone else knows.

How much accuracy do you need? Is it a temperature sensor after all and temperature changes slowly (you can oversample by a serious amount to increase accuracy) and most applications only require temperature to be so accurate. The main reason for differential as far as most temperature sensors go is noise over very long cables.
Sorry, I didn't explain properly, by using a differential amplifier I will no longer need to use the differential inputs on the Atmega16. I can just use a single ADC input and get the full 10 bit accuracy I want. My accuracy drops to 8 bit when I use it's built in differential inputs.

The LM335 outputs a voltage varying by 10mv per DegreeK. It has a range of -40C (outputs 2.3315V) to 100C (outputs 3.7315V). I want to measure from -25C to +75C (2.4815-3.4815V) meaning the output will vary by 1.0V. I want to amplify this to 5V. I can then split this into 1024 pieces with the 10bit ADC giving me a resolution of 0.1C. Hope this explains it a bit better.
 

Chris_P

New Member
ljcox said:
I have just posted the basic circuit of a diff amp that could be adapted to do what you want, see
http://www.electro-tech-online.com/threads/joystick-wiring-help.26693/
Thanks Len, I had a read of the datasheet on the LM319 and noticed it says it has a minimum gain of 8 and max of 40. For what I want I need a gain of 5. Is that possible modifying the circuit you designed? To be honest, I would have no idea how to modify it to suit my needs.
 

Sig239

Member
Check out the attached picture. The same exact concept as what you want to do. You want to provide the first op amp with your offset voltage(2.4815V) via the pot. This makes it so that when your temp sensor is at the lowest reading (when it outputs 2.4815V) the output of the first op amp will be zero. Then you set the second op amp to a gain of five to get the scale that you want. So that will give you an output from 0-5V with an input of 2.4815-3.4815V. The gain of the second op amp in the original circuit is set at 10, so you will need to change the 27k resistor so that it is a gain of 5.
The photo came from the Nuts and Volts web site and the article was in the August 2006 issue in the Q&A section.

Vgain = (1+ RB/RA) Where RA is the 3k resistor and RB is the 27K resistor.
 

Attachments

Last edited:

Chris_P

New Member
Sig239 said:
Check out the attached picture. The same exact concept as what you want to do. You want to provide the first op amp with your offset voltage(2.4815V) via the pot. This makes it so that when your temp sensor is at the lowest reading (when it outputs 2.4815V) the output of the first op amp will be zero. Then you set the second op amp to a gain of five to get the scale that you want. So that will give you an output from 0-5V with an input of 2.4815-3.4815V. The gain of the second op amp in the original circuit is set at 10, so you will need to change the 27k resistor so that it is a gain of 5.
The photo came from the Nuts and Volts web site and the article was in the August 2006 issue in the Q&A section.

Vgain = (1+ RB/RA) Where RA is the 3k resistor and RB is the 27K resistor.
Thanks Sig239, exactly what I needed :D
 

ljcox

Well-Known Member
Sig239 said:
Check out the attached picture. The same exact concept as what you want to do. You want to provide the first op amp with your offset voltage(2.4815V) via the pot. This makes it so that when your temp sensor is at the lowest reading (when it outputs 2.4815V) the output of the first op amp will be zero. Then you set the second op amp to a gain of five to get the scale that you want. So that will give you an output from 0-5V with an input of 2.4815-3.4815V. The gain of the second op amp in the original circuit is set at 10, so you will need to change the 27k resistor so that it is a gain of 5.
The photo came from the Nuts and Volts web site and the article was in the August 2006 issue in the Q&A section.

Vgain = (1+ RB/RA) Where RA is the 3k resistor and RB is the 27K resistor.
Thanks, the LMC662 is exaclty what I've been looking for.
 

Sig239

Member
Hello Chris and Len
No problem, Nuts and Volts is a pretty cool mag, and it just so happens that I was rereading that issue and that article a few hours before I read your post. Ironic huh? Anyways good luck and let me know how you make out.
 

Chris_P

New Member
I'm not having much luck here. I couldn't get any LMC662's so I have been playing with some LM358's. Is there any reason why these would not suit this application? I haven't connected the circuit to a microcontroller yet, I have just been playing with a volt meter to see the results.

First off I copied the diagram Sig239 posted. In place of the MPX4115A I have a 10K pot. Everything else is exactly the same. I have both pots set to 4.0V out to begin with and the output from the LM358 is reading 3.42V where it should be near 0. And when I wind up the pot in place of the sensor the reading does not change until it reaches 4.7V and the output from the LM358 jumps to 3.59V. No gradual increase just 1 jump.

Secondly I tried the first 2 circuits on the page that dknguyen linked to. I didn't get results anything like what I expected.

Can anyone help me work through this problem?

PS: I am using a 5V regulated supply to power the circuit.
 
Last edited:

ljcox

Well-Known Member
Chris,
The problem is that the LM358 is not a "rail to rail" op amp as the LMC 662 is.

If you look at the data sheet for the LM358, The maximum output for a 5 Volt supply is typically 3.5 Volt. This is why you can't make it go higher than 3.4 V.

Also, if you look at Figure 1 in the data sheet (I have the Motorola DS) you will notice that for a 5 Volt supply, the input voltage range is only 4 Volt.

So you have 2 options:-

1. Use a higher supply voltage or

2. Find another rail to rail op amp.

Also, I don't see why you need 2 op amps. If you want a gain of 5, then you can do it with one amp.

Remove the second op amp and change the feedback resistor from 10k to 50k (ie. two 100k resistors in parallel or a 51k) and replace the 10k between the + input and gnd with a 50k.

This will make the differential gain = 5.
 
Last edited:

Sig239

Member
TJ Byers seems to think that adding the gain in with the first op-amp may introduce "non-linear distortion", but he does mention that it can be done. But if your going to use a dual op amp IC then your really only adding two resistors, sounds like cheap insurance to me.
 

Chris_P

New Member
ljcox said:
Chris,
The problem is that the LM358 is not a "rail to rail" op amp as the LMC 662 is.

If you look at the data sheet for the LM358, The maximum output for a 5 Volt supply is typically 3.5 Volt. This is why you can't make it go higher than 3.4 V.

Also, if you look at Figure 1 in the data sheet (I have the Motorola DS) you will notice that for a 5 Volt supply, the input voltage range is only 4 Volt.

So you have 2 options:-

1. Use a higher supply voltage or

2. Find another rail to rail op amp.

Also, I don't see why you need 2 op amps. If you want a gain of 5, then you can do it with one amp.

Remove the second op amp and change the feedback resistor from 10k to 50k (ie. two 100k resistors in parallel or a 51k) and replace the 10k between the + input and gnd with a 50k.

This will make the differential gain = 5.
Thanks Len, to make things simple I think I will get some LMC662's. So from what you are saying will this circuit work? I am now aiming for an input range of 2.532 to 3.532V. To set the 2.532V I have swapped out the pot for a voltage divider. Pretty sure the values I have used give me this. My schematic is not the best, sorry. I am learning as I go :D

Are R4 and R6 necessary? Thanks for all the help.
 

ljcox

Well-Known Member
R4 is necessary in order to make it a diff amp with minimal thermal drift.

R6 could be eliminated by choosing R1, R2 & R3 such that their Thevenin resistance is = 10k.

This leads to my next point. The circuit posted by Sig239 overlooked the need to make the Thevenin resistances on the + and - inputs equal. And I missed it also.

So I've drawn the attachment to do this and to use a 100k feedback resistor rather than 50k as I suggested.

The reason the Thevenin resistances on the + and - inputs must be equal is to minimise the thermal drift that would otherwise occur due to changes in the input bias currents when the IC temperature changes. However, this is less of an issue if the op amp has FET inputs.
 

Attachments

Chris_P

New Member
ljcox said:
R4 is necessary in order to make it a diff amp with minimal thermal drift.

R6 could be eliminated by choosing R1, R2 & R3 such that their Thevenin resistance is = 10k.

This leads to my next point. The circuit posted by Sig239 overlooked the need to make the Thevenin resistances on the + and - inputs equal. And I missed it also.

So I've drawn the attachment to do this and to use a 100k feedback resistor rather than 50k as I suggested.

The reason the Thevenin resistances on the + and - inputs must be equal is to minimise the thermal drift that would otherwise occur due to changes in the input bias currents when the IC temperature changes. However, this is less of an issue if the op amp has FET inputs.
Thanks Len, I have to order some parts so it'll take me a few days to put the circuit together, but I really appreciate your time making that diagram for me.
 

Sig239

Member
ljcox said:
R4 is necessary in order to make it a diff amp with minimal thermal drift.

R6 could be eliminated by choosing R1, R2 & R3 such that their Thevenin resistance is = 10k.

This leads to my next point. The circuit posted by Sig239 overlooked the need to make the Thevenin resistances on the + and - inputs equal. And I missed it also.

So I've drawn the attachment to do this and to use a 100k feedback resistor rather than 50k as I suggested.

The reason the Thevenin resistances on the + and - inputs must be equal is to minimise the thermal drift that would otherwise occur due to changes in the input bias currents when the IC temperature changes. However, this is less of an issue if the op amp has FET inputs.
It is a cmos device whose input resistance is ">1 terra:eek:hm:" according to the attached data sheet. So if I'm not mistaken, at a couple volts the input currents will be so close to nothing that it does not matter.
 

Chris_P

New Member
ljcox said:
You're welcome.
I'm interested to know where you are intending to buy the LMC662's.
I am in Australia, but I couldn't find anyone here with them. I often buy stuff from Digi-Key but their postage charges are minimum $60, so I bought a few LCM662's and some resistors from Futurlec. The postage was very reasonable.
 

ljcox

Well-Known Member
Sig239 said:
It is a cmos device whose input resistance is ">1 terra:eek:hm:" according to the attached data sheet. So if I'm not mistaken, at a couple volts the input currents will be so close to nothing that it does not matter.
Agreed, that's why I wrote that it would be less of an issue with CMOS.

However, it is still necessary to make the Thevenin resistances approx equal since, in the maths, the a + b term is on both sides of the equation and cancels out. So it leads to the simple expression Vo = V1 - V2) a/b

In this case, a = 100k and b = 20k.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top