0

Shunt with ADS1115
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Shunt with ADS1115

by ammarqs on Tue Aug 03, 2021 11:47 am

I am stuck in a weird situation and cant get myself out of it. I am working on a solar monitor unit. Interfacing my 30A 75mV shunt through an ADS1115 to an esp8266 board.

Code: Select all | TOGGLE FULL SIZE
#include <ESP8266WiFi.h>
#include<Adafruit_ADS1X15.h>

float multi = 0.0000078125;   
float ampsPerV = 400; //30A divided by 75mV
float floatCurrent1 = 0.0;
float floatCurrent2 = 0.0;


Adafruit_ADS1115 ads1;  /* Use this for the 16-bit version */

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  delay(10);
  ads1.setGain(GAIN_SIXTEEN);      // set ads1115 gain to 16 
  // ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.0078125mV
 
  if (!ads1.begin(0x48)) {
    Serial.println("Failed to initialize ADS.");
 //   while (1);
 }


}


void loop()
{
    // put your main code here, to run repeatedly:
    delay(2000);
   
     int16_t CurrentResult1 = ads1.readADC_Differential_0_1();
     floatCurrent1 = (float)CurrentResult1 * multi * ampsPerV;

     Serial.print("Float Current1="); Serial.println(floatCurrent1);
 
     int16_t CurrentResult2 = ads1.readADC_Differential_2_3();
     floatCurrent2 = (float)CurrentResult2 * multi * ampsPerV;

     Serial.print("Float Current2="); Serial.println(floatCurrent2);
           
}


I am attaching a quick schematic for your review as well.
Initially i had my shunt wires going to the ADS1115 switched backward, so i blew couple of my ADS1115 boards, and later realized that i was trying to get negative differential voltage feeding to the ADS1115, i fixed that. now the system is running fine, but i am getting negative reading now with the above program. All my readings are now in (-), i can easily just flip the sign in the program and thats it, but it just doesnt feel right. i want to find out first WHY is that?

Thank you.
Attachments
Capture5.JPG
Capture5.JPG (28.34 KiB) Viewed 151 times

ammarqs
 
Posts: 12
Joined: Fri Jan 11, 2019 4:56 pm

Re: Shunt with ADS1115

by sj_remington on Tue Aug 03, 2021 1:35 pm

All voltages to the ADS1115 inputs must be between 0V and the ADS1115 Vcc, at all times. And there must be a common ground connection. The ADS1115 is generally not suitable for high side shunt current measurements.

Use the INA219 or INA226 instead, which are designed for high side shunt voltage and current measurements.

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

Re: Shunt with ADS1115

by ammarqs on Tue Aug 03, 2021 1:40 pm

The max voltage to the ADS is 75mV, that is what the shunt is rated for. The ADS is only reading differential voltage and there is no common reference ground between the 2 circuits to have the ADS cross the high voltage from the solar. Thats the part that confuses me.
I will consider INA219 and INA2226, thanks.
Oh and did i mention, my solar voltage is +250VDC,

ammarqs
 
Posts: 12
Joined: Fri Jan 11, 2019 4:56 pm

Re: Shunt with ADS1115

by sj_remington on Tue Aug 03, 2021 1:57 pm

there is no common reference ground between the 2 circuits to have the ADS cross the high voltage from the solar.

A common ground is required. That your system seems to work is due to the high input impedance of the ADS1115, combined with stray leakage paths to ground on the PCB, and from fingerprints and other contamination in the wiring.

The INA219 and INA226 are rated for use with high side shunts at maximum 26 and 36 volts above ground.

For a 250V solar system you need a different setup altogether. Either a completely isolated high side shunt/sensor, or possibly a low side shunt, although that introduces other problems.

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

Re: Shunt with ADS1115

by adafruit_support_mike on Wed Aug 04, 2021 9:18 pm

A common GND isn’t strictly necessary for differential readings.

You do need the voltages at the ADS1115’s inputs to be referred to its own GND voltage, but you can do that using 1M resistors to connect the shunt to the ADS1115’s VCC and GND pins.

You end up with two parallel currents running through the shunt: a few microamps from the 1M resistors on the ADS1115 side, and the current from your solar array on the other side. The shunt voltage will depend on the sum of those currents, but the contribution from the 1M resistors will be constant and small compared to the signal of interest.

Without that kind of reference, the voltages at the input pins can float to all sorts of weird places.

adafruit_support_mike
 
Posts: 63669
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.