Reading output of low voltage current-measuring shunt

In marine battery context (12 volt LiFePO4) I have a a 100 Amp ammeter with a shunt that outputs +/-50 mV at full scale of +/- 100 amps DC.

The shunt sees current in both directions so outputs a maximum of -50 to +50 mV DC relative to the common ground of my battery and my Arduino Nano.

I want to use the analogueRead function to read the value of the shunt voltage, convert that to current, and use the current in a charge controlling sketch.

I have an instrumentation amplifier (INA126P) which uses an external resistor to amplify the +/- 50mV as desired.

I was about to test my circuits by amplifying the shunt output voltage 100 times and using analogRead on the resulting -5 to +5 volts when I realized the negative voltage restriction for Arduino pins.

Using the instrumentation amplifier that I have, what is the simplest way to handle the +/- 50mV output of the shunt as an input to an analogue pin. Accuracy is not critical but I would like to use some amplification to take advantage of as much of the ADC range as practical.

I am a rank amateur/beginner and on my first project, so use small words and be gentle please.

Just put a 10K resistor in series with the analog input. That will limit the current drawn by the negative voltage excursions (through the analog input protection diode) to safe levels. The resistor also limits current to safe values for input voltages somewhat greater than 5V.

You have to bias the amp to 2.5V (VCC / 2) at 0 amps, with gain of 50, 0.05V * 50 = 2.5V + bias = 5V, -0.5V * 50 = bias -2.5 = 0V.

I have an instrumentation amplifier (INA126P)

Post a circuit diagram. Does the circuit use a bipolar power supply (e.g. +/- 5V and ground)?

Image posting guide

Jremington: thanks. I will make a proper drawing of circuit and get back to this post. I am using mono polar (0v / +12v) power supply to the amplifier.

JCA34F: thank you too. Sounds like the perfect and simple solution. Once I post a presentable circuit drawing I will ask for your advice on exactly how to bias the amplifier.

Thanks to both of you

Wrong instrumentation amp for the job.

The INA226 would be suitable. Bi-directional, single supply, and and it includes a 16-bit A/D.
If you can use the shunt high-side (usually better), then the chip can also measure battery voltage and power.
Leo..

Leo: thank you for this. I am a bit overwhelmed by the datasheet for INA226 but am working through trying to understand it.

Two questions:

a) I expect nearly 100 amp currents in both directions (charge and discharge). How does this amplifier solve the asymmetry of "-0.5v to +5.0v" restriction on input pins for arduino? Will I just have to work between -0.5 and +0.5 with attendant loss of resolution?

b) Any chance that you know of a simpler bidirectional, single supply, amplifier but with through hole package rather than SMD?

areddon:
I expect nearly 100 amp currents in both directions (charge and discharge).

How does this amplifier solve the asymmetry of "-0.5v to +5.0v" restriction on input pins for arduino?

The chip can measure -82mV to +82mV shunt voltage, and that calculates to about 165Amp bi-directional range with a 50mV shunt.

No analogue pins are used, so no restrictions there.
The chip has an onboard 16-bit A/D, and communicates with the Arduino via a two-wire bus (I2C).

Move the shunt high-side (in the + line of your battery) if possible, and use an INA216 or INA226 breakout board.
Such breakout boards already have a 0.1 ohm shunt fitted, but just connect the board shunt to your 50mV shunt (shunts in parallel).

Maybe wise to experiment first on the kitchen table with a few amps and only the onboard shunt.
Leo..

Thanks to all.

JCA34F: amplifying by 50 and biasing up 2.5 volts worked a treat. Gives me 0 to 5 volts for -100 to +100 amps, just as I needed.

Leo: Great (best?) solution but the complexity of I2C communication and programming that chip was too much for me.

areddon:
the complexity of I2C communication and programming that chip was too much for me.

:o

You would normally use a library for that.
Displaying current can be as simple as

Serial.print(ina.getCurrent());

Leo..

Would like to see a circuit diagram with that INA126.

You say you use a single 12volt supply, and the shunt is connected in the ground line.
The INA126 does not have a common mode range that includes ground.

Output swing is also restricted, so how are you connecting this to the Arduino.
Do you bias pin5 of the INA126, and/or use a voltage divider on it's output?

You never will get a 0-1023 range from the analogue input this way,
so resolution of the ±100Amp display must be low (300-500mA steps?).
The INA226 could be 100 times better there.
Leo..

Leo: thanks for following up.

I did have to go to a bipolar (+12/-12) power supply.
I did use pin 5 to add 2.5v bias on the amplifier.

I am not sure if I will need to use an opamp for the biasing voltage in final set up but will test results with the voltage divider I am using for now, before adding one.

I am sure that you are right about poor resolution ... I have not really tested that yet. I only tried a couple of millivolt inputs, set with a potentiometer and a cheap multimeter, not the actual shunt. Results were as desired but I have not assessed the adequacy of the resolution at all.

It seems like 0.2 amp steps are the theoretical best case and the resolution may well be worse.

Steps up to 0.5 amp resolution should be ok for my application but if resolution is not acceptable I will try your better suggested amplifier.

If it comes to that I will certainly need help with the added complexity.

Again, thank you for you advice.

areddon:
If it comes to that I will certainly need help with the added complexity.

I think you already have been waaay overthinking/overcomplicating things (bi-polar supply, etc.).

An INA226 breakout board is nothing more than four wires to the Arduino, and two wires to the shunt.
Software for that board is not much more than loading/using a library.
Leo..

Just a quick follow up. Once I got my clumsy prototype working I went with Leo's suggestion of the INA breakout board. Fantastic. Simple. More accurate. Thanks for the help.

Don’t forget you can ( should) use the internal voltage reference on your Arduino which gives you a full scale A/D range of around 1.1volts - that helps .

Some Arduino’s ( eg nano33-iot) have higher resolution A/D’s too, which help you too.

The INA226 has a build-in 16-bit A/D...