# ADS1115 4-channel x 3?

**URL:** <https://community.particle.io/t/ads1115-4-channel-x-3/57347>\
**Category:** Firmware\
**Created:** [August 10, 2020, 7:18pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347 "2020-08-10T19:18:43Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonamleonel](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jonamleonel](https://community.particle.io/u/jonamleonel)\
**Post date:** [August 10, 2020, 7:18pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/1 "2020-08-10T19:18:43Z")

</div>

Hello!

1.- Could it be possible using 3 x ADC to I2C modules of 4 channels each one ([https://www.adafruit.com/product/1085](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/](https://docs.sentientthings.com/)), and how?

or should I use this from [ncd.io](http://ncd.io): [https://store.ncd.io/product/analog-to-digital-converter-16-channel-12-bit-with-i2c-interface/](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](http://ncd.io) requires 5V

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

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [August 10, 2020, 7:37pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/2 "2020-08-10T19:37:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jonamleonel](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jonamleonel](https://community.particle.io/u/jonamleonel)\
**Post date:** [August 10, 2020, 7:54pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/3 "2020-08-10T19:54:19Z")

</div>

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 🙂

```cpp
#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);
}

```

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [August 10, 2020, 8:00pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/4 "2020-08-10T20:00:00Z")

</div>

You need to create a separate object for each address:

```auto
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.

---

<div class="post-metadata">

**Author:** ![jonamleonel](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jonamleonel](https://community.particle.io/u/jonamleonel)\
**Post date:** [August 10, 2020, 8:24pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/5 "2020-08-10T20:24:10Z")

</div>

Thanks a lot! I will try that!

---

<div class="post-metadata">

**Author:** ![jonamleonel](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jonamleonel](https://community.particle.io/u/jonamleonel)\
**Post date:** [August 10, 2020, 8:26pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/6 "2020-08-10T20:26:48Z")

</div>

ADS1115 should represent a better option instead [ncd.io](http://ncd.io) module for connecting to the IoT Node of 3.3v I2C logic?

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [August 10, 2020, 8:30pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/7 "2020-08-10T20:30:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jonamleonel](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jonamleonel](https://community.particle.io/u/jonamleonel)\
**Post date:** [August 10, 2020, 8:35pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/8 "2020-08-10T20:35:04Z")

</div>

Thanks @rickkas7. I will do that!

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [August 10, 2020, 8:36pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/9 "2020-08-10T20:36:19Z")

</div>

As another option, there’s also the [SparkFun Qwiic ADS1015](https://www.sparkfun.com/products/15334). 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.

---

<div class="post-metadata">

**Author:** ![jonamleonel](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jonamleonel](https://community.particle.io/u/jonamleonel)\
**Post date:** [August 10, 2020, 11:07pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/10 "2020-08-10T23:07:43Z")

</div>

@rickkas7 according to the ADS1115 I found this library for Particle ([https://github.com/kooscode/Adafruit\_ADS1X15/tree/master/firmware](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

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [August 10, 2020, 11:11pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/11 "2020-08-10T23:11:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ThereIsNoSky](https://avatars.discourse-cdn.com/v4/letter/t/b19c9b/32.png) [@ThereIsNoSky](https://community.particle.io/u/ThereIsNoSky)\
**Post date:** [August 15, 2020, 3:11am UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/12 "2020-08-15T03:11:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [August 15, 2020, 1:34pm UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/13 "2020-08-15T13:34:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/6/4/64635adccc35238caa19e9b553ec3e98b163d026.png) [@system](https://community.particle.io/u/system)\
**Post date:** [February 14, 2021, 1:35am UTC](https://community.particle.io/t/ads1115-4-channel-x-3/57347/14 "2021-02-14T01:35:00Z")

</div>

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