Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

By tandrews
#89094 I am using an ESP8266 to read the temperature of my smoker. It is a thermistor. I am using a 150k resistance. I have calculated the proper beta coefficient and have found the readings to be extremely accurate when it's below a threshold (around 200f/94c). In fact, I find it stops at 224f and won't go any higher.
Is there a limit to the ADC? I had considered just using the MAX6755 I have, but wasn't sure if I was perhaps just missing something simple.

Code:

Code: Select all`// which analog pin to connect#define THERMISTORPIN A0// resistance at 25 degrees C#define THERMISTORNOMINAL 45000// temp. for nominal resistance (almost always 25 C)#define TEMPERATURENOMINAL 25// The beta coefficient of the thermistor (usually 3000-4000)#define BCOEFFICIENT 3148.36// the value of the 'other' resistor#define SERIESRESISTOR 147000float getSteinhartCelsius(float resistance) {  /**     Returns the steinhart calculation  */  float steinhart;  steinhart = resistance / THERMISTORNOMINAL;     // (R/Ro)  steinhart = log(steinhart);                  // ln(R/Ro)  steinhart /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)  steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)  steinhart = 1.0 / steinhart;                 // Invert  steinhart -= 273.15;                         // convert to C  return steinhart;}float analog_average_read(){  /**     Reads a number of samples and averages those samples.  */  float average = 0.0f;    average = analogRead(THERMISTORPIN);average = (1023 / average) - 1;  average = SERIESRESISTOR / average;  return asF(getSteinhartCelsius(average));}`

By davydnorris
#89097 The ADC on chip is 10bit with a range of 0 - 1.0V, so it's not particularly accurate. You need to make sure your input voltage is within the 0-1 Volt range though.

By eriksl
#89190 It surely isn't particularly accurate, you can say that . That's not because the range is 10 bits (which is a fairly big range imho). It's because of other factors:
- integration of all sorts of RF signal paths in the chip that will disturb the measurements
- current flow in the chip various greatly due to the RF "power" step, which will also disturb the ADC
- even 10 bits of accuracy is already hard to achieve realisticly without really good analog circuitry outside the chip

There is a special API function to do a oversampling measurement of the ADC. This requires the WLAN function to be completely shut down. If you do both, the obtained results may get sort of usable.

There are two other approaches that are much simpler, which is to extend the digital domain to outside the chip: use I2C. Then connect either one of the many temperature measurement chips (LM75, TMP75 etc) or connect a proper ADC.