Author Topic: Zero offset op-amp or not!  (Read 2207 times)

0 Members and 1 Guest are viewing this topic.

frackers

  • Sr. Member
  • ****
  • Posts: 435
  • Country: nz
  • Picard spits "Hello"
Zero offset op-amp or not!
« on: June 12, 2008, 02:35:53 AM »
Greetings


I already have a large shunt for an LED panel meter in the ground line of the battery bank which for + / - 100 amps develops + / - 100 millivolts that the panel meter reads very nicely.


I'd like to measure this offset with a micro (8 bit AVR is preferred) that has an A/D converter on board but of course I need to get the input voltage into the measurement range of the micro - a gain of about 20 with a 2volt offset (so the micro reads from 0 to 4 volts with the current going from -100 to +100 amps. I'd like to power the micro from the battery bank so it will have a common ground to it as well.


Problem I've hit is amplifying the signal when it is right down at ground, and when the battery bank is discharging then one end is below zero and op-amps just don't work that close to the supply rail!


Is there a solution to this without generating a split (i.e. -ve) supply or that won't involve precision op-amps with lots of adjustments to compensate for the internal offsets of the devices? I'm only looking for <10% accuracy (not expecting a lot!) so I can correlate power from turbine to wind speed to see what I'm getting. Or do I just power the micro completely separately with some small switch mode isolation device?


Cheers

« Last Edit: June 12, 2008, 02:35:53 AM by (unknown) »
Robin Down Under (Or Are You Up Over)

wooferhound

  • SuperHero Member
  • ******
  • Posts: 2288
  • Country: us
  • Huntsville Alabama U.S.A.
    • Woofer Hound Sound & Lighting Rentals
Re: Zero offset op-amp or not!
« Reply #1 on: June 11, 2008, 09:21:54 PM »
Can you put the shunt on the positive line ?
« Last Edit: June 11, 2008, 09:21:54 PM by (unknown) »

joestue

  • Hero Member
  • *****
  • Posts: 1763
  • Country: 00
Re: Zero offset op-amp or not!
« Reply #2 on: June 11, 2008, 10:30:40 PM »
it would be a good idea to isolate the AVR anyway.


Build a 5 volt supply relative to either side of the shunt. read the shunt voltage off the mid point between the two 500 ohm resistors, one to the 5 volt supply, one to the shunt.


The resistors will divide the 5 volts +/- the shunt voltage in half, the difference between the two should be half the shunt voltage.


This don't affect the resistors controlling the gain, provided they are a much higher value. say for instance a 100K ohm resistor from the output to a 2.5K ohm resistor feeding the negative pin on the opamp.


needless to say the tolerance of the resistors is crucial here, you may need a 10 turn pot to get a voltage of zero at no load.


i'm sure there is a better way to do this.

« Last Edit: June 11, 2008, 10:30:40 PM by (unknown) »
My wife says I'm not just a different colored rubik's cube, i am a rubik's knot in a cage.

scottsAI

  • Hero Member
  • *****
  • Posts: 884
Re: Zero offset op-amp or not!
« Reply #3 on: June 12, 2008, 12:08:55 AM »
Yes it can be done easily.

No isolation necessary unless done for other reasons.

4 resistors opamp and shunt. 1% resistors would be best, pot not necessary then.

ADC reference of Micro must share supply to opamp.

I will draw it up tomorrow. Good night.


Have fun,

Scott.

« Last Edit: June 12, 2008, 12:08:55 AM by (unknown) »

finnsawyer

  • Hero Member
  • *****
  • Posts: 1565
Re: Zero offset op-amp or not!
« Reply #4 on: June 12, 2008, 10:42:15 AM »
It is possible to make a differential amplifier using two transistors that operates off of a single voltage supply.  You connect a single resistor from ground to the two emitters (use npn transistors for negative ground).  Connect both transistor collectors to the high side of the power supply using matched resistors.  Connect the base of one transistor to ground through a biased Zener diode, but make the current for the Zener to pass through the shunt.  That way any change in the shunt voltage should be transferred to the base of said transistor.  Bias the base of the other transistor using two resistors in the usual fashion.  This particular circuit has a fairly low input impedance being 2 times Rb for the transistor.  But the Zener (say 5.1 volt) should have a very low resistance, around 10 ohms so all of the voltage change from the shunt should show up at the base of the transistor and be amplified.  This is somewhat backwards from what I've done, so I wonder if you might need a biased Zener to ground for the other transistor base as well.  Basically, the circuit works on the principle that the total current through the emitter to ground resistor stay constant, causing the differential sensing and amplification of a voltage change at the base of one of the transistors.  It's not perfect, but it may solve your problem.
« Last Edit: June 12, 2008, 10:42:15 AM by (unknown) »

altosack

  • Jr. Member
  • **
  • Posts: 92
Re: Zero offset op-amp or not!
« Reply #5 on: June 12, 2008, 04:06:08 PM »
Hello frackers,


There may be an even simpler way to do this.


