Coding for conductivity measurement using Arduino and 16 bit ADC

by Revolutionary Citron   Last Updated May 15, 2019 22:25 PM

I am using a 16 bit ADC (Adafruit) connected to Arduino UNO through I2C. When I use differential mode to measure water conductivity (I plug jumper wires into pins A0 and A1 on the ADC), my numbers are always fluctuating, and always different. Even if I touch the two pins together I always get crazy values that are always different. Sometimes my values even go past 65,000, for example it'll show one hundred thousand or the digit in the ten thousands place (the 1 in 10,000 for example) will increase while all of the other digits stay the same. For example, it might fluctuate between 9355 and 15355, or sometimes even jump between 10,000 and 100,000. I have tried differential and single ended, neither work. I feel like differential would work better in theory because it would minimize noise but that really hasn't happened in reality.

Is the problem with my design? I have a very simple design, just the arduino connected to the ADC through a breadboard, and two wires going out of A0 and A1. No capacitors, no resistors, etc. The ADC address is 0x48, so I have the ADR pin connected to GND.

Or is the problem with my software? I looked at many other websites and can't seem to find how to change my code. Here is the Arduino code:

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

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
Adafruit_ADS1115 ads1115  (0x48); 


void setup() {
   Serial.begin(9600); 
   lcd.begin(16,2); 
   ads1115.begin();

; }

 void loop() {  
        int16_t results;
        results = ads1115.readADC_Differential_0_1();
        lcd.setCursor(0,0);
        lcd.print("Salinity:");
        lcd.setCursor(0,1); 
        lcd.print(results); 
        delay(50); //delay before looping'
```
Tags : arduino code


Related Questions


Updated March 26, 2018 01:25 AM

Updated March 27, 2018 00:25 AM

Updated June 12, 2015 09:10 AM

Updated July 18, 2015 14:10 PM

Updated November 12, 2017 21:25 PM