-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Labels
Type: For referenceCommon questions & problemsCommon questions & problems
Milestone
Description
Is anyone seeing a conflict with analogRead() values when #include <WiFi.h> is included in a sketch? analogRead works great without WiFi.h included; however, if WiFi.h is included then the analogRead values returned are all maxed out (4096 values). Note I've tested on pins 12, 14, 26 & 27.
fernandohackbart, mehmet6021, federicaCapobianco, Voker13, rahulonmars and 2 more
Metadata
Metadata
Assignees
Labels
Type: For referenceCommon questions & problemsCommon questions & problems
Type
Projects
Relationships
Development
Select code repository
Activity
palomarcoder commentedon Jan 2, 2017
I found a note here that may be relevant: https://www.espressif.com/sites/default/files/documentation/esp32_hardware_design_guidelines_en.pdf
Pin1, Pin43 and Pin46 are the analog power supply pins. Pin3 and Pin4 are the power supply pins for the power amplifiers. It should be noted that the sudden increase in current draw, when ESP32 is in transmission mode, may cause a power rail collapse. Therefore, it is highly recommended to add another 0603 10 uF capacitor to the power trace, which can work in conjunction with the 0402 0.1 uF capacitor.
JeroenVanOort commentedon Jan 8, 2017
I've been having trouble with this as well. After a lot of trial and error I have found out that analogRead will work on some pins while using WiFi, 32 and 36 are examples of those pins. I hope this helps when trying to find out why this happens.
nissimzur commentedon Apr 19, 2017
Hi
It seems the ESP32 pin 32 is been used as SDO to flash. Are you sure you can use is as analogRead input?
Please call my Skype nissim.test
igrr commentedon Apr 19, 2017
This happens because ADC2 pins can not be used when WiFi is used.
On the other hand, ADC1 pins can be used even when WiFi is enabled.
hkotkanen commentedon May 13, 2017
@JeroenVanOort thank you kindly, switched to a pin you indicated and got mine working.
@igrr many thanks for the information! Your statement is so casual and matter-of-fact, but this thread seems to be then only place that documents this ...feature. Was I supposed to have found it out from another source?
CarlosGS commentedon Sep 20, 2017
A few months ago I got around this issue by periodically soft-restarting the ESP32 to measure from ADC2; then turning on wifi to send the data.
Unfortunately this has been broken in latter updates, right now if you issue esp.restart() after turning on wifi, the ADC2 no longer works. Now it is needed to physically disconnect power.
Any thoughts on why esp.restart() doesn't restore all radio registers to their default state?
me-no-dev commentedon Sep 22, 2017
There is a fix coming for ADC2 and WiFi soon :)
pieman64 commentedon Oct 16, 2017
@me-no-dev any news on the ADC2 fix?
JulienHai commentedon Dec 6, 2017
any news? when will adc2 be fixed?
palomarcoder commentedon Dec 27, 2017
Any estimated time? I was really hoping to use this in a project over the holiday.
88 remaining items
CarlosGS commentedon Jul 21, 2021
Would you be so kind to provide more details? (i.e. is our only alternative to keep using 1.0.3/1.0.4?)
Context: I would like to re-use many boards (update the software) instead of dropping them in the bin.
txf- commentedon Jul 22, 2021
Would the workaround still work with the latest SDK? I have a project that uses the workaround, which works well for my purposes, but would it break?
me-no-dev commentedon Jul 22, 2021
why would many devices stop working? Did you design your boards based on that message from 4 years ago?
palomarcoder commentedon Jul 22, 2021
I certainly did. Why is that unreasonable? The esp32 was the chip of dreams - 18 ADC, built in wifi, and fast. I designed 3 projects around it. I assumed the features would work together, and I assumed the bugs would be fixed. I appreciate the community support, but what company releases a major SOC and assumes the community will find workarounds to all the problems? The boards still sit languishing on the bench. I'll end up throwing it all away and waiting for esp64, or maybe some day have time to redesign the projects for multiple esp32s.
Tobbera commentedon Jan 8, 2022
I can confirm that this is working as a workaround.
BUT, its broken in the newer version of ESP32 in arduino. This works on 1.0.3 at the moment. I cant understand why they took it away.
Tobbera commentedon Jan 28, 2022
Another follow up on this:
When using the workaround above the ADC reading reports approx 21mV higher value at 2500 mV compared to not running WiFi at all.
EDIT: And this offset seem to affect BOTH ADC channels, not only the ADC channel that is affected by the this issue. The ESP32 MCU is puzzling me more and more....
cyberman54 commentedon Mar 2, 2022
@Tobbera i can confirm the ~21mV Diff, for BOTH adc channels.
janioanselmo commentedon May 6, 2022
Hello, I confirm your information! I've been migrating my project from version 1.0.4 to version 2.0.2 for a few weeks and unfortunately, without success so far. With information from Mr. @Tobbera we have had success up to v 1.0.4. For higher versions, I still can't get Wifi + analogRead() to work;
janioanselmo commentedon May 6, 2022
@Tobbera, another follow up on this:
I just did tests on the new version 2.0.3 and apparently the same thing, still doesn't work (Wifi + AnalogRead).
pdsmart commentedon May 11, 2022
I can add another issue I've been tracking the last few days, hi-speed digital signals on ADC2 inputs (configured as digital inputs) prevents WiFi Station from establishing a connection. WiFi Access Point has no such issues.
The only solution I have come up with at the moment is to temporarily set ADC2 ports to output (the design uses limiting resistors so this is possible), make a WiFi Station connect with router then reset ADC2 ports to input. Once the Station has a session with a router there are no further issues. (albeit I find enabling the WiFi causes false interrupts to trigger on a neighbouring ESP32 on IO33!!). Not strictly capturing analogue as mentioned in the OP post but all on the same theme, an issue regarding WiFi and ADC2.
I'm using IDF v4.4 with Arduino compatibility installed. SoC is an ESP32-S AI Thinker WROOM.
svdrummer commentedon Jan 15, 2023
Are these all Arduino wrapper issues or silicon issues?
NuclearManD commentedon Jan 19, 2023
I'm pretty sure they're silicon issues @svdrummer. Hopefully someone can correct me if I'm wrong.
Merge pull request espressif#102 from kattni/add-qt-trinkey