Go Down

Topic: Arduino Due and ADS1115 (Read 896 times) previous topic - next topic


Hi guys, I need some help to make this ADC from adafruit to work on Due using the SDA1 and SCL1 lines.

Well, I think I have fried the SDA and SCL line in my Due, because I could test the same adafruit with a UNO board and it worked.

As I know there is the SDA1 and SCL1 on the DUE board I am trying to use them. The first problem is that I dont know what I have change in the code. Can someone take a look on it and check if I miss something ?

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

//extern TwoWire Wire1;

Adafruit_ADS1115 ads1115;
double adV0,Vout0;

void setup(void) {

void loop() {
  int16_t adc0;
  adc0 = ads1115.readADC_SingleEnded(0);
  Serial.print("Value AIN0: "); Serial.println(adc0,4);
  adV0 = adc0*0.000125;
  Serial.print("Voltage AIN0: "); Serial.println(adV0,4);



Feb 22, 2017, 02:41 pm Last Edit: Feb 22, 2017, 05:13 pm by AngeloGomes
Hi Guys, just to say that I solved my problem !!!!

First, let me say that my electronics skills is only just above ground and C programming is not for me. I had to search a lot to understand how to make a pullup resistor and how is the compiling process is for arduino. Below, I copy the links that help me to put my system to work.

1) SDA1 and SCL1 pins on due  must be connected to pullup resistors. I did as this link


The 3.3V I got from the arduino pin itself, for resistors I used 1.5k ohms.

In the cited post, the author put the  arduino Due  to communicate between SDA and SDA1 lines in the arduino itself. In my case, the SDA and SCL pins are in my ADS1115, the SDA1 and SCL1 are in the DUE (as I said  before,  I fried the SDA and SCL pins in my DUE).

2) Now the programming part. In order to make it work, I had to change the library for the ADS1115. The file that I changed is Adafruit_ADS1015.cpp which is located inside the arduino/library/Adafruit_ADS1X15

Just edit this file and search for the line:

#include <Wire.h>

Just below this line include this:

extern TwoWire Wire1;

So, now you will have:

#include <Wire.h>
extern TwoWire Wire1;

After this, you need to find every line in this file that has  the word Wire and change to Wire1 .  There is a lot of changes to make. I did it manualy, instead of performing Find/replace automatically.

At the end, you save the library file, go back to your sketch, compile it again, all the libraries will be recompiled with your sketch  and it is done.

You may ask if someday you need the original library to use SCL and SDA lines. Well, in this case, I suppose that it is better you to rename the library that uses SDA1 and SCL1 and perform the changes in the #include statements in your sketch.



Jul 25, 2018, 04:20 pm Last Edit: Jul 25, 2018, 04:33 pm by bhot55

for those like me who had trouble getting this to work...
attached a small project that works (ads1115 on DUE via SDA1 & SCL1  (so the 2 pins close to the reset button of the DUE)  arduino IDE  1.8.4

i ported the functions i needed from the ads adafruit library to a separate file for the DUE, since I also use the ads chip on the arduno & leonardo and don't want to mess up the library.

feel free to use it/test it.

i commented out some parts in case you want to either test timing and print data or use the plotter to see data...

By default, monitor & plotter are connected, (so printing to) the native port of the DUE, not the programmers port.

Go Up