### Author Topic: Something wrong or i chose wrong op-amp  (Read 2036 times)

0 Members and 1 Guest are viewing this topic.

#### DarkZero

• Regular Contributor
• Posts: 160
• Country:
##### Something wrong or i chose wrong op-amp
« on: June 26, 2017, 07:24:54 pm »
i want to make a small voltage monitoring device using arduino that will measure 0-25v  but when i connect r2 to gnd i get a reading of 0.6v and i cant measure lower values than that is it poor choice of op-amp or something else ?

#### Kleinstein

• Super Contributor
• Posts: 7062
• Country:
##### Re: Something wrong or i chose wrong op-amp
« Reply #1 on: June 26, 2017, 07:30:19 pm »
The MC33202 is BJT based and thus has a considerable bias current. So the resistors at the input are too large or the OPs choice not good for the resistors.

A good choice for such high resistors would be a MCP6002 or similar.

#### DarkZero

• Regular Contributor
• Posts: 160
• Country:
##### Re: Something wrong or i chose wrong op-amp
« Reply #2 on: June 26, 2017, 08:19:18 pm »
so either to lower r2 or to change opamp ?

#### mikerj

• Super Contributor
• Posts: 2325
• Country:
##### Re: Something wrong or i chose wrong op-amp
« Reply #3 on: June 26, 2017, 08:49:34 pm »
You would need to lower both R1 and R2 to maintain the same ratio, but really this isn't the right part for precision DC measurements using high impedance dividers.

The datasheet says this part has a typical input bias current of 80nA @ 25C.  You have an input impedance of 10M||2M = 1.66M, 1.66M * 80nA = 0.133v.  Assuming your Arduino reference is 5v, your scaling factor would report this as 0.8v, close to what you are seeing.  The worst case input bias current (i.e. what you should be designing for) is 200nA @ 25C.

Also note that the output can only get within about 50mV of the rails, irrespective of the divider so there will always be an offset to deal with.

Some problems like this can be resolved with software calibration, but input bias current is tricky since it can vary with temperature and common mode voltage.

#### Zero999

• Super Contributor
• Posts: 13849
• Country:
• 0999
##### Re: Something wrong or i chose wrong op-amp
« Reply #4 on: June 26, 2017, 09:35:21 pm »
If lowering the resistor value or changing the op-amp are impractical, connecting pins 1 & 4 together with 10M and 2M in parallel, rather than a wire link may help. Balancing the impedance to each input causes the voltage generated by the bias current on both the inverting and non-inverting inputs to be equal, thus cancelling one another.

I notice that the MC33202 has a rail-to-rail input stage which casts doubt on how well it will work but it's still worth trying.
« Last Edit: June 27, 2017, 12:09:26 pm by Hero999 »

#### bson

• Supporter
• Posts: 1619
• Country:
##### Re: Something wrong or i chose wrong op-amp
« Reply #5 on: June 26, 2017, 11:01:15 pm »
Or use a FET opamp such as the LF412.  It has an input resistance of 1012ohm and a bias current of 50pA typ.  Still, even then 10M,2M is just massively big...  How about 100k,10k?

• Super Contributor
• Posts: 1875
• Country:
• Reactor Operator SSN-583, Retired EE
##### Re: Something wrong or i chose wrong op-amp
« Reply #6 on: June 27, 2017, 12:57:41 am »
When working with hiz Z inputs and sensors you need to guard the
OpAmp inputs. Some ref material on this.

http://www.ti.com/lit/an/snoa664/snoa664.pdf

http://www.linear.com/solutions/1853

Regards, Dana.
« Last Edit: June 27, 2017, 01:00:53 am by danadak »
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer

#### Zero999

