I want using Adafruit ADC1115 16 bit ADC module with Arduino Nano board to read a small voltage with sampling rate 180 sample/sec. i try to use the Adafruit example as following , but i just get 123 sample/sec at 16-bit resolution
#include <Wire.h>
#include <Adafruit_ADS1015.h>
Adafruit_ADS1115 ads; /* Use this for the 16-bit version */
//Adafruit_ADS1015 ads; /* Use thi for the 12-bit version */
void setup(void)
{
Serial.begin(115200);
ads.setGain(GAIN_ONE); // 1x gain +/- 4.096V 1 bit = 2mV 0.125mV
ads.begin();
}
void loop(void)
{
int16_t adc0;
adc0 = ads.readADC_SingleEnded(0);
Serial.println(adc0);
}
in ADS1115 specification, the sampling rate is up to 860 sample/sec. is my result normal? how can i increase the sampling rate?
i think serial speed of 115200 is enough for transfer the 16-bit resolution @ 180 sample/second for single channel that i want use it, is there any miss setting in ADC program that i mentioned above ? if there is no additional setting how can i reach the 180 sample/sec. speed with 16-bit resolution.
A 16 bit resolution becomes a number between 0 and 65535. Sending that to the serial port + a return
on average one need to send 6 bytes per value. 6 * 180 == 1080 bytes == 108000 bits (incl start & stop) so it use 10% of the bandwidth. SO yes it will not be a show stopper.
checking the datasheet I see that the device uses I2C to communicate. That defaults to 100Khz Did you try to run it on 400KHz?
Check this I2C scanner to see if it can work at that frequency.
The library defines the conversion delay for the ADS1115 as 8ms, suiting the default
conversion rate of 128SPS. You'll need to add more functionality to the library to
configure the chip for faster operation I think - the datasheet explains the register
fields needed to set the speed.