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

Moderator: igrr

User avatar
By durval
#88823 Hello everyone,

Running esp8266-arduino v2.7.4 on Arduino IDE v1.8.13, using a "DOITING ESP-12F" esp8266 development board (board picture here:

I'm having a really weird issue: calling analogRead() sometimes take 2x longer, *AND* return a different value.

Here is my test circuit:
Here is my test sketch:
Here is its **WEIRD** output:

Please notice that, at irregular (but not random) intervals, the analogRead() loop takes almost twice the time to execute, and returns a value about 6% lower.

Please also notice that these intervals are "irregular" but they are *not* random: if I reset the ESP8266, whenit runs the sketch again, these intervals repeats at exactly the same points and with the same values.

The sketch and circuit above are a much simplified version of a real circuit and sketch to read & massage data from an analog sensor.

Does anyone have any idea of what is happening?

Thanks in advance,
User avatar
By schufti
#88831 adc on the esp8266 in general is not very reliable.
it has big noise issues, relevant crosstalk from wifi and timing issues may be related to wifi being main task of nonos sdk. if you disable wifi (really, not just wifi mode off) you may find more stable values and more constant timing.
User avatar
By durval
#88967 Thanks for the tip. In fact, it seems it's hard to use the ESP8266 ADC for anything demanding real precision/repeatability (even averaging hundreds of measurements, after discarding the largest and smallest ones, and trying to discard "bad reads" based on the timing, it proved not to be reliable enough for my use), so I just bought a real ADC (an ADS1511) and will be using it from now on.

Question: how does one "really" disables the WiFi on the ESP8266, ie not only "WIFI_OFF"?
User avatar
By schufti
#88974 for one you may deepsleep/wakeup with "wake_rf_disabled" for the other, you can use sth like
Code: Select all   wifi_station_disconnect();