ADS1115 showing inverted Reading

Hello, I am using Arduino Uno and ADS1115 ADC module to read two voltages, shunt voltage on across a resistor (current) and input voltage from a voltage divider resistor. The signals will be used to generate a refrence control signal to drive a half bridge converter. The problem i am facing is that i get inverted reading for both of the signals, all the 4 ADS1115 analog channels are giving inverted readings, multiplying the values by -1 gives the correct signal but the values goes to negative, and this is not siutable for my application. Using the Arduino inbuilt ADC gives correct values but the ADC resolution is a little poor since i need very accutare signal. How can i get the real signal to view same as it can be seen on the oscilloscope, and is it possible to configure the ADS1115 module to show readings from 0 to the DAC max value, same as in Arduino inbuilt ADC while getting rid of the negative side since i am only reading positive voltage. I mostly deal with hardware and have little understaing of software. below are the waveforms from cope and serial monitor

here is the code



#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_ADS1X15.h>

Adafruit_ADS1115 ads;

void setup() {
 //analogReference(INTERNAL);
  Serial.begin(115200);     // Initialize serial communication for debugging
  ads.begin();
  ads.setGain(GAIN_TWOTHIRDS); 

}

void loop() {
  int16_t adc0, adc1;
  float voltage = 0;
  float current =0;
  adc0 = ads.readADC_SingleEnded(0);
  adc1 = ads.readADC_SingleEnded(1);
  voltage = (adc0*0.0625);
  current = (adc1*0.0625);
  float realcurrent= ((current/100)/0.01);
  float realvoltage = voltage*99.3;
  
  Serial.print(adc0);
  Serial.print(",");
  Serial.println(adc1);
  delay(50);
}

Hello and welcome. Please take a few minutes and read How to get the best out of this forum . If you follow the recommendations there, you will make it possible for others to help you.

And PS, there are no waveforms in your post.

Rather than multiplying by -1, try subtracting the readings from 32767. That should fix the inverted signal problem without going negative.

But it still won't give the correct readings. I think we need to see your schematic to understand why your readings are inverted in the first place.

hello, thank you for your reply. below is the schematic where the voltage signals are taken from.

Ok, I'm out of my depth predicting what waveform would be expected with that circuit. But I think it's possible that the circuit could be responsible for inverting the signal. I can't see anything in the code that would invert the signal.

= 1

The signal on the serial monitor is the raw signal without any computation on it.
((current/100)/0.01); 100 is the gain of the amplifier and 0.01 is the value of the current sense resistor. everything is fine when using oscilloscope but signal inverted when using ADS1115

is GND_PRI connected to ads1115 GND ?

yes, it is connected

you can omit OpAmp and use differential input of ads1115

You need to consider which way current flows through R48, the current shunt.

At the output of the bridge rectifier, conventional current flows from its + terminal to its - terminal, when the current flows through R48 it enters at pin 1 and exits at pin 2, making pin 1 the more positive. Hence pin 2 of the resistor is negative with respect to GND_PRI.

You can make the output of the AD620 instumentation amplifier go positive instead of negative by transposing the connections to pins 2 and 3.

thank you, i will try to do that

thank you for your suggestion, i will try to omit the opamp and use differential input


if i use standard schematic - no negative spikes more

1 Like

Can't. Because the ADS1115 can't handle negative input voltages (point2 of R48 goes negative).
Differential for the ADS means the difference between two positive voltages.
Leo..

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.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.