please dont rip this site

ESP-8266 System On Chip

A complete, WiFi enabled, 3.3v microcontroller for less than $5^ Datasheet.

Processor: Tensilica^ Xtensa LX3^ processor  32-bit RISC. Integrated RAM, some ROM, and a WiFi radio, by default runs at 80 MHz but can go up to 160 MHz, it has ~80kB DRAM (Data RAM), and ~35kB of high speed IRAM (Instruction RAM). Support required: 4 capacitors, a crystal and an external flash (which are all on the ESP-8266 modules).

Integrated WiFi chip has +20dBm in b mode, STBC, 1x1 MIMO, 2x1 MIMO, A-MPDU & A-MSDU frame aggregation & 0.4µs guard interval. Integrated TR switch, balun, LNA, power amplifier and matching network. Wake up and transmit packets in < 2ms

Note: NONE of the versions prior to the ESP-12 are actually FCC approved, even if they have the FCC logo. ESP-12 has ID: 2ADUIESP-12 and CE: BCTC-141212468

Firmware ROM impliments (see file eagle.rom.addr.v6.ld from SDK): MD5 (w/hmac), SHA1, comms with the external flash/memory commands, SDIO 2.0, SPI, UART functions, software floating point, AES, printf, low-level IO tools, real-time event scheduler, 802.11b/n/g, TCP/IP IPv4, WPA/WPA2.

External FLASH is normally Winbond W25Q40BVNIG SPI for 512KB. Some versions have more, e.g. EFP-12 and OLIMEX

IO is somewhat limited on early modules, but later modules increase the number of available pins. Note 3.3v levels; use of 5 volts anywere will damange the unit.

Development environments: All new code loaded via bootloader. Reset with GPIO 0 grounded, "ready" will be transmitted at one of 9600,115200,57600, or, most often, 76800 baud. In the bootup message 'boot mode:(x,y)' three low bits of x are {GPIO15 aka MTDO, GPIO0, GPIO2}. If GPIO15 is high, it will wait for an SD card. If GPIO0 is high, it will boot from flash, if low, will enter the bootloader. In any case, GPIO2 is expected to be high (floating).^ ^ e.g. boot mode:(1,6)' is what you want to see for programming mode. A simple circuit like this can help:

Connections for programming:

The stock firmware provides a set of "AT" commands taylored to use as a WiFi bridge, programming a new application replaces that firmware.

Programming requires a 3.3v level serial connection. The RLC-3 unit is an excellent way to provide both signals and power from a USB port.

Power requirements: 3.3v, Deep sleep power <10uA, Power down leakage current < 5uA, Standby < 1.0mW (DTIM3), Standard operation 70 to 80mA with 300mA peaks of 1mS or less. At full CPU load and transmitting, may need up to 300mA peak.

Versions / Modules

Board ID pins pitch form factor LEDs Antenna Ant.Socket Shielded dimensions mm FLASH
ESP-01 8 pinout .1“ 2×4 DIL Yes Etched-on PCB No No 14.3 x 24.8
ESP-02 8 .1” 2×4 notch No? None Yes No 14.2 x 14.2
ESP-03 14 2mm 2×7 notch No Ceramic No No 17.3 x 12.1
ESP-04 14 2mm 2×4 notch No? None No No 14.7 x 12.1
ESP-05 5 .1“ 1×5 SIL No None Yes No 14.2 x 14.2
ESP-06 12+GND misc 4×3 dice No None No Yes ?
ESP-07 16 pinout 2mm 2×8 pinhole Yes Ceramic Yes Yes 20.0 x 16.0
ESP-08 14 2mm 2×7 notch No None No Yes 17.0 x 16.0
ESP-09 12+GND misc 4×3 dice No None No No 10.0 x 10.0
ESP-10 5 2mmm? 1×5 notch No None No No 14.2 x 10.0
ESP-11 8 1.27mm 1×8 pinhole No? Ceramic No No 17.3 x 12.1
ESP-12 16 2mm 2×8 notch Yes Etched-on PCB No Yes 24.0 x 16.0 4MB
ESP-12-E 22 pinout 2mm 2×8 notch Yes Etched-on PCB No Yes 24.0 x 16.0
ESP-13 18 0.8mm ? notch ? Etched-on PCB ? ? ? x ?
Olimex 22 .1" Yes Etched-on PCB No No 2MB
NodeMCU^ 16 pinout .1" DIP 0.8" Yes Etched-on PCB No No 48.3x25.4 1.9x1"

