This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS1115: ADS1115 in continuous mode with alternating channels

Part Number: ADS1115

Hi there!

Would starting and stopping "Continuous Mode" inside the main loop enable you to average a bunch of samples and then turn "Continuous Mode" back on for reading some other channel?

Here is what I'm trying to do?

#include <Wire.h>
#include <Nanoshield_ADC.h>

Nanoshield_ADC adc;

void setup()
{
Serial.begin(9600);
adc.begin();
adc.setSampleRate(860);
adc.setGain(GAIN_SIXTEEN);
}

void loop()
{
unsigned long sum = 0; // ADC value sum
adc.setContinuous(true);
// Enter continuous mode and start reading channel 2-3 differential(input A2,A3)
adc.readADC_Differential_2_3(); //Does this initiate the continuous mode conversion?
for (int i = 0; i < 860; i++)
{
sum += readNext(); //reading the differential Amps ADC values
}

adc.setContinuous(false); //does this stop continuous conversion?
Serial.print (sum / 860); //Send average value of differential input to Serial Monitor

adc.setContinuous(true);
// Enter continuous mode and start reading channel 0 (input A0)
adc.readADC_SingleEnded(0);

for (int i = 0; i < 860; i++)
{
sum += readNext(); //reading the single ended Volts ADC values
}

adc.setContinuous(false);
Serial.println (sum / 860); //Send average value of single-eded input to Serial Monitor

}

  • Zac,


    You could run the device in continuous mode, get a bunch of samples and average them to get a lower noise. Note that you must track the ALERT/RDY pin to know when the ADC has completed the conversion. If you read out too slowly, you might miss a read, or if you read out too fast, you might read the same data over.

    Instead of reading multiple data for averaging, I would instead change the data rate. This is more efficient, and you could use single-shot mode to read the data each time. I always find single-shot mode easier for this device. By lowering the data rate, you get the same improvement on noise performance as you would for averaging.


    Joseph Wu