Many AVRs have a built-in gain stage before the ADC. For example, an ATtiny861 has a 20X gain stage, and I know some of the ATmegas do too (I just don't remember which ones). According to the ATtiny861 data sheet, it does reduce the effective resolution of the ADC to about 8 bits instead of 10, but if you are using oversampling/decimation (highly recommended, and there is a pretty good application note from Atmel about this), it still should be good enough to read to 0.1 amps.


Note that you have to use differential inputs to do this, but this is recommended when you are reading such a small voltage anyway.


Best of luck and let us know how it turns out,

Dave

« Last Edit: June 12, 2008, 04:06:08 PM by (unknown) »

frackers

  • Sr. Member
  • ****
  • Posts: 435
  • Country: nz
  • Picard spits "Hello"
Re: Zero offset op-amp or not!
« Reply #6 on: June 12, 2008, 05:05:51 PM »
Would certainly appreciate this - my ideas so far have involved floating supplies offset using a zener which will of course be subject to drift with temperature.
« Last Edit: June 12, 2008, 05:05:51 PM by (unknown) »
Robin Down Under (Or Are You Up Over)

joestue

  • Hero Member
  • *****
  • Posts: 1763
  • Country: 00
Re: Zero offset op-amp or not!
« Reply #7 on: June 12, 2008, 05:23:17 PM »
use two zenars, both drifting together. Murphy tells me this don't work...


but resistors work just as well

« Last Edit: June 12, 2008, 05:23:17 PM by (unknown) »
My wife says I'm not just a different colored rubik's cube, i am a rubik's knot in a cage.

finnsawyer

  • Hero Member
  • *****
  • Posts: 1565
Re: Zero offset op-amp or not!
« Reply #8 on: June 13, 2008, 08:47:33 AM »
I've had a little time to think about this.  Move the shunt to the positive line and use PNP transistors.  The emitter resistor then goes from the high side of the battery to the emitters.  Make that 470 ohms to get about 10 milliamps total current with the 5.1 volt Zener diode.  If you make the collector resistors 820 ohms you should be close to having the Vces equal to the voltage drops across the collector resistors.  By adjusting the value of these resistors you can make the offset relative to the ground 2 volts, although it sounds like you really want three volts as the shunt voltage relative to the high side of the supply can go negative as well.  The Zener must be reversed and still go to the input side of the shunt.


Since this a differential amplifier you should be able to control the gain by putting a feedback resistor from collector to base of the other transistor and a resistor from base to ground through another smaller voltage Zener.  It'll take some fiddling to get the biasing and gain right.  It is not necessary to have the two collector currents equal, however.  You can pick your output off of either collector depending on whether you want inverting or non inverting output.  My interest was to use the circuit as an integrator, so I used a feedback capacitor.  Since the rate of integration could be adjusted, it follows that so can the gain be.  The gain should be about equal to the ratio of the feedback resistance to the base to Zener resistance.


You worry about temperature effects.  You can minimize them by matching component characteristics as much as possible.  But what about the effect of the change in battery voltage?      

« Last Edit: June 13, 2008, 08:47:33 AM by (unknown) »

finnsawyer

  • Hero Member
  • *****
  • Posts: 1565
Re: Zero offset op-amp or not!
« Reply #9 on: June 14, 2008, 09:24:36 AM »
You might try googling "temperature compensated zener diodes".  There's a bunch of stuff out there.  I did not try wading through it.
« Last Edit: June 14, 2008, 09:24:36 AM by (unknown) »

scottsAI

  • Hero Member
  • *****
  • Posts: 884
Re: Zero offset op-amp or not!
« Reply #10 on: June 14, 2008, 09:35:37 AM »
Monitoring equipment should draw as little power as possible from your battery.


I like altosack (Dave's) post #5 best.

Looked up AVR ATiny861, like he says has 20x gain diff amp built in.

Look over the Data Sheets states in section 19.8.3 or page 153.

Set as bipolar mode, discover direction of input, then set up the differential channels as unipolar with the correct direction for the full range.


As mentioned; over sampling effective resolution enhancement can be achieved.

4 times over sampled get one extra bit. Search on ENOB for more info.

Sample 4 times, average result, now resolution is one bit more. 16X = 2 bits etc.

Remember resolution and accuracy are NOT connected in an ADC. The accuracy remains fixed, just have more bits to play with!


I drew up the opamp, but after reading Dave's post figured it was the best way to go.


Have fun,

Scott.

« Last Edit: June 14, 2008, 09:35:37 AM by (unknown) »

frackers

  • Sr. Member
  • ****
  • Posts: 435
  • Country: nz
  • Picard spits "Hello"
Re: Zero offset op-amp or not!
« Reply #11 on: June 15, 2008, 03:36:36 AM »
One major issue is that I have tubes full of AVRs that run with the emulator I have - the newer parts don't :-(


Concerning the current draw - if I have to worry about 10mA taken from a 500amp/hr battery bank I'm in the wrong game!! Check out my diaries on the way I'm going to be using this system - storage as such is not really a requirement.


Guess I'm going for a floating supply on the monitor after all...

« Last Edit: June 15, 2008, 03:36:36 AM by (unknown) »
Robin Down Under (Or Are You Up Over)

scottsAI

  • Hero Member
  • *****
  • Posts: 884
Re: Zero offset op-amp or not!
« Reply #12 on: June 15, 2008, 09:42:29 AM »
you OK with using an opamp? which ones are easy to get for you?
« Last Edit: June 15, 2008, 09:42:29 AM by (unknown) »