Problems with ADS1115 using ADS1115-Driver library

Hi,

I use the sketch "ReadSingleValue.ino", which is contained in the "ADS1115-Driver" library. Unfortunately, I only get fixed values when I read out the ADC channels. The ADC is supplied with 3.3V and a potentiometer is connected to both AD0 and AD1. Does anyone have an idea where the error could be?

image

#include "Arduino.h"
#include "ADS1115-Driver.h"

ADS1115 ads1115 = ADS1115(ADS1115_I2C_ADDR_GND);

uint16_t readValue(uint8_t input) {
	ads1115.setMultiplexer(input);
	ads1115.startSingleConvertion();

	delayMicroseconds(25); // The ADS1115 needs to wake up from sleep mode and usually it takes 25 uS to do that

	while (ads1115.getOperationalStatus() == 0);

	return ads1115.readConvertedValue();
}

void setup() {
	Serial.begin(9600);

	ads1115.reset();
	ads1115.setDeviceMode(ADS1115_MODE_SINGLE);
	ads1115.setDataRate(ADS1115_DR_250_SPS);
	ads1115.setPga(ADS1115_PGA_4_096);
}

void loop() {
	uint16_t value0 = readValue(ADS1115_MUX_AIN0_GND);
	uint16_t value1 = readValue(ADS1115_MUX_AIN1_GND);
	uint16_t value2 = readValue(ADS1115_MUX_AIN2_GND);
	uint16_t value3 = readValue(ADS1115_MUX_AIN3_GND);

	//Serial.println("Values: ");
  Serial.println("");
	Serial.print("IN 0: ");
	Serial.print(value0);
	Serial.print(" IN 1: ");
	Serial.print(value1);
	Serial.print(" IN 2: ");
	Serial.print(value2);
	Serial.print(" IN 3: ");
	Serial.print(value3);
	Serial.print("");

	delay(1000);
}

Let's have a look at a schematic and a photo of your setup showing how everything is connected.
I also assume you mean two separate pot meters for AD0 and AD1, correct?

Note that the value you're reading is effectively the full scale range of a nominal 14 bit measurement resolution (13 bit on either side of zero, so positive and negative), which suggests you're "maxing out" the channels you're reading. This suggests a connection error, hence the question about the schematic & photo.

Yes, there are two separate potentiometers for AD0 and AD1.
I also measured the voltage on these pins:
On AD0 = 1,94V
On AD1 = 0,72V

Well, that's odd. Given your readings, I'd expect to see this if the ADC is operating at a higher gain; i.e. ADS1115_PGA_0_512 or ADS1115_PGA_0_256.


No, i changed to 5V and used a gain of 2:

ads1115.setPga(ADS1115_PGA_2_048);

But the values are constant 40959 on all 4 channels.

Where is the power supply to your ADS1115 module? I don't see it.

Note that this isn't going anywhere:
image

You may currently be phantom-powering the ADS through its I2C pins or even the ADC inputs, which may result in all manner of funny behavior.

..and the 2 resistor on SDA/SCL seems to be pulldown, instead of pullup!

Ciao, Ale.

Well spotted; not sure how I managed to miss that.

Anyway, that's why I asked for a photo, because all too often, we connect something differently than we think we do!

Thank you guys, it works now.
The supply voltage was wrong connectet. I don't know why I overlooked that. The pull-up resistors are connected to Vcc, that´s ok.

Great, well done! Good to hear it works now.

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