Code Snippits

Setting analogWrite range and frequency: analogWriteRange(new_range) sets the upper limit of the values to be sent via analogWrite. Call analogWriteFreq(new_frequency) to change the frequency. PWM frequency is 1kHz by default. Note: This is specific to ESP (not part of standard Arduino)

Print MAC address: Can be important if max address filtering is used on the local wifi:

uint8_t MAC_array[6];
char MAC_char[18];
sprintf(MAC_char,"\n\rMAC ");
    for (int i = 0; i < sizeof(MAC_array); ++i){

Deep sleep (restarts in setup, just as if power had failed)

  ESP.deepSleep(sleepTimeInSeconds * 1000000, RFMode mode = RF_DEFAULT));

(GPIO16 needs to be tied to RST to wake from deepSleep.)

Automatic Reconnect On Wake-Up, is the default. So even before you Wifi.begin, if you were connected before, you suddenly will be again. If that isn't what you want:

WiFi.begin(ssid, password);

Avoiding the Bootup Garbage. On startup, the unit will send out a string of data about version, etc... at a strange baud rate, 76,4884. There is no way to disable this. Instead, connect a serial device to the alternate TX and RX pins. Serial uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX). Serial may be remapped to GPIO15 (TX) and GPIO13 (RX) by calling Serial.swap() after Serial.begin. Calling swap again maps UART0 back to GPIO1 and GPIO3. Use Serial.flush() to block until serial sending is finished before swapping.

Xon/Xoff because no interrupt for serial recieved data is supported on the ESP in the Arduino environment, we must check for incomming data when we want to write data, and hold off if we get an Xoff. We can't avoid taking other characters out of the recieve buffer, becase the Xoff could be "hiding" behind one of them. So we MUST receive all characters sent while we are waiting to send, which means we must buffer those characters into our own rxbuf. So the standard get and put character routines must incorporate that fact.

boolean xoff=false; //must be global
String rxbuf = "";

//If Xoff, recieve bytes until Xon before sending byte.
void putc_x(byte b) {
  while (Serial.available() || xoff) {
    byte c =; 
    //can't peek, because xoff could be behind next char
    if (c == 0x13) { xoff=true; } // XOFF
    else if (c == 0x11) { xoff=false; } // XON
    else if (c > 0 && c < 0xFF) { //rx data
      rxbuf += c; //buffer it
      //TODO: may need to check rxbuf.length() and send an xoff if too big.
    delay(1); //should this be more?
    //TODO: timeout?

byte getc_x(String rxbuf) {
  byte c;
  if (rxbuf.length()>1) {
    c = rxbuf[0];
    return c;
  while (Serial.available()) {
    c =;  //gets one byte from serial buffer
    if (c == 0x13) { xoff=true; } // XOFF
    else if (c == 0x11) { xoff=false; } // XON
    else { //rx data
     break; } //got a byte so we are done
  return c;

//If Xoff, recieve bytes until Xon before sending string.
void writeStr_x(String msg) {
  for(int i=0;i<msg.length();i++) {

boolean checkSerial(byte timout) {
  while (Serial.available()) {
    char c =;  //gets one byte from serial buffer
    if (c == 0x13) { xoff=true; } // XOFF
    else if (c == 0x11) { xoff=false; } // XON
    else if (c>0 && c<0xFF) { rxbuf += c; } //filter out nulls and FF's.
    if (!Serial.available() && timout) { delay(timout); } //wait a tich if there isn't already more data available. Otherwise, timeout.

Connecting serial devices to the web

See also:

file: /Techref/esp-8266.htm, 23KB, , updated: 2017/3/29 12:03, local time: 2017/4/24 10:05,

 ©2017 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE! / 

<A HREF=""> ESP-8266 System On Chip</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?


Welcome to!


Welcome to!