Hi, I am trying to replace an analog ammeter with an AVR to measure current (up to 300A). I have an existing 300A/50mV shunt which is used for the analog ammeter. Obviously I don't want to read this directly into the AVR ADC as I will end up with very poor resolution with a maximum of 50mV. I got a couple of AD623 instrument amps to try and boost the voltage to rectify this situation but seem to be unable get it working correctly.
I am initially starting with a planned gain of 100 so that 50mV will become 5.0V, full scale on the AVR input, so I'm using a 1.02kO gain resistor. My problem is that even though the AD623 is supposed to be rail-to-rail it doesn't seem to be working... If I apply a 41.9mV differential across the input of the amp I am only getting 1.217V on the output instead of the 4.19V I am expecting... If I remove the gain resistor and turn it into a unity gain amp I do in fact get 41.9mV on the output as I would expect. Only low gain resistors seem to be giving the amplification I expect. I have tried using Rg=3.89kO and Rg=100 ohms which should be gains of around 26 and around 1000 respectively with actual outputs of 1.107V and 1.229V. So for the gain of 26 things seem to be working about right but for the gain of 1000 which should clearly give the full 5V rail (or close to it) on Vout I only get a max of 1.229V.
Any idea on why this may not be working in full rail-to-rail style? I am feeding it as single supply with 5V if that matters.
If R2 is a 389 ohm resistor, that circuit should apply ~42 mV to the + input while the - input is grounded. I don't see a problem, unless the 3.3V and 5V lines don't share the same ground. Did you try the design tool linked above by cdacunha71?
Edit: do you have the amplifier properly decoupled? If not, it is probably oscillating at the high gain settings. See Figure 43 of the AD623 data sheet (attached). Those capacitors should be as close the the amplifier chip as possible.
That the effect depends on gain suggests that the amp could be oscillating, despite the decoupling. Have you checked the output with a scope?
If this circuit is built on a plug-in breadboard, note that they are notorious for problems with grounding and stray capacitance. See the section in the data sheet on good grounding and circuit board construction practices.
Otherwise, I would send a note to AD technical support, as this should work.
Gain of 100 to a gain-feedback resistor of 1.02kOhm implies about 10 Ohms required input resistance.
That would be a little low for the op-amps which I'm used to so I'd change to about
47kOhm feedback resistance
0.47 kOhm input resistance from (0 to -50mV)
The other thing to check is that you got the + input and - input of your op amp to do what you want.
The opamps which I'm used to, though datasheet says may be single rail, seem to work better if supplied with +-6V and
if gain>2 used as an inverting voltage amplifier.
How would you be about going to +6 and -6 V supply to your op-amp relative to arduino GND, arduino GND to the + input, and your current sense shunt slightly below arduino ground t0 0.47kOhm to op-amp "-" input? Whilst that should work, don't connect any of it unless you are sure that your 300A circuit can be on a different ground to your arduino.
Gain of 100 to a gain-feedback resistor of 1.02kOhm implies about 10 Ohms required input resistance.
That would be a little low for the op-amps which I'm used to
Thanks to some other helpers I did find a graph buried in the datasheet (fig. 23) which shows that maximum output is substantially related to common-mode input and not just to gain. This seems to line up well with my results. So now I'm looking for other options. It would be nice to switch to a hall-effect sensor which would provide isolation at the same time but finding a reasonably priced one of those for 300A is a bit tricky. I could also amplify in stages I guess but it seems like there should be a better way. I'm looking to get about 1A resolution (or better) so I need a gain of at least 30.
Hmmm... Figure 23 is remarkably informative and counter intuitive! It does pay to scrutinize the data sheet carefully. Your common mode voltage is close to zero, which suggests that the maximum output voltage should not be much greater than about 1 V.
Take a look at Figure 20. Going to a bipolar power supply with +/- 5V should solve the problem.
There are opamps which are designed specifically for applications like this.
Have a look at http://www.analog.com/static/imported-files/data_sheets/AD626.pdf
Its a selectable gain single ended opamp with gain blocks of 10 or 100 , and supports common mode voltages up to 50V
with a 5V supply .
In my case I don't think common mode voltage is a problem though as Vin- is tied to GND. It does look like the AD626 would better support a gain of 100 on a single-supply (as a side note the AD623 looks to support a gain of 100 in my application with a +/-5v dual-supply). A reasonable issue with the AD626 though is that there is substantial error (20-25%) in the gain which makes it probably not a very good choice for instrumentation.
On the datasheet for your AD626 device there, on page 6 there are some graphs of "typical performance characteristics", what is the second graph ( top right corner of the page ) telling you about there ??
If the power supply for which the current is to be monitored is 24V or less, the AD626 may be a better choice. You could then put the current shunt in series with the power supply positive output terminal. The AD626 is designed for just such a high common mode input voltage, as shown in Figure 9 of the AD626 data sheet. However, you may want to research why Figure 9 shows a bipolar power supply for the amplifier.
Don't worry about possible gain errors, as long as they are constant or can be corrected by a simple trend. Your final implementation should be calibrated against an accurate ammeter in any case.