First off, ESP does not tolerate 5v, under any circumstances. Not to power it up nor as communication voltage. Usually when you read that a piece of tech does not tolerate 5v, usually it does. It tolerates it but for short time, not ESP. Just try and show it 5v and it will blow up. And the worst thing is that there will be no white smoke to indicate that something went very wrong. It will continue to sit there, not working, while you rearrange the code for the tenth time trying to figure out what’s wrong. To make things even worse, the red led will be on just to taunt you into believing it’s still alive.
There are 12+ different variants of basic ESP reference board. With the simplest and most prolific being the ESP-01.
A good and stable power supply is a must as ESP does not like fluctuations. The ones that happen when it turns on its WiFi are enough for it to reboot. ESP-01 onboard power supply filter is virtually nonexistent with only a small 100 nF capacitor. There should have been at least another 10 uF, which is not there. I would suggest adding another 10-100nF decoupling capacitor together with a larger >300uF capacitor between Vcc and Gnd to the board.
Who ever designed ESP-01 board was one massive troll. All of those component should have been there in the first place. I can almost see him, the engineer that designed the ESP boards, snickering as he plots his troll move on the unsuspecting Makers around the world .
Most of those traps are now fixed with more complete prototyping boards like NodeMCU and others.
USB, Arduino and other power sources will not be sufficient for normal operations of ESP with WiFi turned on. Most such sources only provide around 100ma while ESP needs more than 150ma to work properly. One symptom of not enough current is that you can upload a firmware but it will constantly cause watchdog timer (wdt) reset if you try to connect to a network. Or, in other words it will constantly reboot. A good rule of thumb is to provide at least 300ma or even better, a minimum of 500ma able power supply. ESP consumption can peak at around 300ma.
ESP ADC is used internally by the chip to measure internal voltage and to adjust WiFi power output. This causes a lot of problems if you wish to sample a large sample using ADC. If watchdog timer can not access ADC ti will raise a fault.
There is no warning faults, all faults are critical and cause reset of watchdog or a straight out reboot. If anything goes wrong, even if it’s not important it makes it important.
The good practice is to allow the watchdog to do its thing every now and again or simply call delay() or yield() every 50ms or 500ms on the outside. This will let watchdog do its thing and keep WiFi alive. This is true for all actions not just when reading ADC. It’s more sensitive when ADC is used but any task that takes more than 500ms to finish without watchdog having its chance to rowe around will cause it to crash and burn, or just reboot.
As with all new things ESP had its childhood problems (and trolls). As the platform matures and bugs are ironed out, both hardware and software it’s becoming a powerful replacement for Atmel based arduino.