ESP8266
ESP8266 is a low cost Wi-Fi capable microcontroller created by Espressif, a Shanghai based company. There are various modules that use the ESP8266 microcontroller that are listed below.
Modules
Non-exhaustive list of modules. For a complete list, see http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family
These boards typically require an adapter board for about CAD$0.35 each if you plan on playing with it on a standard DIP breadboard.
-
ESP8266-07 module
-
ESP8266-12E
ESP-01
ESP-01 modules expose only a couple GPIO pins. The ESP-01 package does not expose the EN pin which means you will not be able to put the chip in deep sleep and have it come back automatically.
ESP-07
These are about $2.00 USD each
ESP-12E
These are about $1.80 USD each.
ESP-12F
The difference between the ESP-12E and the ESP-12F is the on-board antenna.
Quick Usage
The ESP8266 runs on 3.3v and is not 5v tolerant. Use a voltage divider on the RX pin to step 5V to 3.3V. Applying more than 3.6V to any pin will damage the chip. Each pin can source a maximum of 12mA compared to 20-40mA for most Arduinos. There is one ADC but with a voltage range of 0.0-1.0V.
Wiring
To power on and play with the ESP8266, connect:
- Vcc to 3.3v
- GND to ground
- GPIO-15 to ground via 10k resistor
- GPIO-2 to Vcc via 10k resistor
- GPIO-0 to Vcc via 10k resistor (connect to ground directly to program)
- TXD0 to RX via Logic Level Shifter (TX on Arduino board without the Atmel chip)
- RXD0 to TX via Logic Level Shifter (RX on Arduino board without the Atmel chip)
- RST to Vcc via 10k resistor. (Connecting this to ground will reset chip)
- EN (or CH_PD on some boards?) to Vcc via 10k resistor
New out of the box, the stock firmware (ESP8266 NONOS SDK) will boot and begin accepting AT commands immediately over serial at 115200 baud. You will see garbage being dumped when the ESP8266 boots because the espressif boot ROM will write a boot log at 74880 baud (https://github.com/espressif/esptool/wiki/ESP8266-Boot-ROM-Log).
Arduino IDE
To write custom code for the ESP8266, start the Arduino IDE.
Add the ESP8266 boards:

- File -> Preferences -> Additional Boards Manager URLs, add: http://arduino.esp8266.com/stable/package_esp8266com_index.json
- Tools -> Board -> Board Manager -> Search for ESP8266 -> Install
- Select NodeMCU 1.0 (ESP 12-E Module)
To upload your code to the ESP8266:
- Power off the ESP8266
- Connect GPIO-0 to ground (disconnect from the 10k pull up)
- Power on the ESP8266
- Compile & Upload code in Arduino IDE
You may wish to change the upload speed from the default 115200 baud to speed up the upload process.
Boot Modes
When the ESP8266 boots, it will go into one of 3 boot modes depending on the GPIO pins:
| GPIO15 | GPIO0 | GPIO2 | Mode |
|---|---|---|---|
| 0V | 0V | 3.3V | Uart Bootloader |
| 0V | 3.3V | 3.3V | Boot sketch (SPI flash) |
| 3.3V | x | x | SDIO mode (not used for Arduino) |
- Uart Bootloader mode is used to upload code to flash
- Boot sketch (SPI flash) mode is used to boot from flash memory
Deep Sleep
When using ESP.deepSleep(30e6), GPIO 16 should be connected to the RST pin. The ESP8266 will wake itself up by sending a LOW to RST which will reset the device.
AT Command Reference
See:
- https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf
- https://room-15.github.io/blog/2015/03/26/esp8266-at-command-reference/
AT+RST
OK
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
load 0x40100000, len 2408, room 16
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0
tail 8
chksum 0xd8
csum 0xd8
2nd boot version : 1.6
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user1 @ 1000
⸮⸮⸮
ready
AT+CWMODE=3
OK
AT+CWLAP
+CWLAP:(4,"SHAW-BDF273",-73,"44:e1:37:f5:ac:c1",1,31,0)
+CWLAP:(4,"SHAW-BDF273-Guest",-70,"46:e1:37:f5:ac:c2",1,33,0)
+CWLAP:(4,"TELUS5578",-82,"28:28:5d:11:32:f4",1,16,0)
+CWLAP:(3,"Linksys11303",-72,"58:ef:68:29:64:50",1,13,0)
+CWLAP:(4,"Jazzwalz",-78,"1c:ab:c0:af:f9:f8",1,28,0)
+CWLAP:(3,"dd-wrt",-64,"10:6f:3f:e7:df:70",1,6,0)
+CWLAP:(4,"SHAW-827C50",-86,"f0:f2:49:82:7c:58",1,23,0)
+CWLAP:(3,"HP-Print-9D-Officejet Pro 8610",-84,"94:57:a5:95:cc:9d",1,25,0)
+CWLAP:(3,"Hi Clayton!",-82,"a8:4e:3f:74:52:a8",1,18,0)
+CWLAP:(3,"tl746704-EXT",-73,"02:be:f5:00:95:15",1,15,0)
+CWLAP:(3,"CSISVAN2",-83,"b8:8d:12:63:0c:c3",1,23,0)
+CWLAP:(3,"tl746704",-71,"00:25:f0:74:67:04",1,32767,0)
+CWLAP:(4,"SHAW-FC70A1",-74,"78:96:84:fb:21:99",3,26,0)
+CWLAP:(3,"Winternet is Coming",-75,"88:1f:a1:2e:a7:8a",4,-24,0)
+CWLAP:(0,"HP-Print-AC-ENVY 4500 series",-79,"50:65:f3:ea:39:ac",4,30,0)
+CWLAP:(3,"MLJK",-72,"e4:f4:c6:19:ab:0c",4,21,0)
+CWLAP:(4,"SHAW-EB53F2",-65,"74:85:2a:70:b6:a8",6,8,0)
+CWLAP:(3,"RQNSQMDI",-74,"a0:63:91:68:43:f2",6,10,0)
+CWLAP:(4,"SHAW-70C250",-76,"a8:4e:3f:70:c2:58",6,21,0)
+CWLAP:(4,"SHAW-629C60",-79,"90:50:ca:62:9c:68",6,26,0)
+CWLAP:(4,"VBE",-81,"c4:12:f5:67:16:08",6,5,0)
+CWLAP:(4,"JAC521G",-84,"c0:7c:d1:ba:90:59",6,15,0)
+CWLAP:(3,"4i1WLTwF",-80,"08:02:8e:95:8e:1e",6,3,0)
+CWLAP:(3,"SHAW-65C6F0",-79,"a8:4e:3f:65:c6:f8",6,23,0)
+CWLAP:(4,"SHAW-2155A0",-83,"ac:20:2e:21:55:a8",6,16,0)
+CWLAP:(4,"JAC521",-81,"c0:7c:d1:ba:90:58",6,13,0)
+CWLAP:(4,"SHAW-44C170",-74,"00:fc:8d:44:c1:78",9,16,0)
+CWLAP:(1,"ralphgonzo",-77,"00:23:69:60:49:6d",9,-19,0)
+CWLAP:(4,"41B42D",-71,"70:54:d2:15:5d:d7",11,25,0)
+CWLAP:(3,"dd-wrt",-72,"a8:4e:3f:83:0d:78",11,28,0)
+CWLAP:(3,"tla73210",-72,"00:25:f0:75:65:08",11,32767,0)
+CWLAP:(4,"D7C9CC",-70,"7c:05:07:6f:a9:e3",11,15,0)
+CWLAP:(3,"HP-Print-9C-Officejet Pro 8620",-67,"6c:c2:17:1e:da:9c",11,15,0)
+CWLAP:(3,"Coopernet",-75,"b8:8d:12:63:d8:7b",11,11,0)
+CWLAP:(3,"Lannon's Guest Network",-76,"ba:8d:12:63:d8:7c",11,13,0)
+CWLAP:(4,"SHAW-E6B9C0",-76,"bc:4d:fb:e6:b9:c8",11,8,0)
+CWLAP:(3,"SHAW-6F6F30",-76,"a8:4e:3f:6f:6f:38",11,28,0)
OK
Flashing
To flash the stock firmware (NON-OS), get the SDK and the flashing tools from:
- http://espressif.com/en/support/download/other-tools
- http://espressif.com/en/support/download/sdks-demos
Source code can be found at:
See Also
- https://en.wikipedia.org/wiki/ESP8266
- http://simba-os.readthedocs.io/en/latest/boards/esp12e.html
- https://homeautomationfordummies.wordpress.com/2016/03/04/esp8266-esp-12-getting-started/
- http://support.thingplus.net/en/esp8266.html
- https://tttapa.github.io/ESP8266/Chap03 - Software.html