Unstable values with ADS1115

Hello guys,

I buyed a ADS1115 module to use with my Wemos D1 Mini, but I have a problem. I only connect SDA, SCL, 3V, GND and ADDR. None input to AX is connected and MicroUSB is used to power and program the unit.

I used the example library code from Adafruit, but I always get values and not zero or a stable low value.

This my code and the console output.

Thanks for your help.

#include <Adafruit_ADS1X15.h>

//Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */
Adafruit_ADS1015 ads;     /* Use this for the 12-bit version */

void setup(void) 
{
  Serial.begin(115200);
  Serial.println("Hello!");
  
  Serial.println("Getting single-ended readings from AIN0..3");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");
  
  // The ADC input range (or gain) can be changed via the following
  // functions, but be careful never to exceed VDD +0.3V max, or to
  // exceed the upper and lower limits if you adjust the input range!
  // Setting these values incorrectly may destroy your ADC!
  //                                                                ADS1015  ADS1115
  //                                                                -------  -------
  // ads.setGain(GAIN_TWOTHIRDS);  // 2/3x gain +/- 6.144V  1 bit = 3mV      0.1875mV (default)
  // ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV
  // ads.setGain(GAIN_TWO);        // 2x gain   +/- 2.048V  1 bit = 1mV      0.0625mV
  // ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit = 0.5mV    0.03125mV
  // ads.setGain(GAIN_EIGHT);      // 8x gain   +/- 0.512V  1 bit = 0.25mV   0.015625mV
  ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.125mV  0.0078125mV
  
  ads.begin();
}

void loop(void) 
{
  int16_t adc0, adc1, adc2, adc3;
  float volts0, volts1, volts2, volts3;

  adc0 = ads.readADC_SingleEnded(0);
  adc1 = ads.readADC_SingleEnded(1);
  adc2 = ads.readADC_SingleEnded(2);
  adc3 = ads.readADC_SingleEnded(3);

  volts0 = ads.computeVolts(adc0);
  volts1 = ads.computeVolts(adc1);
  volts2 = ads.computeVolts(adc2);
  volts3 = ads.computeVolts(adc3);

  Serial.println("-----------------------------------------------------------");
  Serial.print("AIN0: "); Serial.print(adc0); Serial.print("  "); Serial.print(volts0); Serial.println("V");
  Serial.print("AIN1: "); Serial.print(adc1); Serial.print("  "); Serial.print(volts1); Serial.println("V");
  Serial.print("AIN2: "); Serial.print(adc2); Serial.print("  "); Serial.print(volts2); Serial.println("V");
  Serial.print("AIN3: "); Serial.print(adc3); Serial.print("  "); Serial.print(volts3); Serial.println("V");

  delay(1000);
}

Console output

AIN0: 46  0.01V
AIN1: 46  0.01V
AIN2: 47  0.01V
AIN3: 131  0.02V
-----------------------------------------------------------
AIN0: 209  0.03V
AIN1: 168  0.02V
AIN2: 166  0.02V
AIN3: 80  0.01V
-----------------------------------------------------------
AIN0: 46  0.01V
AIN1: 46  0.01V
AIN2: 47  0.01V
AIN3: 87  0.01V
-----------------------------------------------------------
AIN0: 47  0.01V
AIN1: 87  0.01V
AIN2: 128  0.02V
AIN3: 128  0.02V
-----------------------------------------------------------
AIN0: 86  0.01V
AIN1: 86  0.01V
AIN2: 47  0.01V
AIN3: 47  0.01V
-----------------------------------------------------------
AIN0: 46  0.01V
AIN1: 46  0.01V
AIN2: 47  0.01V
AIN3: 129  0.02V

What is “Any”?

Sory. No inputs are connected to A0, A1, A2 and A3.

Well, that would be a problem . You must short the inputs to ground to test, you’re picking up stray charge on very high impedance inputs.

Even with inputs shorted, as they should be to test zero, a gain of 16 will have some noise when you configure the inputs as single ended.

You’ll most likely need to use differential mode to get good results at those higher PGA settings. You’re resolving microvolts there, difficult to do in a hobby environment without proper power supplies, sensors and wiring.

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