(COMPLETE, BEST & EASIEST) ESP8266-01 | ESP8266-12E/F Configuration Guide with Arduino Nano/Mega/UNO for IoT Projects (Includes all ESP Issues)
Hello Friends,
Have you been trying real-hard to get your good old ESP8266 -01 / 12 E / 12 F working with Arduino UNO, NANO or Mega? Well, i bet you this guide will fix all your issues and you will be able to run it smoothly without any issues.
First thing first, ESP8266 is great cheap price device if you would like to configure your projects for IoT but, getting it to work can be a problem. There are several issues that i have myself faced in getting it to work. Let’s start with jotting down all the issues and then there solution afterwards.
Issues :
1) AT Commands won’t work
2) ESP8266 reboots indefinitely
3) TCP send doesn’t work
4) Flashing issues
5) Garbage text in Serial Monitor
6) Dependency on USB to TTL or FTDI Converter
7) No lights flashing in ESP
8) ADC PIN of ESP8266 doesn’t work accurately
9) Battery Input Voltage required for ESP8266 models
10) Basic Connection with Arduino
11) Flashing ESP8226 will remove AT ? The big question
12) Unable to Flash ESP8266 from Arduino IDE
13) Meaning of Reset Codes and Boot Codes
If you face any of the above issues, this is the guide for you. Let’s start tackling each of the aforementioned issues one by one.
Issue #1 : ESP8266 AT Commands doesn’t work
There can be several reasons for this, but the most famous one and only applicable if you don’t see anything in the Serial Monitor when you have connected it with Arduino would be a WIRING issue i.e. you haven’t correctly connected it with the Arduino.
The best way in my experience to judge if the wiring is perfect is to connect the VCC, CHPD to respective 3.3V (if using ESP8266 12F/12E) or 5V(ESP8266-01) and GND to Ground of Arduino, GPIO15 of ESP8266-12E/12F to GND, then put in the RX pin of ESP8266 to TX of Arduino and TX pin of ESP8266 to RX of Arduino. Once, you are done with these steps, simply power on the Arduino and then Open the Serial Monitor(Try both 115200 and 9600 baud rate with CL/NL) and now, gently remove the RX pin connection of Arduino and quickly put it back in. If you see a garbage text, it means the connections are perfect. If you don’t see anything, switch the RX and TX pins and repeat the steps. This should assist you in fixing the wiring connections.
Issue #2 : ESP8266 reboots indefinitely
If you have worked with the ESP8266 for good amount of time after getting over those wiring and other issues, you have undoubtedly experienced the endless resets on power-up. The looping message occurs at about 5 second intervals, which seems to be the default internal watchdog timer time-out period. The message, at 115200 baud, looks something like this:
/////////////////////////////////////////////////
ets Jan 8 2013,rst cause:4, boot mode:(3,7)
wdt reset
load 0x40100000, len 30000, room 16
tail 0
chksum 0x67
load 0x3ffe8000, len 2556, room 8
tail 4
chksum 0xb7
load 0x3ffe8a00, len 3080, room 4
tail 4
chksum 0x59
csum 0x59
/////////////////////////////////////////////////
From my experience, there are two main cause of this endless reboot loop issue.
1) Inadequate Power Supply
2) Flash Errors
For #1: You need to add some components to your wiring scheme. You must include the following three items before the power source to the ESP8266.
a) Sufficient current. A regulated 3.3V source of at least 500ma is essential. Aside from the 300ma peak current needs of the ESP8266, it is essential to also consider the current requirements for other components you have – like the sensors and controls in your circuit. Generally, speaking from my experience, this shouldn’t be an issue if you are using Arduino.
b) Large capacitor (suggest using 100uF, 220uF or 470 uF) across the VCC to GND rails on your breadboard or PCB is a vital ingredient that will minimize reset inducing voltage fluctuations. So, how do you do this? Take the VCC and GND from Arduino to a breadboard, next, connect the Large capacitor to with Big leg of it to the VCC and short leg to the GND and now connect all the respective pins of ESP8266 to the same rails.
c) A small 0.1 uF decoupling capacitor across the ESP8266 VCC to Gnd inputs very close to the pins. If you are good with soldering, I would suggest to Solder this capacitor to the VCC and GND of ESP8266. If you can’t solder, then put this between the VCC and GND rails. DO NOT SKIP THIS COMPONENT! This cheap yet often overlooked component, when missing, is the root cause of ESP8266 resets. I myself have got relief after putting this component in.
For#2 : If you have already completed the above steps, then you know what the issue you are dealing with : FLASH CHIP error.
Try to flash the chip again with a stable firmware and see if that fixes your issue.
Issue #3 : TCP send doesn’t work
This is a simple one to tackle. You just need to check if your TCP address is correct and also, if the ESP8266 is connected with your Modem/Router successfully. Try to try some global links to verify the connectivity. Also, pay attention to the correct syntax.
Issue #4 : Flashing issues
Most of the flashing issues are due to power supply issues. Follow issue #2 recommendations and then it should provide you with relief.
In case you still get issues after putting all power controls, try to use TTL or FTDI converter to see if that makes any difference.
Issue #5 : Garbage text in Serial Monitor
This is again, the most common error and to our surprise is mainly because of two reasons.
a) Inadequate Power Supply
b) Flash Erorrs
For both, follow point #2 to get relief
Issue #6 : Dependency on USB to TTL or FTDI Converter
I would put this dependency only if you would want to flash your Chip, other than that, Arduino should be able to handle all sorts of connections and program flashing
Issue #7 : No lights flashing in ESP
If you are using ESP8266-01, then lights indeed flash but if you are using ESP8266-12E/12F models, the light only flash once, per power on and on subsequent requests, they won’t power on. Only other case where the LED would flash would be Flashing or writing program from Arduino IDE.
Issue #8 : ADC PIN of ESP8266 doesn’t work accurately
ESP8266 has a single ADC channel available to users. It may be used either to read voltage at ADC pin, or to read module supply voltage (VCC).
To read external voltage applied to ADC pin, use analogRead(A0). Input voltage range is 0 — 1.0V.
To read VCC voltage, ADC pin must be kept unconnected. Additionally, the following line has to be added to the sketch:
ADC_MODE(ADC_VCC);
This line has to appear outside of any functions, for instance right after the #include lines of your sketch.
I have myself struggled to get this working. It seems that it’s not reliable to use ADC pin of ESP8266 because of two issues.
1) 90% of time, you won’t get accurate results
2) voltage capping is very low ( under 1 volt readings only)
Alternate solution would be using ADS1115 with Digital Pins of ESP8266.
Issue #9 : Battery Input Voltage required for ESP8266 models
Very tricky question, you would find tons of articles online saying use this or that, it smoked my esp8266 etc. etc.
In my experience, and yes don’t quote me if anything goes wrong, i have successfully used 5V with ESP8266-01 as it never worked on 3.3V from Arduino . For ESP8266-12E/12F, they have worked successfully for me over 3.3 V.
Issue #10 : Basic Connection with Arduino
I think we have already covered this point by now in this post, but to revise it again.
Pin VCC, E/CHPD(E in ESP12 and CHPD in ESP01) to VCC of Arduino
Pin GND to GND of Arduino
Pin GPIO15(only 12E/12F) to GND of arduino
Pin RX to TX of Arduino
Pin TX to RX of Arduino
Pin GPIO0 to GND of Arduino (only in case of Flashing either using Flash Software or Arduino Sketch)
Issue #11 : Flashing ESP8226 will remove AT ? The big question
The answer is sad and simple, YES. Flashing ESP chips in any form other than their original firmware would remove the AT commands access.
This is because, when you use Arduino Sketches to Flash the ESP chips, the flash goes on 0x00000 address, which is where you firmware contents are stored for AT commands.
Issue #12 : Unable to Flash ESP8266 from Arduino IDE
Make sure that you have grounded GPIO0 pin on ESP. This is the only reason of flash not working if your other connections are perfect.
Issues #13 : Meaning of RESET codes and boot Codes
Following are the meaning of RESET Codes and boot codes
reset causes:
0:
1: normal boot
2: reset pin
3: software reset
4: watchdog reset
boot device:
0:
1: ram
3: flash
Hope this helps.
Enjoy!!
Tried and tested for ESP14 as well.