-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ADC read is disturbed while WIFI is disabled. #1660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have the same exact problem! Trying to read battery level and I always get 1024 without the WiFi enabled |
It's a ESP8266 core restriction:
Refences:
|
I'm not using ESP.getVcc().. I'm using analogRead(A0), which I guess is called by that underneath. This seems like a REALLY weird restriction. |
Hi, |
So, you still use |
Yes |
excuse me , how to change this byte on the run time ? |
Sorry to drag up an old thread, but it seems this is an issue in current git as well. I can raise a new issue for it, if you prefer, but the symptoms are exactly as described above. On my Adafruit Huzzah ESP8266 boards, with the 2.3.0 release, the ADC reads correctly even with the WiFi disabled. However, in current git, the readings come back higher than expected. I have 5.2V being run through a 18K/100K voltage divider. With a multimeter I measure 0.77V at the ADC input, and the ESP measures 0.79V. Close enough for my needs. However, when I replace 2.3.0 with the git version, the ESP measures the voltage as 0.87V. This only happens when the ESP wakes up from deep sleep with WAKE_RF_DISABLED. |
I experienced same effect when ESP12E wakes up from deep sleep (RF disabled) and try to read an analogue input from sensor. Could you let me know how I can do this please? Thank you very much. |
it seems that this issue is solved on the followed releases, Please Open New issue describing your problem even if it's the same as this one , so that the Admins can follow up with you as this issue is already closed. |
Sorry, I know this is old, but I am experiencing the same problem described above by @erikbakke , and this is the only place I have seen it described - did anyone find a solution? I am periodically waking the chip from deep sleep to perform an ADC read. I measure a different conversion relationship between the voltage applied to the ADC pin (using an external bench PSU and measured with a precision floating multimeter) versus the counts returned by the analogRead() function, depending on whether I include the "WAKE_RF_DISABLED" flag in the ESP.deepsleep() command: Strangely, when the flag is included, the ADC value returned on the very first boot after power on is actually the same as if no flag was passed. But then all subsequent wakes from deep sleep return the same ADC count as when no flag is passed. Why does going into deep sleep with WAKE_RF_DISABLED change the values read by the ADC when the chip is woken up? (Using an ESP-12S board with 3.0.2 software version). |
Hi , I need to declare an issue regarding using ADC when WIFI is disabled.
I disable WIFI by calling
ESP.deepSleep(1, WAKE_RF_DISABLED);
on wake up I get samples from ADC every minute , however the reading is always 1024,
but If I tried to read analog samples while WIFI is Enabled , I get it correct with no errors.
the problem starts to happen when I disable WIFI.
here's my code for Reading ADC
int reading = analogRead(A0);
delay(3);
Serial.println("Light Sensor Reading ");
Serial.println(reading/4,DEC); // print light sensor level.
I made a workaround that's by software I restart the ESP after the wake up from deep sleep
by calling ESP.reset();
By this way the ADC read problem is solved while disabling WIFI but this introduced another issue
that is on calling ESP.reset(); ,
1- the board try to reset then hang
2- and then the wdt reset is introduced
3- then start the program .
this wdt reset issue makes problems on the connected items to the ESP on my project , I don't want to disturb you with the details.
I also think that ESP.reset() is working okay when WIFI is enabled, but on disabling WIFI, wdt reset is introduced .
Serial messages captured on the reset after calling ESP.reset() are
My hardware connection is
GPIO0 --- HIGH
GPIO2 --- HIGH
GPIO15 ---LOW
My code for software reset is
wifimode = wifi.getEEPROMString(WIFI_STATE_ADDRESS,2);
if (wifimode == "d") { // disabled.
debug_print("WiFi just Disabled");
wifi.setEEPROMString(WIFI_STATE_ADDRESS, 2, "r");
delay(200);
delay(200);
delay(200);
delay(200);
yield();
ESP.reset();
yield();
delay(5000);
}
So I need help to resolve those Issues
I also tried to solve the ADC read problem by adding this macro after all the included libraries
ADC_MODE(ADC_TOUT)
I did so because I think the problem is that it reads the vcc instead of the analog value,but it didn't resolve the problem .
also Tried calling
ESP.wdtDisable();
on setup() and also on loop() to solve WDT problem but with no help , I know it's hardware wdt not a software one but I gave it a try.My hardware is this board http://tronixlabs.com.au/news/new-product-esp8266-esp12-full-evaluation-board/
I installed ESP8266 2.0.0 package from the board manger and I use Arduino IDE version 1.6.5.
I don't know if I am doing something wrong , please Let me know If you need further information.
Thanks a lot.
Amr.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: