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: https://imgur.com/a/jr6ccLv).

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

Here is my test circuit: https://imgur.com/a/AUg1KTX
Here is my test sketch: https://termbin.com/1hsy
Here is its **WEIRD** output: https://imgur.com/a/SHeXufj

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,
--
Durval.
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();
   wifi_set_opmode(NULL_MODE);
   wifi_set_sleep_type(MODEM_SLEEP_T);
   wifi_fpm_open();
   wifi_fpm_do_sleep(FPM_SLEEP_MAX_TIME);