Sampling rate issues with ADS1115
Posted: Wed Dec 09, 2020 12:56 pm
Hey everyone!!
I am a newbie here so forgive my ignorance. Hopefully, I am posting in the right place (if not, please indicate where shall I post it).
My goal is to use the ads1115 with my ESP32 FIRE-BEETLE board, in the Arduino.
The example given in the respective library(Adafruit_ADS1015) is working but I have a question to ask.
The adc is configured in single-shot mode. To my understanding, this means that the desired sample rating is achieved by "calling"
the ads.readADC_SingleEnded method in a specified rate, inside a loop. Something like this:
This would work if i needed a sampling of 1Hz. But what if I need much faster samping?
Before I decrease the delay and having on my mind that I require a 100Hz sampling rate or greater, I tried to find out how long does it take to make a read. So, I tested the following:
Printing the endit-start value, I should get the time elapsed in order to make a read. The result I get is 9msec.
Now, the problem-limitation is that this means that a sampling of let's say128Hz is not possible. That's because 128Hz means that I need to get a value every 0,0078125sec or about 7.8msec...
How am I supposed to do so, if the actual read takes longer than that?
Thanks in advance
I am a newbie here so forgive my ignorance. Hopefully, I am posting in the right place (if not, please indicate where shall I post it).
My goal is to use the ads1115 with my ESP32 FIRE-BEETLE board, in the Arduino.
The example given in the respective library(Adafruit_ADS1015) is working but I have a question to ask.
The adc is configured in single-shot mode. To my understanding, this means that the desired sample rating is achieved by "calling"
the ads.readADC_SingleEnded method in a specified rate, inside a loop. Something like this:
Code: Select all
value = ads.readADC_SingleEnded(...)
delay(1000) // skip 1 sec
Before I decrease the delay and having on my mind that I require a 100Hz sampling rate or greater, I tried to find out how long does it take to make a read. So, I tested the following:
Code: Select all
start = millis();
value = ads.readADC_SingleEnded(0);
endit = millis();
Now, the problem-limitation is that this means that a sampling of let's say128Hz is not possible. That's because 128Hz means that I need to get a value every 0,0078125sec or about 7.8msec...
How am I supposed to do so, if the actual read takes longer than that?
Thanks in advance