I have the problem that my ads1115 is not measuring properly the voltage of my differential inputs for measuring the voltage of my offgrid LFP batterys (24V) and the voltage of the solar panels (up to 43V).
What is my circuit setup?
on the pcb i have two different voltage layers: 5V and 3,3V which are supplied by LM317 circuits on the board. Both LM317 are parallel and powered by the 26-28V of the mppt charger load output
i calibrated my section of measurements with the integrated potentiometer to 3,0V at the highest voltage of the measurement range. For the battery i have 3,00V at a Voltage of 30V and for the solar voltage i have 3,00V at 50V
if i power the pcb and the analog inputs with my laboratory power supplies it seems that everything works fine, but if i wire the pcb voltages are heavily divergenting.*
i also tried to connect one of my laboratory power supplies to the pcb while at the inputs the voltages of solar and battery were present
i also tried to disconnect all for this problem unnecessary wirings (relay controlling)
i replaced testwise the ads1115 break outs
Could this problem caused by a grounding problem? So if i power the pcb through my laboratory power supplies every thing works fine (because they are commonly grounded through the 230V mains?). In the practical use case of the pcb it is powered by the 26-28V of the MPPT charger, then we have divergenting voltages at the analog inputs of the ads (solar voltage and battery) and the voltages at the relay switching contacts which are coming from the battery
Last but not least the code of the ads init and measuring (which is working fine if i power pcb and analog inputs with laboratory power supply)
auto adsInit() -> void
{
//Wire.setClock(4000000); // 400kHz I2C clock. Comment this line if having compilation difficulties
ads1.setGain(GAIN_ONE);
ads1.begin(); // default address
ads1.setDataRate(RATE_ADS1115_860SPS);
delay(200);
ads2.setGain(GAIN_ONE);
ads2.begin(0x4A);
ads2.setDataRate(RATE_ADS1115_16SPS);
}
// ....
auto voltMeasuringAds1115(Adafruit_ADS1115 ads, adsInput input, voltRange vRange) -> float
{
float fVolt = 0.0;
float fResult = 0.0;
// decide which input to use and read voltage
switch (input)
{
case adsInput::ADS_INPUT_0_1:
fVolt = ads.readADC_Differential_0_1();
Serial.println("raw Volt:" + String(fVolt));
break;
case adsInput::ADS_INPUT_2_3:
fVolt = ads.readADC_Differential_2_3();
break;
default:
Serial.println("Error: Wrong Input for ADS1115");
break;
}
// decide which range to use
switch (vRange)
{
case voltRange::VOLT_0_30:
fResult = fmap(fVolt, iAdc2_01Low, iAdc2_01High, iAdc2_01ScaledLow, iAdc2_01ScaledHigh);
break;
case voltRange::VOLT_0_50:
fResult = fmap(fVolt, iAdc2_23Low, iAdc2_01High, iAdc2_23ScaledLow, iAdc2_23ScaledHigh);
break;
default:
Serial.println("Error: Wrong Volt Range for ADS1115");
break;
}
return fResult;
}
This is very confusing, you have two names for the same wire, GND.
Give them a name like , "SYS GND"
Thank you for your detailed answer. You are totally right regarding the GND line of the LM317 power supplies. I thought it would be clever, if i name it differently, but if i think about it now, it makes more confusing than anything else .I will consider your recommendation.
Can you explain how your potential dividers work with no GND, or have you given GND some more different labels ?
The idea is, that i connect on "PCB: 1" the battery + pole and on "PCB:2" the battery-. The same on the other side with the solar panel. The common grounding should be done by the mppt charger because the pcb is powered by the load output of the mppt charger and plus and minus of the battery are coming from the mppt charger. Only the solar panel have no ground connection to the system (but the results are not changing if i disconnect this line from the pcb)
PS. Did you breadboard each section of your project and test it BEFORE making your full circuit PCB?
I tested the LM317 3,3V and 5V at first and after that created the sockets and connections for the modules (ads1115, rtc, relay modules, mkr socket, ili9341). I tested the voltage dividers with laboratory power supplies and the code mentioned above without any problems
My current assumption is, that i have somewhere ripple voltages or a problem with the grounding if i connect the pcb in practice conditions: Today i will try to figure out with my oszilloscope whether i can find anything.
Generally, if you give signals different names the CAD software will assume they are separate signals - so it will assume there is no connection between them.
The whole point of giving signals names is that those with the same name are the same signal, and those wit different names are different signals!
You deleted your question, but yes i'm using two different modules. You also can see this while the init
auto adsInit() -> void
{
//Wire.setClock(4000000); // 400kHz I2C clock. Comment this line if having compilation difficulties
ads1.setGain(GAIN_ONE);
ads1.begin(); // default address
ads1.setDataRate(RATE_ADS1115_860SPS);
delay(200);
ads2.setGain(GAIN_ONE);
ads2.begin(0x4A);
ads2.setDataRate(RATE_ADS1115_16SPS);
}
// ....
Yesterday i inserted manually ads1.begin(0x38) in the ads1 object for playing safe that the standard i2c address is used but without success (as expected, because the code is basically working)
The ads1 object is for measuring the current through HST016L hall sensors but this is currently not used. So the inputs at this moment are not connected with anything. 0x38 is the standard i2c address for ADS1115
then i don't understand your problem. T3(0x48) "is not measuring properly" and is not connected to its inputs, T5(0x4A) with dividers R5-R10 working well. i would say it is not program issue.
Hi,
I think we need to see a complete schematic, batteries, PV panels and all connected, rather than net names.
Net names may be okay for PCB design, but are minefield when trying to do signal flow while troubleshooting. Showing how the hardware is electrically connected is vital to understanding your project.
A good start, but needs refining.
Although you can use the 1115 to do differential measurements their is a voltage limit to how high each measurement can be above the 1115 gnd.
i had some tests and one differential channel of ads1115 now showing -2913 without any voltage applied. a second channel is still about 0. but both channels seems to be usable because readings are linear in both positive and negative range.
there is a voltage limit to how high each measurement can be above the 1115 gnd.
Hey Tom, this sounds plausible, I also figured out that i getting a lot of noise induced by the inverter. If I turn it off, the noise at the battery is zero, but I obviously get also noise somewhere from the mppt charger (probably load and/or charge output). If I turn off the inverter, the noise at the inputs of the pcb is not sinking significant
I think that this amount of noise also could influence the measuring, isn't it? I add a few pictures of the measuring with low sampling rate for having an overview of the noise.
I created a new sheet and took the parts which are necessary for the pcb. Basically, i power the pcb through the load output of the mppt charger.
I'm only wondering why it works with my two laboratory power supplies. Is it because they are common grounded by the earth wire of the 230V mains supply? I also tried to connect the grounds of the different voltages (Minus pole of solar voltage and minus pole of battery pole).
Didn't read the whole thread, but I see a ground symbol on the solar panel negative. Can't do that, because that's disabling (shorting) the MPPT charger and likely connecting the panel directly to the battery. Most, if not all solar chargers, regulate the negative leg of the panel, so the panel must not be grounded. Panel+ is likely internally directly connected to batt+, and panel negative could have up to negative 19volt (43-24), possibly creating a problem for the ADS1115.
Why do you think panel voltage is important. Only panel power is.
If the MPPT charger has a 95% efficiency, then you can calculate panel power from battery voltage and charge current.
Leo..