Voltage error ADS

Hello so I have a code for my ADS1115
`#include <Wire.h>
#include <Adafruit_ADS1X15.h>

Adafruit_ADS1115 ads; // create ADS1115 object

void setup() {
Serial.begin(9600); // initialize serial communication
Wire.begin(); // initialize I2C communication
ads.begin(); // initialize ADS1115
}

void loop() {
int16_t differential1 = ads.readADC_Differential_0_1(); // read differential voltage
float voltage1 = differential1 * 0.0078125; // convert to voltage (assuming default gain of 1)
Serial.print("Differential voltage weerstand: ");
Serial.print(voltage1, 3);
Serial.println("mV");

int16_t differential2 = ads.readADC_Differential_2_3(); // read differential voltage
float voltage2 = differential2 * 0.0078125; // convert to voltage (assuming default gain of 1)
Serial.print("Differential voltage stof: ");
Serial.print(voltage2, 3);
Serial.println("mV");
delay(1000); // wait for 1 second
}`
My question is what is the measured voltage error (absolute error)?

I don't see where you set that in the code, in which case gain defaults at 2/3.

Make sure both analogue inputs stay within the boundaries of VCC/GND of the ADS.
Leo..

1 Like

If you don't do any offset or gain calibrations and ignoring any errors do to drift, the worst case error will be around 0.156% of the full scale value (FSR).

1 Like

Hi, @lolastic
Welcome to the forum.

It will tell you how to post your code.

Have you tried the differential code example that comes with the library?

What model Arduino controller are you using?

What have you got connected to the 1115?

Can we please have a circuit diagram?
An image of a hand drawn schematic will be fine, include ALL power supplies, component names and pin labels.

Have you tried the example differential code that comes with the library?

Have you got YOUR code to compile and upload?
If so have you done some measurements to establish the error?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

So the way an ADS1115 works is it offers a 15 bit resolution based on the Full Scale Range, which is determined by the gain setting.

Your code says "assume default gain of 1". But you are not setting the gain so in fact that will default to gain of 2/3 which corresponds to a FSR of 6.144 volts.

Voltage(mV) = ADC reading * (FSR/2^15)
= ADC Reading *(6144mV/2^15)

You are using 0.0078125mV resolution. That is in fact based on setting the gain to 16 which results in a FSR of 256mV so

Voltage(mV) = ADC Reading * (FSR/2^15)
= ADC Reading * (256mV/2^15)
= ADC Reading * 0.0078125mV/bit

That's not right at all because your default gain will set the FSR to 6144mV. So your code is not right, not only are the calculations incorrect but the comments are incorrect.

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