ads1115 Data acquisition is abnormally slow.

I am using Arduino Due.

The ADS1115 library is used in the link above.

The ADS1115 is working to acquire sensor values of eight channels.
However, if all eight channels get data, it takes a total of 800ms or more.
Because of this, other sensors or communications can not do anything for the first 800 ms.

How can I speed up the ADS1115 I2C data acquisition?

  1. Put ads1.Measure_SingleEnded (0) in a variable directly
    Is it necessary to call the current value or the old value every time in the timer?

  2. Is it better to increase wire.setclock?

  3. Is it better to increase from the 250sps speed a little more?

#include <Wire.h>
#include <ADS1115.h>

ADS1115 ads1;
ADS1115 ads2;
int16_t ADS1115_str[8];
void setup(void) 
{
    Serial.begin(9600);

    ads1.getAddr_ADS1115(ADS1115_DEFAULT_ADDRESS);   // 0x48, 1001 000 (ADDR = GND)
    ads2.getAddr_ADS1115(ADS1115_VDD_ADDRESS);    // 0x49, 1001 001 (ADDR = VDD)


    ads1.setGain(GAIN_TWO);          // 2x gain   +/- 2.048V  1 bit = 0.0625mV (default)
    ads2.setGain(GAIN_TWO);          // 2x gain   +/- 2.048V  1 bit = 0.0625mV (default)


    ads1.setMode(MODE_CONTIN);       // Continuous conversion mode
    ads2.setMode(MODE_CONTIN);       // Continuous conversion mode

    ads1.setRate(RATE_250);       // 250SPS
    ads2.setRate(RATE_250);       // 250SPS
    
    ads1.setOSMode(OSMODE_SINGLE);   // Set to start a single-conversion
    ads2.setOSMode(OSMODE_SINGLE);   // Set to start a single-conversion

    ads1.begin();
    ads2.begin();
    
}

void loop(void) 
{
 ads1115_getData();
 save_SDCARD();
 save_GPS();
 send_MODBUS();
}

void ads1115_getData(void){
  byte error1, error2;
    int8_t address1, address2;
    address1 = ads1.ads_i2cAddress;
    address2 = ads2.ads_i2cAddress;
    
    Wire.beginTransmission(address1);
    Wire.beginTransmission(address2);
    error1 = Wire.endTransmission();
    error2 = Wire.endTransmission();
    
    if (error1 == 0 )
    {
        ADS1115_str[0] = SENSOR_TYPE(1, ads1.Measure_SingleEnded(0), ADC01_RAW_LOW, ADC01_RAW_HIGH, ADC01_REFERENCE_LOW, ADC01_REFERENCE_HIGH, ADC01_OFFSET);

    ADS1115_str[1] = SENSOR_TYPE(2, ads1.Measure_SingleEnded(1), ADC02_RAW_LOW, ADC02_RAW_HIGH, ADC02_REFERENCE_LOW, ADC02_REFERENCE_HIGH, ADC02_OFFSET);

    ADS1115_str[2] = SENSOR_TYPE(3, ads1.Measure_SingleEnded(2), ADC03_RAW_LOW, ADC03_RAW_HIGH, ADC03_REFERENCE_LOW, ADC03_REFERENCE_HIGH, ADC03_OFFSET);

    ADS1115_str[3] = SENSOR_TYPE(4, ads1.Measure_SingleEnded(3), ADC04_RAW_LOW, ADC04_RAW_HIGH, ADC04_REFERENCE_LOW, ADC04_REFERENCE_HIGH, ADC04_OFFSET);

    ADS1115_str[4] = SENSOR_TYPE(1, ads2.Measure_SingleEnded(0), ADC05_RAW_LOW, ADC05_RAW_HIGH, ADC05_REFERENCE_LOW, ADC05_REFERENCE_HIGH, ADC05_OFFSET);

    ADS1115_str[5] = SENSOR_TYPE(2, ads2.Measure_SingleEnded(1), ADC06_RAW_LOW, 
ADC06_RAW_HIGH, ADC06_REFERENCE_LOW, ADC06_REFERENCE_HIGH, ADC06_OFFSET);

    ADS1115_str[6] = SENSOR_TYPE(3, ads2.Measure_SingleEnded(2), ADC07_RAW_LOW, ADC07_RAW_HIGH, ADC07_REFERENCE_LOW, ADC07_REFERENCE_HIGH, ADC07_OFFSET);

    ADS1115_str[7] = SENSOR_TYPE(4, ads2.Measure_SingleEnded(3), ADC08_RAW_LOW, ADC08_RAW_HIGH, ADC08_REFERENCE_LOW, ADC08_REFERENCE_HIGH, ADC08_OFFSET);
   
    }
    else
    {
        Serial.println("ADS1115 Disconnected!");
    }
    Serial.println(ADS1115_str[0]);
    Serial.println(ADS1115_str[1]);
    Serial.println(ADS1115_str[2]);
    Serial.println(ADS1115_str[3]);
    Serial.println(ADS1115_str[4]);
    Serial.println(ADS1115_str[5]);
    Serial.println(ADS1115_str[6]);
    Serial.println(ADS1115_str[7]);
    
}


