ESP8266 WiFi module

ESP8266 WiFi SoC has gained enormous popularity in the nick of time. Right after hackaday introduction dedicated community forum was created despite that first batch of modules was still in shipping so virtually no one had it in hands. The key to success was its price - $5 or even less, including shipping fee. That's significantly cheaper than e.g. CC3000 module from Texas Instruments ($13.80 @ 1000 pcs for basic module that requires pretty much BGA soldering or $35 for more friendly breakout board).

ESP-01 / Wi07C V090

ESP-01 is the most common variant, with PCB antenna and 2x4 100mils header. PCB size is 14.2 x 24.5 mm.
ESP8266 module - front ESP8266 module - back
Funny observation: so far (October 2014) on all pictures I was able to read timestamp chip is dated to 25th week of 2014. Exception is (manufacturer) website where chip from 15th week is pictured. I could speculate that chip made it to the market very quickly and this is the reason for perfunctory documentation.

ESP8266 module - pinout

Note: there is also very similar in shape/size and component location module that has only power and UART connected (otherwise known as Wi07C V080) - you should probably avoid it. Second (and more visible since it may be difficult to see traces on the photo) difference is lack of status LEDs.

Firmware upgrade

Module I've bought contains W25Q40BV Winbond serial Flash memory in SOIC8 package. It has 4Mbit capacity, so it matches exactly size of available firmware files (512kB with bin format, around half of file is filled with 0xFF, ~128kB when packed with zip). As shown by custom firmware it actually consist of two images: "flash.bin" loaded at address 0 and "rom.bin" at address 0x40000.

Out of the box version I've received was 00160901 - older than first version that can be updated online (so called "cloud update"). Using XTCOM_UTIL (API Test / Flash image download) I've updated it directly with "v0.9.2.2 AT Firmware.bin". For this version UART speed has to be set to 9600bps, but than it can be changed with AT command and it stays at set after power down cycle.

AT commands

With standard firmware module acts like a modem (WiFi to UART) with limited AT command set. Default communication parameters are 115200bps, 8N1 for older version and 9600bps, 8N1 for Most commands (except for AT/at) are case-sensitive. Since v 0.92 commands have to be terminated with \r\n (CRLF) - check your terminal, for Termite 1.6 this is default setting. Here is communication snip (commands sent in bold, some newlines may be omitted, comments starting with //):

 ets Jan  8 2013,rst cause:4, boot mode:(3,0)

wdt reset
load 0x40100000, len 25020, room 16 
tail 12
chksum 0x55
ho 0 tail 12 room 4
load 0x3ffe8000, len 3280, room 12 
tail 4
chksum 0x1d
load 0x3ffe8cd0, len 6468, room 4 
tail 0
chksum 0xe1
csum 0xe1

[System Ready,]
AT+GMR       // check FW version 
AT+CIOBAUD?  // check baudrate (redundant)
AT+CWMODE=3  // working mode: AP+STA
// second time (after power down) module returns just "no change" string, no OK reply
AT+CWLAP     // list available access points
+CWLAP:(0,"UPC Wi-Free",-74,"72:54:d2:xx:xx:xx",1)
+CWLAP:(0,"UPC Wi-Free",-84,"46:32:c8:xx:xx:xx",1)
// ...
// [lots of APs cut]
// this beast lists more APs than my windows utility...
// it looks like APs are sorted by channel and values are:
// (security, "name", signal strength, MAC, channel)
// where for security: 0 = open, 1 = WEP, 3 = WPA, 4 = WPA2 
// ...
AT+CWJAP="linksys","xxxxxxxxxxx" // connect (SSID, password)
// IP address is obtained with DHCP
// client host name is empty
// client MAC address does not change after power down cycle 
// and seems to be unique (18:FE:34:xx:xx:xx)
// after next power down cycle module connects automatically to last AP
no this fun                         // LOL; it may brake your parser or state machine

For a quick TCP client test I've grabbed my very old TCP server/terminal written with C++ Builder 6: It listens on TCP 7778 port and displays received text.

AT+CIPMUX=0  // single connection mode
+IPD,24:Connection established
AT+CIPSEND=4 // 4 = length of text to send
> test                        // > = prompt, "test" = actual text to send
busy s...
AT+CIPCLOSE  // disconnect

Web thermometer

Source code of my web thermometer based on ATmega32 (that's overkill, but I had unused board from previous version of this thermometer with ISA eth card; ATmega8 would be sufficient after disabling few log lines, FLASH usage is just little over 8kB), ESP8266, SHT11 and MPXA6115A:

Scheme: ATmega32_ESP01.pdf. Note: not verified thoroughly (drawn after assembling device).
Kicad files:

2014.11.01: added reset line control to restart module that stuck in "busy p..." state,

2014.11.08: Changed SoC mode from AP+STA (AT+CWMODE=3, access point + station) to STA only (AT+CWMODE=1). While mode 3 may seem most universal it creates possible security issues - enabling it creates by default open network (SSID: ESP_MACBYTES) with no encryption and authorization. With today's high number of WiFi-enabled devices running open network may also limit reliability and cause current consumption increase - it would be more sensible to not enabling access point mode until AT+CWSAP command with explicit encryption mode, channel, etc. is issued.

Note: for obvious reasons WiFi network SSID password and few other parameters (HTTP server IP/host, php script file name) have to be filled up in config.h and also output binary file is not included in archive.



Programming ESP8266 with GCC
ESP201 module
VoIP/RTP pager with ESP-01

 "Cookie monsters": 2672694    Parse time: 0.000 s