SPS output rate using ads1115

Hi,
I'm taking differential measures from two analog inputs with ads1115. Then I'm connecting the ADC to an Arduino Mega.

In my code, I'm setting the SPS at the output of the ads (for example 860 SPS), but when I read the values from the Arduino I get only 101 samples over one second. This decrease in sample appears also for lower rates (for example with 8 SPS I only get 5 values).

Why does this happen? Does it depend on the Arduino or is it the fault of the ad?

Thank you for helping

I am not sure how you are counting but in my digital mind 5 = 6 and 0 = 1, Try reading channels 0 - 5, I think you will get six results. The ADS111x have two available conversion modes: single-shot and continuous-conversion. In single-shot
mode, the ADC performs one conversion of the input signal upon request, stores the conversion value to an
internal conversion register, and then enters a power-down state. This mode is intended to provide significant
power savings in systems that only require periodic conversions or when there are long idle periods between
conversions. In continuous-conversion mode, the ADC automatically begins a conversion of the input signal as
soon as the previous conversion is completed. The rate of continuous conversion is equal to the programmed
data rate. Data can be read at any time and always reflect the most recent completed conversion. What mode are you using. If you do not have the data sheet go to this link: https://www.ti.com/lit/ds/symlink/ads1115.pdf This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil

This product is 10 years old and from Texas Instruments. If it had a real issue like that it would not be sold.

Without your hardware and software we will just guess where your real issue is. How about you provide the schematic for the A/D to Arduino connection and a short example program that demonstrates the behaviour?

Are you using Serial.print() to display the results in real-time? If so are you using 9600 baud?
Please post your code...

gilshultz:
I am not sure how you are counting but in my digital mind 5 = 6 and 0 = 1, Try reading channels 0 - 5, I think you will get six results.

Seriously wonder how you think you can read channels 4 and 5 on an ADS1115. Did you ever try?

Ale5:
Why does this happen? Does it depend on the Arduino or is it the fault of the ad?

The ADS1115 is fine, a pretty neat device. Small, cheap, accurate and reasonably fast. The problem is quite certainly in the part you didn’t post (schematics, code - you know, the works).

Hi,
thanks to everybody that answered. You're right, I'm sure the problem is in my work, I never meant to say that the ads isn't good enough :sweat_smile:

MarkT:
Are you using Serial.print() to display the results in real-time? If so are you using 9600 baud?
Please post your code...

Here is my code:

#include "ADS1115.h"
#include "I2Cdev.h"

ADS1115 ads(ADS1115_DEFAULT_ADDRESS);
float A;
float B;

void init_ads1115() {
    ads.initialize();  
    ads.setGain(ADS1115_PGA_4P096);
    ads.setRate(ADS1115_RATE_8); // or 860
    ads.setMode(ADS1115_MODE_SINGLESHOT);  
  }

void setup(void) {

    Wire.begin();
    Serial.begin(115200); 
    init_ads1115();
  }

void loop(void){

     //differential measures
     A=ads.getConversionP0N1();
     B= ads.getConversionP2N3();  
    
     Serial.print("A: "); Serial.print(A*ads.getMvPerCount()); Serial.print(",  ");
     Serial.print("B: "); Serial.print(B*ads.getMvPerCount()); Serial.print(",  ");
     Serial.println(" ");
 }

Klaus_K:
How about you provide the schematic for the A/D to Arduino connection and a short example program that demonstrates the behaviour?

The schematic is the following: I'm connecting the corresponding SDA and SCL on the ads and the arduino, the VDD on the ads to the 5V of the arduino, the GND and the ADDR of ads to the GND of arduino. I'm doing differential measures, so the pins A1 and A3 are connected to the ground of the arduino while the pins A0 and A2 measure the output of two photodetectors.

From the serial monitor, over one second I read 5 measures if I set the ads SPS (ads.setRate(ADS1115_RATE_8)) to 8, or 101 measure if the SPS is set to 860.

I hope I have given all the useful information

Thank you for your help again

Please indicate the exact library you are using. Where you downloaded it and the version number if possible.

MarkT:
Please indicate the exact library you are using. Where you downloaded it and the version number if possible.

The library is i2cdevlib, I downloaded it from here:

As a test, don't print in the sample loop, and use millis() to measure the sample rate.

jremington:
As a test, don't print in the sample loop, and use millis() to measure the sample rate.

Ok I will try as soon as possible; but in any case what should I conclude from it, either I get the "right" sample rate from millis() or not?

Thank you!

Measure the rate, and draw your conclusions accordingly.

i have the same problem :

i use this library : GitHub - soligen2010/Adafruit_ADS1X15: Driver for TI's ADS1x15: 12 and 16 bit Differential or Single-Ended ADC with PGA and Comparator

i have two files (in attachment)

i should have as Voltage V=1.27 but because of lake of SPS i can t have the good value,
see below the result i have :

samples=184
Get_SPS = 224
Get_Gain = 1024
Time calcul QC_etc= 1003
I=0.48A
V=1.05 V
P=-0.12 W
S=0.51 W
cos phi=-0.24
samples=184
Get_SPS = 224
Get_Gain = 1024
Time calcul QC_etc= 1002
I=0.46A
V=1.06 V
P=-0.12 W
S=0.48 W
cos phi=-0.24

i use different sps 128 250 475 and they seem all “wrong” with the Get_SPS or when i count them in the while loop…

thanks for help

ElecUtil.h (4.31 KB)

main.ino (1.25 KB)