ADS1115 not getting initialized

Hello,

I've connected Arduino Uno with ADS1115. The output shows "Failed to initialize ADS".
I tried the code for esp32 with the same ADS and it works fine. I came across similar questions on the forum, but I still can't solve the issue. I've also connected pull-up resistors for SCL and SDA

THIS IS THE CODE

#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(9600);
  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)");

  ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV

  if (!ads.begin()) {
    Serial.println("Failed to initialize ADS.");
    //while (1);
  }
}

void loop(void)
{
  int16_t adc3;
  float volts3;
  
  adc3 = ads.readADC_SingleEnded(3);
  volts3 = ads.computeVolts(adc3);
  
  Serial.print("AIN3: "); Serial.print(adc3); Serial.print("  "); Serial.print(volts3); Serial.println("V");

  delay(1000);
}

Output :

  1. missing a Wire.begin() in setup
  2. call begin() before calling setGain() as object may not be initialized.

And you may always try my library - GitHub - RobTillaart/ADS1X15: Arduino library for ADS1015 = I2C 12 bit ADC and ADS1115 = I2C 16 bit ADC

Another problem might be that you swapped SCL and SDA

Thank you for replying.

I followed both the steps but it still doesn't work.
I checked the connections thoroughly and they are right.
I went through the library that you provided but I don't see a SingleEnded program?

With a new I2C device, always start with the I2C Address Scanner program.

Check that communications are working, and that the correct I2C address is found (and is used in your program).

It was showing no device found. I checked the connections, they were fine. I checked the soldering again and that's where the issue was! It works now!

Thank you so much!!

Glad that worked!

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