0

ADS1115 500amp 50mv shunt
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ADS1115 500amp 50mv shunt

by jimk123 on Tue Jun 08, 2021 7:42 pm

I am trying to monitor DC current on certain devices on my boat (12v system) and saw an article (source unknown) of using an arduino uno with a adafruit ADS1115 16-Bit ADC - 4 Channel with Programmable Gain Amplifier PRODUCT ID: 1085

I found this article in the forums which talks about the math: viewtopic.php?f=22&t=73330

The shunt I am using is a 500amp 50mv device, https://www.bluesea.com/products/8255/D ... unt_-_500A

The wiring seems pretty straight forward, I am using a UNO board with a qwiic/stemma connector and using the A0 and A1 pins on the ADS board to connect to the shunt.

I am testing this at home right now with a power supply 13.8v 8amps but the readings I am getting are way off. I must be doing something wrong in the calculations but cannot figure out what. I am testing with two devices, LED lights, one draws a little over 3 amps and the other a little under an amp.

in the serial monitor window I see:
with a LED light
https://www.rigidindustries.com/d-serie ... 01513.html
3.14 amps

raw -18 raw*256 -4608 Amps: -0.28
raw -18 raw*256 -4608 Amps: -0.28
raw -21 raw*256 -5376 Amps: -0.33
raw -17 raw*256 -4352 Amps: -0.27


with a LED light
https://www.rigidindustries.com/ignite- ... 60521.html
draw 0.85

raw -9 raw*256 -2304 Amps: -0.14
raw -9 raw*256 -2304 Amps: -0.14
raw -8 raw*256 -2048 Amps: -0.12
raw -9 raw*256 -2304 Amps: -0.14

thanks

Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include <Adafruit_ADS1015.h>   

/*
 https://www.adafruit.com/product/1085 ADS1115 16-Bit ADC - 4 Channel with Programmable Gain Amplifier $14.95
 used a SF blackboard w/qwiic connector/  This was used to measure DC current on the boat house battery
 Arduino <--> ADS1015
 black     = GND
 red       = 3.3v
 blue      = SDA
 yellow    = SCL

 The ADS1115 can have 4 different user selectable I2C addresses, so with only 2 data lines (SCL & SDA), you can monitor up to 8 shunts.

 I2C Addressing The ADS11x5 chips have a base 7-bit I2C address of 0x48 (1001000) and a clever addressing scheme
 that allows four different addresses using just one address pin (named ADR for ADdRess).
 To program the address, connect the address pin as follows:
 0x48 (1001000) ADR -> GND
 0x49 (1001001) ADR -> VDD
 0x4A (1001010) ADR -> SDA
 0x4B (1001011) ADR -> SCL

 on the ADS1115 connect
 A0 to Current Shunt (blue wire)
 A1 to Current Shunt (green wire)

 I used 0x48 by connecting addr pin on the ADS to arduino GND
*/


Adafruit_ADS1115 ads(0x48);
float amps =0;


void setup(void)
{
  Serial.begin(115200);
// https://forums.adafruit.com/viewtopic.php?f=22&t=73330
// If your shunt is going to have a max drop of 100mV, you probably want
// to use the 16x gain setting which has a range of +/- 256mV.
// 256 / 32768 = 0.0078125 mV
// Since 1mV = 1A of current, 0.0078125 mV = 0.0078125 A (7.8125 mA)

  ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.125mV  0.0078125mV
  ads.begin();
}


void loop(void)
{
  int16_t raw;
  raw = ads.readADC_Differential_0_1(); 
  Serial.print("raw ");Serial.print(raw);Serial.print("  raw*256 ");Serial.println(raw * 256);
  amps = ((float)raw * 256.0) / 32768.0;     // 100mv shunt
  amps = amps * 2;

  Serial.print("Amps: ");
  Serial.print(amps);

/* in the serial monitor window I see:
 with a LED light
 https://www.rigidindustries.com/d-series-pro-specter-diffused-surface-mount-white-1-lights-701513.html
 3.14 amps
 
raw -18  raw*256 -4608
Amps: -0.28
raw -18  raw*256 -4608
Amps: -0.28
raw -21  raw*256 -5376
Amps: -0.33
raw -17  raw*256 -4352
Amps: -0.27
raw -19  raw*256 -4864

with a LED light
https://www.rigidindustries.com/ignite-flood-white-surface-mount-60521.html
draw 0.85

raw -9  raw*256 -2304
Amps: -0.14
raw -9  raw*256 -2304
Amps: -0.14
raw -8  raw*256 -2048
Amps: -0.12
raw -9  raw*256 -2304
Amps: -0.14

*/

  delay(250);
}

