Issues with ADS1115 "adc.init()" command

Hi, this is my first post on the forum so I hope I'm doing this right...

For context, I'm using the ADS1115 to read analog inputs from a pressure transducer. My code has been working perfectly until moments ago (I didn't change anything in the code) when suddenly I found that there's an issue with configuring the register.

The code gets hung up in my "void setup" section:

void setup() {
  // Start serial:
  Wire.begin();
  Serial.begin(9600);

Serial.println("Checkpoint 1");
  // Initialize ADC stuff: 
  if(!adc.init()){
    Serial.println("ADS1115 not connected!");
    Serial.println("Checkpoint 1.1");
  }

Serial.println("Checkpoint 2");

  adc.setVoltageRange_mV(ADS1115_RANGE_6144); // equates to +/- 6144 mV
}

The serial monitor output that I get from this code is "Checkpoint 1," but we never make it to Checkpoint 1.1 or Checkpoint 2. Thus, I figure the issue is with adc.init(), which according to some documentation, this "sets the configuration register to default values. Returns false if the ADS1115 is not connected."

If anyone has any suggestions/insights, that would be greatly appreciated!


P.S. Some things I've tried:

  1. Turning everything on/off again
  2. Installing the newest ADS1115 library
  3. Running other code to ensure it's not an issue with the serial communication (it's not.)
  4. Checking that the appropriate voltages are running through the ADC using a multimeter.

Code doesn't run differently at different times. You must have a hardware problem.

If you are using a breadboard, move all the wiring by a few notches. They can be unreliable.

Please post a clear, closeup picture of the solder connections on the ADC module.

The ADS1115 could be the wrong choice.
Most pressure transducers need a ratiometric A/D, which the ADS is not.
Post a link to the transducer.
Which Arduino, and a diagram/picture could also be important.
Leo..

Does you ADS1115 library have an example? If so I would run that.

There is a lot of pointing to hardware but its not clear what hardware would cause it to hang at the location you suggested. My guess would be the adc.init() is not returning.

If no example try
Serial.println(adc.init());

when all the possible causes have been exhausted, start looking at the impossible causes

Hi Leo, thanks for this insight--this is news to me. I'm using an Arduino Uno --> ADS1115 --> Dwyer 626-08-Cb-p1-e5-s1. Can you explain what a ratiometric A/D is and why you would use one for a pressure transducer?

Thanks. I switched over to some MATLAB code that was working previously on the ADS1115, and luckily MATLAB threw an error that confirmed this:

I swapped out the ADS1115 for a fresh one & everything is back up and running smoothly again. Thanks!

Happy to help. Now you have to think back to what might have happened to destroy the ADS.

Ratiometric pressure sensors output pressure as a ratio of their supply. Not just a voltage.
You linked to a family of sensors, so I still don't know which one you have.
Choosing the wrong combination of sensor and A/D makes pressure reading of the setup also go up/down with supply variations.

This line comes from the datasheet, and lists the different outputs they can come in.

"10 to 30 VDC (for 4 to 20 mA, 0 to 5, 1 to 5, 1 to 6 VDC outputs); 13 to 30 VDC (for 0 to 10, 2 to 10 VDC outputs); 5 VDC ±0.5 VDC (for 0.5 to 4.5 VDC ratio-metric output), 10 to 35 VDC (for 4 to 20 mA with -CB option); 13 to 35 VDC or isolated 16 to 33 VAC (for selectable output with -CB option)."

Only the 4-20mA or 'voltage' outputs should be read with an ADS1115.
A voltage divider is needed for the 'voltage' outputs, to keep ADS input within the 3.3volt supply it should be powered with (for the 3.3volt-logic ESP32).
Leo..

1 Like

Missed this the first time around.

The reason rationmeteric sensors are desirable is:
First it is important the sensor voltage and the A/D reference be the same. Given that,

Over small ranges of voltage (5V for this discussion) the voltage for the sensor and the voltage for the A/D will cancel and have very low effect on the resultant reading.

Assume the sensor is at 50% and the power is 5V. the output will be 2.5v
If the A/D reference is 5v then the A/D conversion of 2.5V will result in (1024 counts / 5v) *2.5v = 1024 /2

Now if the 5V -> 5.2V
then the sensor output is 2.6v therefore the counts will be (1024 / 5.2) * 2.6 =1024/2

This is not a 100% cancellation of the 5v variation, there is another term we didn't consider above, that is the (we will assume a pressure sensor) kPa/volt value. However is you assume the 5v will be between 4.8 and 5.2 the kPa/volt value is very small.

1 Like

Absolute pressure can be calibrated out, but this supply variation could be 8% fluctuating pressure variation, which is likely not acceptable for an industrial sensor like this.
Leo..

I agree.
The question was why/what is ratiometric.

I didn't even consider anyone would use this sensor on an Arduino using the supply as a reference.

But we still don't know which sensor.
The ADS1115 is perfect for 'this sensor' if the sensor has a 4-20mA output and the ADS has a 100 ohm sense resistor.
Leo..

1 Like

Hi,

Yes, MOST industrial sensors that have analog output are not ratiometric so as to keep their calibration and linearity.
As industrial DC power is basically 24Vdc, and output standards are usually 0-20mA, 4-20mA, 0-5V and 0-10V, output level calibration is "easy" to achieve.

Tom... :smiley: :+1: :australia:

The sensor is the 626-08-CB-P1-E5-S1 with 4-20 mA output.
Below is the basic wiring setup (A1-A3 are also grounded). It works great!

I'm using the 4-20 mA output, so yes--I'm reading with the ADS1115. Thanks!

I would not have used a 250 ohm sense resistor.
That value does not match the sensor-A/D very well, so you don't get full resolution.
Use a 100 ohm resistor instead, and switch the A/D to a PGA gain of 2 (2.048volt).

Your 4-20mA diagram is wrong (swap resistor and sensor).
I hope you have connected it right.
Leo..

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