• Super Contributor
• Posts: 13849
• Country:
• 0999
##### Re: Something wrong or i chose wrong op-amp
« Reply #7 on: June 27, 2017, 10:42:23 am »
Or use a FET opamp such as the LF412.  It has an input resistance of 1012ohm and a bias current of 50pA typ.  Still, even then 10M,2M is just massively big...  How about 100k,10k?
The trouble with the LF412 is the input common mode range doesn't include the negative rail, so a negative supply is required to measure 0V.

To run off the same power supply as the ADC, a CMOS op-amp with both a rail-to-rail input and output is required, such as the OPA743.

#### Kleinstein

• Super Contributor
• Posts: 7062
• Country:
##### Re: Something wrong or i chose wrong op-amp
« Reply #8 on: June 27, 2017, 04:12:13 pm »
If the bias current of the OP is somewhat constant, one might be able to just compensate for it in software. However with many OPs the bias current is also changing when coming close to the Rails or when changing over from the NPN to PNP input stage. So likely this is not a working option with the MC33202.

To power the OP with the same 5 V as the Arduino a rail to rail OP is kind of convenient. The AVR internal ADC is not that accurate. So a more or less normal RR CMOS based OP should be OK. There are lots of rail to rail OPs for a 5 V supply to chose from, this includes auto zero OP  like the MCP6V11, though I doubt it is needed.

If the input is only slowly changing, one could even try It without an OP at all. The ADC inputs are kind of high impedance on average, but they need peak current to charge the S&H stage. Here a simple buffer capacitor (e.g. 10 nF -100 nF range) could be all it takes. The downside is some loss in precision due to leakage currents (though likely less than the current OPs Bias) and less protection. Though the high series resistor already provides some protection.

#### DarkZero

• Regular Contributor
• Posts: 160
• Country:
##### Re: Something wrong or i chose wrong op-amp
« Reply #9 on: June 27, 2017, 07:02:04 pm »
ok ty all for suggestions i tried some guess i need to give more info in order to make this thing

first for Aref im using REF 02

i lowered resistors to 5k and 1k it seems to have fixed the issue with input bias current and i calibrated it in software on a 5v reference box when i measure that 5v it shows 5v and its pretty stable now when i measure battery of 1.5v and lets say its 1.5v i do it at the same time with the arduino and my multimeter, arduino shows 1.4v where my metter shows 1.5v also when i try to measure higher voltages then 5v volts lets say 10v i get ~8v.
my code is in attachment.

#### mikerj

• Super Contributor
• Posts: 2325
• Country:
##### Re: Something wrong or i chose wrong op-amp
« Reply #10 on: June 27, 2017, 07:13:31 pm »
ok ty all for suggestions i tried some guess i need to give more info in order to make this thing

first for Aref im using REF 02

i lowered resistors to 5k and 1k it seems to have fixed the issue with input bias current and i calibrated it in software on a 5v reference box when i measure that 5v it shows 5v and its pretty stable now when i measure battery of 1.5v and lets say its 1.5v i do it at the same time with the arduino and my multimeter, arduino shows 1.4v where my metter shows 1.5v also when i try to measure higher voltages then 5v volts lets say 10v i get ~8v.
my code is in attachment.

That's a very low impedance to be measuring up to 25v with; it will be drawing over 4mA through the resistors.  That might not be a problem if you are measuring something with very low source impedance e.g. a battery.

#### Kleinstein

• Super Contributor
• Posts: 7062
• Country:
##### Re: Something wrong or i chose wrong op-amp
« Reply #11 on: June 27, 2017, 07:21:00 pm »
With a 5 K and 1 K resistor one would not need the OP. The ADC in the AVR is ok for a signal impedance of 20 K. So one could use something like 20 K and 100 K without an amplifier. With an additional capacitor even higher impedance can work.

The ADC in the µC can have some offset and the OP can also add some offset. So one might have to do calibration with 2 points, not just one voltage. Even if the OP is rail to rail, performance is usually not that good very close to the rails. So the range below some 20 mV might not be that good and it might be a good idea to no use the point at 0 V for the calibration.

Smf