I'm trying to use the ADS1115 breakout to improve my thermistor readings, I'm following this tutorial.
I have a 39k resistor as the other resistor and I'm powering the ADS1115 with 3.3v (via a voltage regulator).
The termistor is 50K @ 25C but I'm getting the below values when I would expect nearer 50K ohms:
Average analog reading 10289.80
Thermistor resistance 7282.51
Have I missed some conversion or value that differs between the arduino and ADS1115?
Here's my code:
Code: Select all
#include <Adafruit_ADS1015.h>
// how many samples to take and average, more takes longer
// but is more 'smooth'
#define NUMSAMPLES 5
// the value of the 'other' resistor
#define SERIESRESISTOR 39100
Adafruit_ADS1115 ads;
int samples[NUMSAMPLES];
void setup(void) {
Serial.begin(115200);
ads.begin();
}
void loop(void) {
uint8_t i;
float average;
// take N samples in a row, with a slight delay
for (i = 0; i < NUMSAMPLES; i++) {
samples[i] = ads.readADC_SingleEnded(3);
delay(10);
}
// average all the samples out
average = 0;
for (i = 0; i < NUMSAMPLES; i++) {
average += samples[i];
}
average /= NUMSAMPLES;
Serial.print("Average analog reading ");
Serial.println(average);
// convert the value to resistance
average = 65535 / average - 1;
average = SERIESRESISTOR / average;
Serial.print("Thermistor resistance ");
Serial.println(average);
delay(1000);
}