ADS1115 4-channel x 3?

Hello!

1.- Could it be possible using 3 x ADC to I2C modules of 4 channels each one (https://www.adafruit.com/product/1085) since I will have 11 analog sensors connected the IoT Node with a Prticle Boron (https://docs.sentientthings.com/), and how?

or should I use this from ncd.io: https://store.ncd.io/product/analog-to-digital-converter-16-channel-12-bit-with-i2c-interface/

But I noticed the I2C lines in IoT Node is of 3.3V and the device from ncd.io requires 5V

Note: From this (https://www.adafruit.com/product/1085) should I remove the I2C resistor or leave it like that?

You can have up to four ADS1015 or ADS1115 on a single I2C bus, so that should work fine.

You connect the ADDR pin to one of VDD, GND, SDA, or SCL to select one of the four possible I2C addresses. Just connect each of your three differently so they have unique addresses.

1 Like

Thanks @rickkas7

Should I change something to this library which is in particle web IDE: ADAFRUIT_ADS1X15, because in this example I dont know how to manage the 3 modules :slight_smile:

#include "Adafruit_ADS1X15.h"

Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */
//Adafruit_ADS1015 ads;     /* Use thi for the 12-bit version */


// CONNECT PHOTON TO ADS1115 BOARD AS FOLLOWS:
//
//  PHOTON PIN  ->  ADS11x5 PIN
//  ----------      -----------
//  3.3V        ->  VDD
//  GND         ->  GND
//  D0          ->  SDA (I2C DATA)
//  D1          ->  SCL (I2C CLOCK)
//  D2          ->  ALERT

void setup(void) 
{
  Serial.begin(9600);
  Serial.println("Setup..");
  
  // The ADC input range (or gain) can be changed via the following
  // functions, but be careful NEVER TO EXCEED +0.3V OVER VDD ON GAINED INPUTS,
  // or exceed the upper and lower limits if you adjust the input range!
  // Setting these values incorrectly may DESTROY your ADC!
  //
  //  *** TAKE CARE WHEN SETTING GAIN TO NOT EXCEED ABOVE LIMITS ON INPUT!!
  //                                                                    ADS1015   ADS1115
  //                                                                    -------   -------
   ads.setGain(GAIN_TWOTHIRDS);  // 2/3x gain +/- 6.144V  1 bit =       3mV       0.1875mV (DEFAULT)
  // ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit =     2mV       0.125mV
  // ads.setGain(GAIN_TWO);        // 2x gain   +/- 2.048V  1 bit =     1mV       0.0625mV
  // ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit =     0.5mV     0.03125mV
  // ads.setGain(GAIN_EIGHT);      // 8x gain   +/- 0.512V  1 bit =     0.25mV    0.015625mV
  // ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit =     0.125mV   0.0078125mV  
  ads.begin();
  
  Serial.println("Getting single-ended readings from AIN01,2,3");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 0.1875mV for ADS1115)");

}

void loop(void) 
{
  double multiplier = 0.1875F; //milli Volts per bit for ADS1115
  //double multiplier = 3.0F; //milli Volts per bit for ADS1105

  short adc0, adc1, adc2, adc3;
  double av0, av1, av2, av3;
  
  adc0 = ads.readADC_SingleEnded(0);
  av0 = adc0 * multiplier;
  adc1 = ads.readADC_SingleEnded(1);
  av1 = adc1 * multiplier;
  adc2 = ads.readADC_SingleEnded(2);
  av1 = adc1 * multiplier;
  adc3 = ads.readADC_SingleEnded(3);
  av3 = adc3 * multiplier;
  
  Serial.print("AIN0: "); Serial.print(adc0); Serial.print(", AV0: "); Serial.print(av0,7); Serial.println("mV");
  Serial.print("AIN1: "); Serial.print(adc1); Serial.print(", AV1: "); Serial.print(av1,7); Serial.println("mV");
  Serial.print("AIN2: "); Serial.print(adc2); Serial.print(", AV2: "); Serial.print(av2,7); Serial.println("mV");
  Serial.print("AIN3: "); Serial.print(adc3); Serial.print(", AV3: "); Serial.print(av3,7); Serial.println("mV");
  Serial.println(" ");
  
  delay(1000);
}

You need to create a separate object for each address:

Adafruit_ADS1015 adc0(0x44);
Adafruit_ADS1015 adc1(0x45);
Adafruit_ADS1015 adc2(0x46);

Initialize each of the three, set the gain, etc… You may want to use an array and a loop instead of duplicating the code for each.

Then when you read the ADC, you use whatever object adc0, adc1, etc. you want to read.

4 Likes

Thanks a lot! I will try that!

ADS1115 should represent a better option instead ncd.io module for connecting to the IoT Node of 3.3v I2C logic?

Both will work. The NCD Feather NodeLync adapter has a 5V I2C level shifter on it so the voltages are compatible.

As for your question about the I2C pull-ups. I think the Adafruit boards have 10K pull-ups. When you have three boards, they’re in parallel, so the effective pull-up is 3.3K, which is within the I2C spec. If you have five 10K I2C pull-ups in parallel you’re getting into potentially not working territory.

1 Like

Thanks @rickkas7. I will do that!

As another option, there’s also the SparkFun Qwiic ADS1015. These boards connect together with a small ribbon cable (like the NodeLync) but run I2C at 3.3V, so you can run it off the built-in Boron power supply or LiPo.

1 Like

@rickkas7 according to the ADS1115 I found this library for Particle (https://github.com/kooscode/Adafruit_ADS1X15/tree/master/firmware), but I noticed in the .h file has the next line: #define ADS1015_ADDRESS (0x48) // 1001 000 (ADDR = GND)

Should I change something to the .h file or .cpp file ? Or just to create a separate object for each address in the main program (.ino)?

Thanks in advance

That constant is the default. You can pass other constants to the constructor without modifying the library, as in my example above.

1 Like

IMO you will not regret the 16 bit A/D of the ADS 1115 Compared to a 12 bit converter.
Remember: 12 bits is only 4,096 “steps” of resolution. Not enough in many applications.

1 Like

Also the ADS1015 is not 12-bits rail-to-rail. Because of the way the voltage reference and gain control works, if you need to measure a 3.3V the closest is ADS1015_CONFIG_PGA_1 gain mode which is a scale of +/-4.096V. Note that the input is still limited to VDD with an absolute maximum rating of VDD+0.3V. This only controls what the scale of +/- 2048, 12 bits, corresponds to.

In that mode, reading a single-ended input results in 0-1652, not 0-4095, so having the extra bits is helpful if you need the resolution.

1 Like

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