Shunt.jpg
Shunt.jpg (685.4 KiB) Viewed 401 times

wiringADS1115.jpg
wiringADS1115.jpg (615.65 KiB) Viewed 401 times

jimk123
 
Posts: 291
Joined: Sun Dec 26, 2010 7:04 pm

Re: ADS1115 500amp 50mv shunt

by sj_remington on Thu Jun 10, 2021 8:53 pm

You must have a common ground between the ADS1115 and the shunt.

Keep in mind that the input voltages on the ADS1115 must be between 0V and the ADS1115 supply voltage, regardless of whether you are using differential mode.

Although the ADS1115 may work OK, it is not the best part for shunt measurements. A better choice would be the INA226, and put the shunt high-side (in the + line of the battery). The INA226 can also measure voltage and calculate power.

sj_remington
 
Posts: 83
Joined: Mon Jul 27, 2020 4:51 pm

Re: ADS1115 500amp 50mv shunt

by jimk123 on Tue Jun 15, 2021 7:16 pm

Apologies, I did not see your post until today. I should say I do have any electronics background, but Adafruit provides excellent tutorials.

Also the picture I posted I am using the positive side of the battery to the shunt and load. ( I did not have any red wire in the demo I wired up) The reason for this is from what I read I only want to monitor the dc current on a electrical panel, not the whole battery system on the boat and I read somewhere you can measure a specific load on a device (eg bilge pump) by inserting the shunt on the positive side ahead of what you want to measure.

