In this guide, we explain in some detail the most relevant aspects of the ESP8266 Serial to Wi-Fi System-on-a-Chip (SoC). We discuss the history, popularity, and hardware specification of this neat little IC. We also outline a few tips to get started developing with this IC, linking to corresponding pages on our site offering more in-depth details.
List of Materials
- 1 x ESP8266 (ESP-12E) Development Board
- 1 x ESP8266 ESP-01 Serial to Wi-Fi Module
- 1 x ESP8266 ESP-12E Serial to Wi-Fi SMD Module
- 1 x ESP8266 WeMos D1 Mini Development Board
What Is The ESP8266?
The ESP8266 was developed by the Shangai-based company Espressif Systems, an IC manufacturer focused on the development of RF chips, particularly Wi-Fi. The ESP8266 succeeded the ESP8089 by the same company, which was a Wi-Fi IC that could be found in some models of inexpensive Android tablets.
The ESP8266 first specs appeared in 2013, and they showed that the chip was meant as something more than a dedicated Wi-Fi interface. The chip was developed as a Serial to Wi-Fi System On a Chip (SoC) based around a Tensilica Xtensa LX3 DPU, the LX106. It included an RF front end, RAM, and an onboard TCP/IP stack that allows it ready to connect to a nearby Access Point, to act as an Access Point itself, or both.
The ESP8266 was first released in the summer of 2014, and since then, it has become a center point in the development of inexpensive IoT applications. Given that Wi-Fi chips have been available for around a decade, you may be wondering what makes the ESP8266 special. Besides being released at the 'right' time, meaning as Internet Of Things (IoT) have entered everyday speak among developers and tech entrepreneurs, there are a few reasons behind its meteoric rise in popularity:
- Very capable microcontroller (32-bit 80MHz, built-in Wi-Fi, adequate I/O buses and peripherals; full specs below)
- Extremely low-cost; ~$1 in moderate volumes)
- Open SDK that works with GCC
- Arduino IDE integration
Even though Soc/ICs with similar capabilities were available in the market from both US- and China-based manufacturers, a combination of 1) openness: Espressif/Tensilica progressively released necessary tidbits to developers, 2) low cost: fan's favorite Wi-Fi chip, TI's CC3000 (only capable of station mode) ran for ~$19 in moderate volumes, and 3) usability: the ESP8266 capabilities pushed beyond a simple Wi-Fi interface like the popular RN-131, CC3000, to which it wasn't possible to load application code.
Although by no means impressive, the processor inside the ESP8266 was a 'game changer' for the development of low-power, low-cost IoT applications. No longer was it necessary to include a separate (host) microcontroller to run application code, which would communicate with a dedicated RF interface chip over Serial UART/SPI, rather, the ESP8266 made possible to run both the application code and the Wi-Fi stack inside the same chip (or on external SPI flash memory).
The ESP8266 SoC comes packaged inside a tiny QFN 32-pin package, as mentioned above, it packs quite a bit for a chip in its price range:
- 32-bit 80Mhz Xtensa LX106 DPU (instruction set available here)
- 802.11b/g/n Wi-Fi
- 96KB data RAM
- 64KB instruction RAM
- 64KB boot ROM
- External SPI flash memory support
- 1 ADC
- 2 SPI, 2 UART, SDIO, I2S (no hardware I2C though)
- Low-power modes
As always, more details and the full list of specs for this SoC can be found in the datasheet.
Because the ESP8266 provides a cost-effective solution to the rapidly growing market of internet-connected projects and devices (i.e., the so-called Internet Of Things), and given the improved usability through the availability of ESP-NN modules, it has become one of the most popular development platforms over the past year and a half. In addition, a dedicated community has formed around it (http://esp8266.com), which has focused on sharing much needed information for developers. As a result, different firmware options have been ported to run on the ESP8266, effectively taking it from a simple Serial to Wi-Fi adapter into a fully functional microcontroller with access to its GPIO and hardware-based functions like PWM, I2C (software), 1-Wire communication, and ADC; all this, of course, in addition to its Wi-Fi capabilities.
The ESP-NN Family of Modules
One consideration for working with the ESP8266 is that it's only available in a tiny-sized QFN package, which can be tough to solder for most Makers and DIYers. Fortunately, Chinese vendors recognized the SoC's popularity early on, and started to offer a series of breakout boards branded ESP-NN, where NN is a two digit number sometimes followed by a letter.
These modules typically carry the ESP8266 SoC, flash memory, a crystal, and in most cases, an onboard antenna. The most salient distinction between different ESP-NN modules are the pins that are broken out from the ESP8266 (for a full list see http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family).
At the time of this writing, there are somewhere between 15 and 20 ESP-NN modules in the market, but we've identified 2 of them as the most useful for our DIY/hobby projects, namely the ESP-01 and the ESP-12E. Although most modules are worth considering for different projects, we favor the highly inexpensive ESP-01 for applications where only a few pins are needed, and the ESP-12E for more complex projects as detailed below!
Our Two Favorite Modules: ESP-01 and ESP-12E
The ESP8266 was developed as a Serial to Wi-Fi adapter, thus its factory firmware consists of an AT+Commands interpreter. As such, this SoC was meant to operate like its predecessors, that is in conjunction with a separate processing unit (e.g., ATmega328), which would run the application code. The application code in turn would send AT+Commands to the ESP8266's Serial UART interface for accessing its Wi-Fi functionality.
The ESP-01 module
Amongst makers and tinkerers, the ESP-01 module fit the bill becaue of its 2×4, 0.1in-pitch, through hole connector, which could be easily wired to a USB to Serial adapter (like FTDI or SiLabs) or microcontroller board (like Arduino). The connector gave easy access to power, VCC and GND; serial communication, RX and TX; two GPIO pins GPIO0, GPIO2; and two (necessary) control pins, CH_PD and RST. By using Male/Female Wire Jumpers, the ESP-01 could be easily connected to a microcontroller development board (e.g., Arduino) or single-board computer (e.g., Raspberry Pi) minding its 3.3VDC operating voltage.
One thing to keep in mind is that the ESP8266 and most ESP-NN modules operate at 3.3VDC, which means that VCC and any other signal we send to it needs to be at this voltage level!
Even though other ESP-NN modules offered different pin arrangements, the ability to connect an external antenna, etc., the comparatively low price of the ESP-01, and its out-of-the-box usability made it a fan favorite. In addition, most modules that followed the ESP-01 were made in form factors that seemed to favor the easy-to-solder castellated pins over the through-hole arrangement.
For us, whenever we'd build a project where we needed Wi-Fi connectivity, we'd try to get by with the reduced number of pins of the ESP-01 in order to minimize cost and reduce development time (i.e., without soldering or need for designing a PCB). However, there'd be been plenty of times where the ESP-01 didn't quite cut it, in which cases we'd turn to the FCC-certified ESP-12E (referred to as ESP-12F), mounted on our easy-to-use development board (described below)!
Want to get started with your ESP-01? Here's our step-by-step guide!
The ESP-12E module
From the different ESP-NN modules, we chose the ESP-12E to be the main one in our lineup. The reason is that this module was chosen by the NodeMCU project for their DevKit 1.0 hardware. The NodeMCU development team Open-Sourced the hardware design, and after garnering enough interest from users around the ESP-12E module, its manufacturers have submitted for, and successfully passed, FCC certification. This represents one less worry when designing embedded applications using this module (note that the FCC-certified version of the module is sometimes referred to as ESP-12F).
Like all ESP-NN modules, the ESP-12E has a small footprint. Its castellated pins make it hard to work with out-of-the-box (e.g., on a breadboard), so it's mainly aimed to be mounted on a PCB. The module breaks out all the GPIO of the ESP8266, and it includes a visible LED for indicating status. In addition, under the tin can, the ESP-12E a 4MB SPI flash storage IC – typically the Winbond W25Q32FV, and all the necessary components needed for the onboard ESP8266 to operate properly (e.g., crystal, capacitors, resistors). It also includes an onboard antenna with a reasonable range (–70~–80 dBm at 50 feet).
As discussed before, the ESP-01 has been very handy when we wanted to wire up an ESP8266 quickly to a microcontroller board for adding Wi-Fi connectivity. However, one important contribution from the NodeMCU project is that it showed us that relatively complex firmware could be run on the ESP8266 without a separate microcontroller, needing only an SPI flash memory module for storing application code. And so, given that the ESP-12E contains a 4MB flash memory IC, it's all that's needed for developing Wi-Fi connected applications.
The ESP-12E Development Board (NodeMCU DevKit 1.0)
To further increase the usability of the ESP-12E module for rapid prototyping, some power regulation and USB connectivity could be added. This is what ourselves and other US-based vendors have contributed to the ESP8266 ecosystem. In our case we've developed a board that includes (among other passive components and discrete ICs) a Silicon Labs CP2102 USB to Serial UART adapter IC, a NCP1117 3.3VDC Voltage Regulator, micro-USB connector, and through-hole (male) pin headers.
Following the Open-Source design of the NodeMCU Team, the board breaks out all the (available) ESP8266 pins to through-hole headers for easy breadboarding. The board also includes additional GND, Vin, 3.3VDC signals for easy access during development. This development board for the ESP8266 SoC inside the ESP-12E module is out-of-the-box ready for you to connect it to your computer, install USB drivers, and start writing programs that connect to your Wi-Fi network!
Please note that only one firmware option can be running on your ESP8266 at a time. For instance, if you have the the factory firmware (AT+Commands interpreter) and upload the Blink program from the Arduino IDE, you'll need to re-flash the AT+Commands firmware to be able to use it once again. The process is painless, so we encourage you to try all options available.
AT+Command Processor (Default)
The quickest way to get started with the ESP8266 is to use its factory firmware, which allows it to process any AT+Commands that it receives over its Serial UART interface. The biggest advantage of this option is that we need not be familiar with any specific language or framework to use the module. We can simply send it a series of commands to achieve our goal. The downside to this is that we need either an additional microcontroller involved or a USB to Serial adapter to send the necessary commands. Some of the basic AT+Commands available are:
For the full list, please see the document: https://acrobotic.com/datasheets/ESP8266_at_commands.pdf.
Whereas the AT+Commands are a standard (since the 80s!) way of communicating with RF chips, they pose the limitation of needing an additional (host) device to run application code that, when needed, sends the commands to specify the behavior of the RF interface. However, one aspect that made the ESP8266 stand out is its ability to store application code in addition to the Wi-Fi stack inside its own flash memory storage, or in a separate SPI flash memory IC. This was further aided by Espressif willingness to open its Software Development Kit (SDK) that allowed developers to implement a toolchain (including the GNU Compiler Collection) to flash different firmware options.
NodeMCU is, at the moment, the most popular alternative firmware that runs on the ESP8266. Based on the eLua project, it runs a Lua interpreter onboard the ESP8266, which is able to execute commands written in the Lua scripting language. The commands are sent to the ESP8266 via the Serial UART interface.
NodeMCU is a great starting point for Makers as it provides an interactive environment that allows running commands not only for controlling the ESP8266's wireless interface, but also its GPIO and hardware functionality such as PWM. In addition, we have access to the full scope of the Lua programming language for writing our applications. In the case of the default firmware (AT+Commands Interpreter), the application code would have to be developed using a programming language suited to the microcontroller or SoC we use to develop the interface for sending the commands over Serial (e.g., C/C++ for microcontrollers in the Arduino boards).
Finally, not only does the NodeMCU firmware allows us to execute commands interactively, but we can save our applications as a script in the ESP8266's flash memory, and instruct it to run the application code every time it restarts! Even though this is a convenient option, our preferred method of working with the ESP8266 is to write our own firmware using the Arduino framework (details below).
Custom Firmware (using the Arduino IDE)
Whereas custom firmware can be compiled and flashed onto the ESP8266 directly, the easiest way of loading your own firmware is by using the Arduino IDE. Although some users might find cumbersome to use the Arduino program structure to write their application code, we certainly favor this option in most of our projects. Even though this method erases any existing firmware on the ESP8266's flash memory, it is a straight-forward process to re-flash any of the other options!
For advanced users, there is the esp-open-sdk toolchain which allows us to progam the ESP8266 directly (more info at the esp8266.com wiki) without having to use the Arduino IDE for uploading the code to it.
Great Projects to Get Started!
In the interest of helping out or Maker community, we're continuously developing new projects to help them along with their projects. For ideas and demos of different functionality of the ESP8266 checkout the following projects:
Keep an eye out on this list, as we'll updated frequently with many more projects to come!