1
\$\begingroup\$

I am trying to read a differential voltage with an ADS1115 (https://www.amazon.fr/gp/product/B07RJT3GHC/) hooked up to a Teensy 4.1. I am using Adafruit_ADS1015 library (https://github.com/adafruit/Adafruit_ADS1X15) which also supports ADS1115 (but it doesn't look like it was really developed for the latter).

I have two wires, respectively connected to the A0 and A1 inputs of the ADS1115. I managed to read a voltage which becomes 0 when I short the two wires. When I let them hanging, the raw values are comprised between +/- 32,768 = +/- 2^15. Yet, it looks like all the raw values are multiples of 16 = 2^4 (=3mV) as if my actual resolution was 12 bits and not 16.

How can I use the full 16 bits resolution? I feel like it may have something to do with the sampling rate but I am not too sure.

Here is my code:

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

Adafruit_ADS1115 ads_0(0x48);

void setup(void)
{
  Serial.begin(9600);
  ads_0.begin();
  ads_0.setGain(GAIN_TWOTHIRDS);
}

void loop(void)
{
  int16_t v0;
  float multiplier = 0.1875;
  v0 = ads_0.readADC_Differential_0_1();

  Serial.print(v0); Serial.print(","); Serial.println(v0 * multiplier);

  delay(10);
}

And here are some typical values that I get in the serial.

384,72.00
352,66.00
64,12.00
464,87.00
80,15.00
-64,-12.00
96,18.00
304,57.00
416,78.00
16,3.00
-16,-3.00
160,30.00
496,93.00
64,12.00
-64,-12.00

Thanks a lot for your help!

\$\endgroup\$
1
  • \$\begingroup\$ I had worked with ADS1115 and I also had the fake verson issue, se sure to by one from Adafruit or similar which include also the breakout board. Anyways, maybe there is also something wrong with the differential connection. Can you provide an schematic of your setup?. \$\endgroup\$
    – bardulia
    Commented Mar 26, 2023 at 15:52

2 Answers 2

1
\$\begingroup\$

While it's most likely that you have a re-badged or defective device, don't write it off just yet.

They way you described your testing procedure (leave them hanging) is dubious. Floating inputs are not a good way to determine if the thing is working or not. However unlikely, there may be some correlation between the missing lower bits and the signal "seen" by the ADC when the inputs are floating, so rule that out first.

Connect them both to unambiguous potentials, and alter their potential difference:

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
0
\$\begingroup\$

Edit:

This seems like something you're doing wrong with the library or the library has an issue.

Check that you have the latest version ... there is a .1115 header file available. If the software thinks you have a 1015 you'll get the results you are getting.


Did you set this correctly?:

  /* Be sure to update this value based on the IC and the gain settings! */

  float   multiplier = 3.0F;    /* ADS1015 @ +/- 6.144V gain (12-bit results) */
  //float multiplier = 0.1875F; /* ADS1115  @ +/- 6.144V gain (16-bit results) */
\$\endgroup\$
6
  • \$\begingroup\$ Yes, I did set it in the loop to 0.1875 since I want 16-bit resolution. \$\endgroup\$
    – loulou
    Commented Feb 2, 2021 at 15:21
  • \$\begingroup\$ Thanks! But I couldn't find the 1115 header file. Do you have a link please? \$\endgroup\$
    – loulou
    Commented Feb 2, 2021 at 15:40
  • \$\begingroup\$ github.com/addicore/ADS1115 \$\endgroup\$ Commented Feb 2, 2021 at 15:40
  • 1
    \$\begingroup\$ @loulou Depends where you got it. Aliexpress and ebay are full of re-marked, counterfeit, or sometimes just generally inferior parts. Digikey, Mouser and probably a few others with small order sales are more reliable but more expensive. \$\endgroup\$
    – K H
    Commented Feb 3, 2021 at 10:05
  • 1
    \$\begingroup\$ Could be fake or a re-marked ADS1015 if you got it from a dubious source. Check the part number and the appearance compared to known-good chips. \$\endgroup\$ Commented Feb 3, 2021 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.