uint16_t SENSOR_TYPE(byte sensor_type, uint16_t sensor_value, float ADC_RAW_LOW, float ADC_RAW_HIGH, float ADC_REFERENCE_LOW, float ADC_REFERENCE_HIGH, float ADC_OFFSET) {

  if (sensor_type == 0) {
    return sensor_value;
  } else if (sensor_type == 1) {
    return CURRENT_SENSOR(sensor_value, ADC_RAW_LOW, ADC_RAW_HIGH, ADC_REFERENCE_LOW, ADC_REFERENCE_HIGH, ADC_OFFSET);
  } else if (sensor_type == 2) {
    return WIND_SENSOR(sensor_value, ADC_RAW_LOW, ADC_RAW_HIGH, ADC_REFERENCE_LOW, ADC_REFERENCE_HIGH, ADC_OFFSET );
  } else if (sensor_type == 3) {
    return SINGLE_PHASE_VOLTAGE_SENSOR(sensor_value, ADC_RAW_LOW, ADC_RAW_HIGH, ADC_REFERENCE_LOW, ADC_REFERENCE_HIGH, ADC_OFFSET);
  } else if (sensor_type == 4) {
    return THREE_PHASE_VOLTAGE_SENSOR(sensor_value, ADC_RAW_LOW, ADC_RAW_HIGH, ADC_REFERENCE_LOW, ADC_REFERENCE_HIGH, ADC_OFFSET);
  } else if (sensor_type == 5) {
    return IRRADIATION_AMOUNT(sensor_value, ADC_RAW_LOW, ADC_RAW_HIGH, ADC_REFERENCE_LOW, ADC_REFERENCE_HIGH, ADC_OFFSET);
  }
}

I found a variable that controls the conversion delay time.

#define ADS1115_CONVERSIONDELAY         (100)

Since it was 8 channels x 100ms, 800ms seems to have come out.
But I don't know how to determine this calculation time to facilitate operation between different sensors.

What is this:

    Wire.beginTransmission(address1);
    Wire.beginTransmission(address2);
    error1 = Wire.endTransmission();
    error2 = Wire.endTransmission();

You may not mix two of those.

narutorobot:
I found a variable that controls the conversion delay time.

#define ADS1115_CONVERSIONDELAY         (100)

That would explain the 800ms, but I can only find a delay of 8 ms.

I can find the 100ms, but that is somewhere else.

It's not your complete code, therefore quite likely the problem is in the part you didn't post.

Also please remember to remove excessive while lines and properly format your code before posting. The IDE offers a very convenient autoformat function for that.

The library states:

ADS1015: 12-bit Differential or Single-Ended ADC

Could you explain why you are not using the builtin ADC peripheral ?