Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By masx13
#78114 I made a temperature sensor, that works between -30 and 300 º C. For this I used a thermistor. To read the thermistor I used the ADC of the Nodemcu board, but for the last 2 days it didn't read the correct values until I decided to switch the Arduino IDE core to 2.3.0

Before I switched from 2.4.2 to 2.3.0, I had temperature values of -16º C after I had 28º C which is about the right value.
So it seems something about the Arduino Core 2.4.2 made the ADC read the wrong value
User avatar
By QuickFix
#78121 Maybe it has nothing to do with this, but you are aware that the ADC of a NodeMCU is connected to a voltage divider before it's output to the board-pin?
Image
User avatar
By rex.vk3pk@gmail.com
#82674 I came across this problem today. An offset error of a count = 13 at 0 V & spurious errors during reading of +/- a count of 8.

I assume that it is a silicon problem, but it may be a core problem. I assume that there is some processing done in the core in that it can give a count of 1024, which is not kosher for a 10 bit ADC. I will have a look at the core at some stage if I can while & wend my way through it!

FWIIW
I partly fixed the problem by using a Kalman filter, which filters out the spurious readings, but does and I can subtract the offset. It is now just a y=mx +C problem to linearize it.
Code: Select all
#include <SimpleKalmanFilter.h>
#define e_mea 2.0    //Measurement Uncertainty
#define e_est 2.0    //Estimation Uncertainty
#define q_pn  0.01   //Process Noise
SimpleKalmanFilter KalmanFilter(e_mea, e_est, q_pn);

unsigned int sensorValue, sensorValueKalman;

void setup
{
}

void loop()
{
  sensorValue = analogRead(A0);
  sensorValueKalman = KalmanFilter.updateEstimate(sensorValue);
 // do y=mX +C adjustments here
 
}
User avatar
By btidey
#82697 The ESP8266 internal ADC has a number of poor characteristics which mean it is really only useful for fairly rough readings.

1. Although it has 10 bit precision, the noise means it behaves more like a 7 bit converter. You can average / filter it to smooth out the results a bit as you have found but I don't think you are going to get much better than 8.5 bits.

2. The bottom end near 0V goes quite non-linear. The offset you see varies quite a bit from device to device.

3. The overall gain also varies quite a bit from device to device (~ 5%)

You can work around it a bit by individual calibration but it still is only really suitable for fairly coarse measurements like battery voltage or moisture detection.

If you are using a wide range thermistor where you need to cover a wide dynamic range of resistance then I think you are better off using an external I2C ADC like a 16 bit ADS1115 which are pretty cheap and easy to interface.