ADS 1115 Wire Length Issue

Hello,

Im using an Adafruit 16 bit ADS 1115. My objective is to connect sensors from a long distance. Hence, I figured id use an ADC to convert the signal so that it can be carried digitally for a long distance. When using short wires (the wires that come with the Arduino kit) everything works perfectly, however when I switch to using long wires (about 25m long) the Arduino no longer reads anything and gets stuck on line int reading = ADS.readADC_SingleEnded(0); I know this because i added print statements after every function and can see everything before this line. I have also used an oscilloscope to test the signals of SCL and SDA, and have seen that for some reason when using the long (25m wires) there is no signal to SCL and SDA although the 5V VDD is fine. Attached below are the code, circuit diagram, and pictures of the ADS1115 as well the long and short wire oscilloscope pictures.

I've done the continuity test on the long wires to see if there is any damage, but the signals all good for all 4 strands. I use 4 strands to connect the ADS1115 VDD, GND, SCL, SDA to the Arduino just as I do with the short wires. I am unsure of what the problem can be. Anyone have an idea of why it is not working with the long wires?


///for file program
#include <Adafruit_ADS1X15.h>
#include <Adafruit_BusIO_Register.h>
#include <Adafruit_GenericDevice.h>
#include <Adafruit_I2CDevice.h>
#include <Adafruit_I2CRegister.h>
#include <Adafruit_SPIDevice.h>
#include <avr/wdt.h>
#include <SD.h>
#include <SPI.h>
#include <LiquidCrystal.h>
#include<LiquidCrystal_I2C.h> //LCD SCREEN
#include <Wire.h>
//File myFile;
int pinCS = 10; // Pin 10 on Arduino Uno & Pin 53 on Arduino Mega

Adafruit_ADS1115 ADS;

 
 
void setup() 
{
  ADS.begin(0x48);
  Serial.begin(115200);
}
 
 
void loop() 
{

  Serial.println("got into loop");
  
  //ADS.setGain(GAIN_TWOTHIRDS); 
  ADS.setGain(GAIN_TWOTHIRDS);
  
  Serial.println("gain 2/3");
 
int reading = ADS.readADC_SingleEnded(0);
 Serial.println("int reading variable");
Serial.print("reading: ");
Serial.println(reading);

}


Code output when using short wires.


Code output when using long wires. Again everything remains exactly the same place except for the wire change. Even when I switch it back to the short wires it works perfectly again.

Circuit diagram A0 is connected to output of 555timer. The 555timer creates the oscillations required for the sensors, I have not gone into detail with the 555timer but rest assured all the resistors, capacitors, and connections are done as per the usual 555 astable timer circuits found online.


Long wire SCL signal.


Long wire SDA signal.


Short wire SCL signal.


Short wire SDA signal.


Adafruit ADS1115

Google I2c bus length

I do have an idea, the cables are too long. You might get that far if you slow the clock a lot. Get the data rate down to 10k and it might work

As you have clearly demonstrated, extending the wires is a very bad idea. Return to the setup that worked.

"The shorter wires, the better" is pretty universally true, except for (hint) antennas.

For intermediate to long distance data transmission, TTL-RS232 (UART) serial is vastly more reliable than I2C or other specialty bus connections, which are designed mostly for use on a single PCB. For very long connections use low baud rates or RS485 differential signaling.

I2C stands for Inter IC Communication. It is designed for interconnects in the centimeter range. As others have pointed out, you have verified there are problems when you exceed this.

As mentioned, I2C was never intended for long distances. You can use I2C extenders and Long distance I2C - #26 by PerryBebbington (and following) might have some useful information.

Awesome, thank you all very much. I had no clue of these limitations. I will research some other methods for long distance communication.

For long I2C wiring you can use active terminator like this:

But for 25m, I think it's better to go with RS485.

Thank you, I will look into the RS485.

Complication is, it will require smarts at both ends, and a protocol to move your data between. Not insurmountable, but more work than you've been doing.

For 25m, if I don't have to pass several concrete walls or to deal with hundreds of neighbors doing the same , I would consider seriously wireless approach.

Thanks again everyone. I will look into wireless solutions as well.

I am currently researching the RS485 integration with Arduino. It seems that a module like a MAX485 module has to be programmed into a single Arduino. In essence i would have to have an Arduino built into every sensor correct?

If thats the case lets assume i want 3 sensors. That would equate to 3 slave Arduino's and 3 slave MAX485. Now on the master Arduino side. It would be 1 master Arduino, but how many master MAX485's (1 or 3)? Currently the MAX485 modules are 2 wires so if i purchase the ones available on the market i assume i will be using 3 master MAX485 modules. However if i design my own can I put 6 wires into a single MAX485 module?

If im getting any of this wrong, by all means please let me know.

how far apart are the three sensors?
if within a foot or so connect them to a local microcontroller using I2C and the microcontroller transmits the information to the remote device using RS485, WiFi, HC-12, etc

Yes

but how many master MAX485's (1 or 3)?

You can only have one for each bus

However if i design my own can I put 6 wires into a single MAX485 module?

No

Have you considered the software involved for 4 different Arduinos?

Will the RS485 be fast enough?

Sensors will be evenly scattered in a radius of about 25m from the master.

sound like you require a microcontroller per sensor
a wireless communications protocol such as ESP32 ESP-NOW maybe a solution

Sounds very much opportunity to go with wireless.
What sensors you actually want to use?

Thank you for the clarification @jim-p it is much appreciated.

I understand that the software part will be tedious.

As for RS485 speed, i understand some delay will have to be incorporated for each slave to account for transmission and processing time in the master. However, after addressing each slave the master should not have any issue reading from multiple slaves at the same time correct? Additionally, the delay i am thinking of is in the millisecond range.

I will look into the wireless option next. To be honest im not very familiar with wireless transmission so im hesitant. My understanding of wireless communication is that it can interfered with very easily from other external sources, and that can effect my data transmission.