ESP8266

From Leo's Notes
Revision as of 09:27, 21 January 2018 by Leo (talk | contribs)
This page was last edited on 21 January 2018, at 09:27.

ESP8266 is a low cost Wi-Fi capable microcontroller created by Espressif, a Shanghai based company. I got a few from Ebay for $1.75USD each (some even cheaper when on auction).

For more information, read the Wikipedia article at https://en.wikipedia.org/wiki/ESP8266

Usage

The ESP8266 runs on 3.3v and is not 5v tolerant. However, I was able to connect the ESP8266 to a 5v FTDI adapter without any issue. Ideally though, the RX/RX should be connected through a voltage divider.

To power on and play with the ESP8266, connect

  1. vcc to 3.3v
  2. gnd to ground
  3. GPIO-15 to ground via 10k resistor
  4. GPIO-2 to vcc via 10k resistor
  5. GPIO-0 to vcc via 10k resistor (connect to ground directly to program)
  6. TXD0 to TX (on FTDI or Arduino board without the atmel chip)
  7. RXD0 to RX (through voltage divider to FTDI/Arduino)
  8. RST to vcc via 10k resistor. (Connecting this to ground will reset chip)
  9. EN (or CH_PD on some boards?) to vcc via 10k resistor

Out of the box, the stock firmware 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 log when booting at 74880 baud (https://github.com/espressif/esptool/wiki/ESP8266-Boot-ROM-Log).

To write custom code for the ESP8266, start the Arduino IDE and:

  1. File -> Preferences -> Additional Boards Manager URLs, add: http://arduino.esp8266.com/stable/package_esp8266com_index.json
  2. Tools -> Board -> Board Manager
  3. Find and install the esp8266 board
  4. Select NodeMCU 1.0 (ESP 12-E Module)

To upload your code to the ESP8266:

  1. Power off the ESP8266
  2. Connect GPIO-0 to ground (disconnect from the 10k pull up)
  3. Power on the ESP8266
  4. Compile & Upload code in Arduino IDE


AT Command Reference

See: 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:

Source code can be found at:

See Also