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: Reading 4 channels data of ADS1115

Part Number: ADS1115

Hi, 

We are using ADS1115 to read the sensor data on all 4 channels. The requirement is as mentioned. 

1. Reading the data from channel 1 to 4 from ADS1115 and store in the array. 

2. FFT/Goertzel is to be applied on the stored data. So we need minimum 128 samples for FFT and 200 samples for Goertzel from each channel. 

3. As ADS1115 supports 860 samples per second, we can read 128 samples in one second from all 4 channels. In case if we read the data from 2 channels, we can read 256 samples. Is this understanding correct? 

4. We have implemented Goertzel algorithm and verified. During testing we have found that the algorithm works fine when we are reading only one ADS1115 channel (it could be either channel 1 or channel 2 but one channel at a time). But when we read 2 channels one after another and implement the Goertzel algorithm, the output of algorithm is not as expected. 

We would like to know if ADS1115 is not giving proper output when we are reading 2 channels one after other? 

We have configured the ADS1115 in continuous mode and we are reading the data periodically through microcontroller timer interrupt (every 5 ms). We have used Atmega328 microcontroller with internal clock of 8 Mhz.

Kindly advice if we are using ADS1115 in correct way.

Thanks,

Purushottam 

  • Hi Purushottam,

    3. As ADS1115 supports 860 samples per second, we can read 128 samples in one second from all 4 channels. In case if we read the data from 2 channels, we can read 256 samples. Is this understanding correct? 

    At a data rate of 860 samples per second, you would be able to read up to 215 samples from each channel in one second. 430 samples from each channel in a second if you use 2 channels. 

    The ADS1115 has an integrated oscillator running at 1 MHz and the output data rate scales proportionally with the oscillator frequency. Because the Internal oscillator drifts over temperature and time, the output data rate may have a +/-10% variation. 

    Even on the lower end you would still be able to read 193 samples per channel in a second if you are muxing through all 4 channels, which is still higher than the 128 samples per channel in a second that you mentioned. 

    We would like to know if ADS1115 is not giving proper output when we are reading 2 channels one after other? 

    When the configuration register is changed during an ongoing conversion (or when operating in continuous conversion mode) the new configuration will not take effect until the ongoing conversion completes.  The new configuration does not reset the digital filter and restart the conversion. This results in a previous conversion data read with the assumption that the data returned is for the new mux configuration.

    You may be having issues when changing the mux configuration where it is not clear when the previous conversion has completed and the new one has started. 

    It is suggested that when continuously cycling the mux, single-shot mode be used instead of continuous mode.

    This will fix the issue of reading a conversion from a previous channel but having it be interpreted as a result from the next selected channel, which may be the reason why you get the results you expect when only reading from one channel, but not when you read 2 channels one after another.

    Best Regards,

    Angel

  • Hi Angel,

    Thanks for the explanation. 

    We have changed the continuous conversion mode to Single shot conversion as suggested for reading 2 channels with 860 samples per second. 

    So the time required for converting 1 sample is approx. 1.16ms. So the Alert pin will be changed from high to low after every 1.16ms. But in our case it is coming after every 5ms.  We have tried changing sampling rate but in all the cases the Alert pin is changing 5 times late . What could be the reason for this?

    The waveform in Blue color is Alert pin status which is changing after every 6.241ms with 860 SPS rate. 

    Regards,

    Purushottam 

  • Hi Purushottam,

    This past weekend was a US holiday, so Angel will respond to you by the end of our day tomorrow (May 31)

    -Bryan

  • Hi Purushottam,

    The Alert pin is active low by default, so what you are looking for is when the line is pulled low rather than when it is high, which is a shorter time as seen in the diagram.

    Best Regards,

    Angel

  • Hi Angel,

    Greetings!!

    I agree that the alert pin will be pulled low when the conversion is completed. So when the ADC is configured with 860SPS the line should be pulled low after every 1.16ms when reading one channel. 

    But in my case the line is getting pulled down after every 6.1ms. That is giving me only 1000ms / 6.1ms =  163 samples per second. 

    So I am wondering why this is happening. Though I am getting correct values of signal which is applied on ADC channel, the missing samples are giving unexpected results for Goertzel magnitude calculation. 

    Thanks,

    Purushottam 

  • Hi Purushottam,

    At 860SPS each conversion takes around 1.16ms to be completed. This time only accounts for the time it takes between the conversion start command has been issued and the conversion result being ready. It is not taking into account the time for the digital I2C communications to program the configuration register to make a conversion with the proper configuration, and to read the result when the conversion has been made, both of which take time.

    The Alert pin will go down after you have read the previous result, issue the next conversion and the conversion result is complete.

    The conversion time only accounts for a part of the 6.1ms it takes between reading the previous result, powering the device back on and issuing a new conversion start through I2C, and the conversion result being ready.

    Have you checked at what rate the digital communications are running? This might be the reason you get similar timings for the alert pin regardless of the data rate selected.

    There are ways to optimize the timing, such as starting the next conversion right before reading from the conversion register, so that the conversion happens while the previous result is being read.

    Best Regards,

    Angel