Slow read times for ADS1115 over I2C
I have 4 analogue sensors attached to two separate ADS1115 and I am attempting to sample them at 10Hz, however the read times over I2C are allowing just over 1Hz actual sample rate. Here are the read timings for each of the ADS1115 in ms:
First ADS1115 read time: 318819 microseconds. (3 analogue sensors attached)
Second ADS1115 read time: 425089 microseconds. (4 analogue sensors attached)
This is clearly indicative of something being wrong somewhere. Is there a useful code snippet that may help me set up the ADS1115 to communicate faster of I2C? Does the library support batching?
Here is how I set up the devices:
//Set up the first ADC on 0x49
ads.setAddr_ADS1115(0x49); // 0x49
ads.setGain(eGAIN_TWOTHIRDS); // 2/3x gain
ads.setMode(eMODE_CONTIN); // continuous mode
ads.setRate(eRATE_860); // 128SPS (default)
//ads.setOSMode(eOSMODE_SINGLE); // Set to start a single-conversion
ads.init();
//Set up the second ADC on 0x48
ads.setAddr_ADS1115(0x48); // 0x48
ads.setGain(eGAIN_TWOTHIRDS); // 2/3x gain
ads.setMode(eMODE_CONTIN); // scontinuous mode
ads.setRate(eRATE_860); // 128SPS (default)
//ads.setOSMode(eOSMODE_SINGLE); // Set to start a single-conversion
ads.init();
Thank you for that. That's exactly what I did, I removed both delay(ads_conversionDelay) from DFRobot_ADS1115.cpp
I am now able to read data at rates that are of use to me.
Victor.MajorSince there are some delay() functions in our GitHub repo, you can download the library files and try to minimize the parameters of the delay() functions for debugging.
GitHub repo.
https://github.com/DFRobot/DFRobot_ADS1115