Having said that I connected the ground from the power supply to the ground pin on the arduino and the ads1115 breakout burned up immediately :(

I did some searches on the ina226 you mentioned but did not find any break out boards except this one but it looks like it has a built in shunt which I do not think can handle the current requirements

https://www.banggood.com/CJMCU-226-INA2 ... rehouse=CN

I only need to measure dc current on a 12v system up to 50 amps, no need for voltage, watts, etc if that matters. I was hoping for an accuracy of 1/4 amp if that is possible with a shunt ?

Thanks

jimk123
 
Posts: 291
Joined: Sun Dec 26, 2010 7:04 pm

Re: ADS1115 500amp 50mv shunt

by sj_remington on Tue Jun 15, 2021 8:05 pm

The picture that you posted of the wiring is incomplete and thus, more or less useless. A complete schematic diagram would have been very helpful.

The ADS1115 burned out because you did not obey the restrictions on the input voltage, which are clearly stated in the ADS1115 data sheet and in my post. It would have been safe to have the shunt connected to the negative battery terminal, which in turn should be the common ground with the ADS1115.

it has a built in shunt which I do not think can handle the current requirements
Correct. Either remove the built in shunt or wire the 500A shunt in parallel to it (using the blue and green wires shown in your photo. The correction due to the parallel shunt resistances can be ignored. Consider also the INA219, which Adafruit carries. However, it is not as versatile as the INA226.

sj_remington
 
Posts: 83
Joined: Mon Jul 27, 2020 4:51 pm

Re: ADS1115 500amp 50mv shunt

by jimk123 on Wed Jun 16, 2021 8:05 am

Hi sj
I have used the Adafruit ina219 breakout board to measure voltage on the house and engine battery. I upload the data every minute to the Adafruit cloud service data io. I am using a commercial shunt monitor , Victron smart shunt, directly at the house battery which has a ttl serial output so I can monitor amps but when the boat is plugged into shore power it shows a positive amp flow since the charger is on.

I really wanted to just monitor the dc sub panel which has circuits for the bilge pump, lights etc and under normal conditions when no one is one the boat I would expect the current draw to be zero unless I forgot and left lights on or the bilge pump is running and log this to the Adafruit io site.

That is where I read if you put the shunt on the positive side you could measure just a single device or in my case on the dc electric sub panel. There is a 75 amp 50mv shunt on that panel that is attached to the positive cable and ammeter for the panel which is what I would like to do. I would somehow like to read just dc amps at the panel like the analog meter using the arduino so I can upload that value to the io site.

How would I wire the 219 and shunt ? I assume I cannot use the 219 without a shunt or it would burn up due to the high currents I am trying to measure. As I said and am sure you can tell I do not have an electronics background.

Thanks for your help

jimk123
 
Posts: 291
Joined: Sun Dec 26, 2010 7:04 pm

Re: ADS1115 500amp 50mv shunt

by sj_remington on Wed Jun 16, 2021 10:47 am

You can connect the 75 A, 50 mV shunt meter leads to J1 (Vin+ and Vin-) on the INA219 and GND to the negative battery terminal.

The 75 A shunt has a resistance of 0.667 milliOhms. If you don't remove the 0.1 Ohm shunt resistor on the INA219 PCB, the combined parallel resistance is 1/(1/0.1 + 1/0.000667) = 0.662 milliOhms.

50 mV across that combination would correspond to 75.5 Amps full scale reading.

BE SURE to read through the AdaFruit INA219 tutorial and obey the warnings about voltage spikes in the high current power lines, as they can destroy ALL of your equipment.
Be careful inserting noisy loads that can cause a sharp current draw, such as DC motors, since they can cause problems on the power lines and may cause the INA219 to reset, etc. When using a DC motor or a similar device, be sure to include a large capacitor to decouple the motor from the power supply and use a snubber diode to protect against inductive spikes.

sj_remington
 
Posts: 83
Joined: Mon Jul 27, 2020 4:51 pm

Re: ADS1115 500amp 50mv shunt

by jimk123 on Fri Jun 18, 2021 11:59 am

Hi sj
Thank you for the details how to connect the 219 device, I ordered one from Adafruit and am expecting it today, appreciate all your help on this.

jimk123
 
Posts: 291
Joined: Sun Dec 26, 2010 7:04 pm

Re: ADS1115 500amp 50mv shunt

by jimk123 on Tue Jun 22, 2021 7:20 pm

I was able to setup a new test using the INA219 breakout board:
INA219 High Side DC Current Sensor Breakout - 26V ±3.2A Max - STEMMA QT PRODUCT ID: 904
https://www.adafruit.com/product/904

For this test I am using the Blue Sea DC shunt 500 amp/50 mv shunt I posted a pic of earlier here at home since the boat is 100 miles away (the boats DC panel has the 75 amp 50mv shunt)

I wired the bench power supply positive wire to the shunt source side and the load side of the shunt to the positive wire of the LED light I am using to simulate a load. I connected the gnd wire from the power supply to the LED gnd wire.

I then connected gnd on the 219 board to the battery gnd and assume the stemma/qwiic connector on the 219 gnds to the arduino gnd. I connected the shunt sense wires from the shunt to the 219 Vin - and Vin +

I loaded the Arduino library for Adafruit INA219 library and am using the qwiic/stemma connector from the 219 to the Arduino. I loaded the sketch 'getcurrent' from the examples folder.


for a LED light that I measured which draws .99 amps I saw these readings

Bus Voltage: 13.87 V
Shunt Voltage: 0.02 mV
Load Voltage: 13.87 V
Current: 0.40 mA
Power: 4.00 mW

Bus Voltage: 13.87 V
Shunt Voltage: 0.01 mV
Load Voltage: 13.87 V
Current: 0.30 mA
Power: 4.00 mW

Bus Voltage: 13.88 V
Shunt Voltage: 0.04 mV
Load Voltage: 13.88 V
Current: 0.20 mA
Power: 4.00 mW



for a LED light that I measured which draws 2.55 amps I saw these readings

Bus Voltage: 13.80 V
Shunt Voltage: 0.05 mV
Load Voltage: 13.80 V
Current: 0.90 mA
Power: 4.00 mW

Bus Voltage: 13.79 V
Shunt Voltage: 0.08 mV
Load Voltage: 13.79 V
Current: 0.70 mA
Power: 10.00 mW

Bus Voltage: 13.80 V
Shunt Voltage: 0.07 mV
Load Voltage: 13.80 V
Current: 0.80 mA
Power: 6.00 mW


When I turned off the bench power supply (13.8v) I saw this
Bus Voltage: 0.44 V
Shunt Voltage: -0.03 mV
Load Voltage: 0.44 V
Current: -0.30 mA
Power: 0.00 mW

Bus Voltage: 0.48 V
Shunt Voltage: -0.01 mV
Load Voltage: 0.48 V
Current: -0.10 mA
Power: 0.00 mW

Bus Voltage: 0.53 V
Shunt Voltage: -0.03 mV
Load Voltage: 0.53 V
Current: -0.20 mA
Power: 0.00 mW

I appreciate all your help on this, I did not have time to get pictures of the wiring but can post pictures if that would help.
thanks

jimk123
 
Posts: 291
Joined: Sun Dec 26, 2010 7:04 pm

Re: ADS1115 500amp 50mv shunt

by sj_remington on Tue Jun 22, 2021 8:43 pm

Those current and power readings appear to be random noise associated with zero shunt current.

Test the INA219 sensor by itself, following the Adafruit tutorial and using a known load. Make sure you understand how it works before moving to the 500A shunt.

Note that adding the external shunt will require you to change scale factors in the code or library.

sj_remington
 
Posts: 83
Joined: Mon Jul 27, 2020 4:51 pm

Re: ADS1115 500amp 50mv shunt

by jimk123 on Thu Jun 24, 2021 7:28 pm

Hi sj
I removed the shunt and connected the LED light directly to the 219. I wired the positive wire from the bench power supply to the vin + on the INA219 board and the vin - on the INA219 to the positive wire on the LED light which draws 1amp. I connected the negative output on the bench supply to the LED light black wire and to the Arduino GND.

The SDA, SCL, + and gnd from the INA219 to the Arduino remains the same.

here are the readings I got which is almost perfect for what I measured on how much current the LED light draws.
Bus Voltage: 13.75 V
Shunt Voltage: 100.14 mV
Load Voltage: 13.85 V
Current: 1001.50 mA
Power: 13782.00 mW

Bus Voltage: 13.75 V
Shunt Voltage: 100.18 mV
Load Voltage: 13.85 V
Current: 1001.70 mA
Power: 13776.00 mW

Bus Voltage: 13.75 V
Shunt Voltage: 100.31 mV
Load Voltage: 13.85 V
Current: 1000.90 mA
Power: 13766.00 mW


You mentioned I need to apply some kind of scaling to use the shunt ?

If I understand the 500amp / 50mv shunt at:
500 amp will send 50mv
250 amp will send 25mv
50 amp will send 5mv
1 amp will send .1mv

Is a 1 amp load simply too low for the Arduino to measure ?

thanks

jimk123
 
Posts: 291
Joined: Sun Dec 26, 2010 7:04 pm

Re: ADS1115 500amp 50mv shunt

by sj_remington on Thu Jun 24, 2021 8:07 pm

The smallest voltage that the Arduino Uno (and similar) can measure is about 5 mV with the 5V reference, and about 1 mV with the 1.1V reference, due to the 10 bit ADC.

But the INA219 has a 12 bit ADC. Its resolution depends on the PGA (gain) setting, so what is that?

Nevertheless, with a 500 A shunt, you should not expect to accurately measure currents much less than about 5 A.

These are the specifications of interest, from the INA219 data sheet:
Capture.PNG
Capture.PNG (15.16 KiB) Viewed 77 times
Last edited by sj_remington on Thu Jun 24, 2021 8:19 pm, edited 1 time in total.

sj_remington
 
Posts: 83
Joined: Mon Jul 27, 2020 4:51 pm

Re: ADS1115 500amp 50mv shunt

by jimk123 on Thu Jun 24, 2021 8:18 pm

So the 219 is not going to work for me, was really hoping to measure within a .25 amp.

I guess that is why the articles I read recommended the ads1115 to amplify the small single from the shunt ?

jimk123
 
Posts: 291
Joined: Sun Dec 26, 2010 7:04 pm

Re: ADS1115 500amp 50mv shunt

by sj_remington on Thu Jun 24, 2021 8:19 pm

The shunt is the problem, not the INA219. Use a 50 A or less shunt if you want to measure 0.25 A with any accuracy. Put that shunt on a different circuit branch, if other loads will draw more than 50 A.

the articles I read recommended the ads1115 to amplify the small single from the shunt
The authors of those articles seem to be confused about how to make the measurement properly.

sj_remington
 
Posts: 83
Joined: Mon Jul 27, 2020 4:51 pm

Re: ADS1115 500amp 50mv shunt

by jimk123 on Thu Jun 24, 2021 9:57 pm

sj
Thank you for all your help on this.

jimk123
 
Posts: 291
Joined: Sun Dec 26, 2010 7:04 pm

Re: ADS1115 500amp 50mv shunt

by sj_remington on Fri Jun 25, 2021 11:26 am

It is worth noting that the INA226 has a 16 bit ADC, which compared to the 12 bit ADC in the INA219, leads to much higher current resolution for a given shunt resistor.

Plus, the INA226 tolerates higher voltage (36 V) when used with a high side shunt. It is a substantial improvement over the INA219, and it would be great if Adafruit would produce a breakout for it.

sj_remington
 
Posts: 83
Joined: Mon Jul 27, 2020 4:51 pm

Please be positive and constructive with your questions and comments.