Arduino Pro Mini to read Adafruit ADS1115 Voltage

Hello,

I’m simply trying to read a voltage divider. The connections are:

Arduino to ADS1115:

A4 → SDA

A5 → SCL

Other ADS1115 Connections:

VDD → 5V

GND → GND

A0 → Voltage divider

The code is right from the Adafruit site. I only changed a few applicable labels from ads1015 to ads1115. The code uploads and the serial monitor gives me:

Hello!

Getting single-ended readings from AIN0…3

ADC Range: +/- 6.144V (1 bit = 188uV)

AIN0: -1

AIN1: -1

AIN2: -1

AIN3: -1

AIN0: -1

AIN1: -1

AIN2: -1

AIN3: -1

AIN0: -1

AIN1: -1

AIN2: -1

AIN3: -1

It just keeps reporting -1 for all four channels! The code is:

#include <Wire.h>
#include <Adafruit_ADS1015.h>

Adafruit_ADS1115 ads1115(0x48);

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 = 188uV)");
  ads1115.begin();
  Wire.begin();
}

void loop(void)
{
  int16_t adc0, adc1, adc2, adc3;

  adc0 = ads1115.readADC_SingleEnded(0);
  adc1 = ads1115.readADC_SingleEnded(1);
  adc2 = ads1115.readADC_SingleEnded(2);
  adc3 = ads1115.readADC_SingleEnded(3);
  Serial.print("AIN0: "); Serial.println(adc0);
  Serial.print("AIN1: "); Serial.println(adc1);
  Serial.print("AIN2: "); Serial.println(adc2);
  Serial.print("AIN3: "); Serial.println(adc3);
  Serial.println(" ");
  
  delay(1000);
}

I wired it as is shown here and I have a single wire going from A0 to a voltage divider:

https://learn.adafruit.com/adafruit-4-c … and-wiring

Do I need to tell the Arduino which pins are SDA, SCL because the Pro Mini doesn’t have dedicated SDA, SCL pins?

I read on another forum that a “-1” may mean that is has timed out.

It basically seems like it’s not responding. Any thoughts?!

The code expects the AD1115 to be configured to adress 0x48. So, if you do not have the adress pin of it connected to GND then it is talking to the wrong adress. Since you don’t mention it I guess it is left floating. Noone knows which adress it responds to now. Connect the adres pin to one of the other pins like the link you gave mentions (GND, Vdd, SCL SDA). And change the adress in the code accordingly.

Hi Valen,

Thanks for the reply! Yes the ADDR pin is connected to GND (forgot to mention it). But the “-1” is still all that’s returned. I used a multimeter to check the pins. I’m getting 5V (VDD), 5V (SDA), 5V (SCL), and about 3V from V-divider to ads1115 pin A0. When I remove or apply voltage to that A0 pin, it still just keeps returning “-1”. So it’s like the Arduino just isn’t measuring anything and -1 is the code saying so. I also checked all jumper wired for continuity and all good there.

Darn, I was hoping it was that simple.

Which Pro Mini version do you have? The 5 volt or the 3(.3)volt? Just to make sure you did not ruin it by applying 5 volts to a 3.3 volt powered device.

And just to make sure you know how a voltage divider works (sorry if that offends you but error-causes can be the silliest things), the 2 resistors in series making up the voltage divider need to have a voltage applied on either end. The divided voltage is read between them. Same goes with a potentiometer, it needs voltages applied to the outside pins, ie. 0v and 5v. The middle should be connected to your ADC-board’s A0 pin.

For the Pro Mini the SDA should be connected to analog pin A4 and SCL to A5. These are not located on the side of the board. But the holes should be marked with A4,A5 on the underside of it.

So it’s like the Arduino just isn’t measuring anything and -1 is the code saying so.

Just to be clear again, the Arduino Pro Mini is not measuring the analog voltage. Your AD1115 board is. The arduino is just telling it to do the measurements and receive it and then sends it to the serial port. So don't connect the voltage divider to the Arduino A0 pin.

I tried to look into the library code why it would send -1 as a result. But my head still needs time waking up.

I though it might still need the pull up resistors for I2C, as the Pro Mini does not have them installed by default. But the AD1115 board has them on it. So that should work. Clueless at the moment.

For the Pro Mini the SDA should be connected to analog pin A4 and SCL to A5. These are not located on the side of the board. But the holes should be marked with A4,A5 on the underside of it.

This was it I was using the outer A4 A5 when I should have been using the inner ones. I’m gettng readings now! Thank you so much!