ESP8266, a System-on-Chip (SoC) manufactured by ESpressif, is the most popular IoT development platform is a complete and self-contained Wi-Fi networking solution. The SoC consists of a Tensilica L106 32-bit microcontroller and a Wi-Fi transceiver. Therefore, the chip can be used to self-host an IoT or embedded application or offload Wi-Fi networking functions to another microcontroller or single-board computer. There are many ESP8266-based development boards. All these boards have the ESP8266 SoC chip at their heart. These development boards can be used as either only a Wi-Fi adaptor or as a single-board microcontroller with Wi-Fi networking capabilities.
The on-chip microcontroller itself provides 17 GPIO (General Purpose Input/Output) and one 10-bit ADC analog input. The SoC has four PWM interfaces that are software-enabled only. The chip is enabled with one SPI interface, one I2C interface, two UART interfaces, and one IR remote control interface for serial data communication. So, a carefully selected ESP8266 development board has everything that any capable single-board microcontroller must-have. The additional Wi-Fi networking capability allows an ESP8266-based development board to connect with a Wi-Fi network, connect with the internet, host a web server, and implement full-fledged Wi-Fi-enabled IoT applications.
When self-hosting an embedded/IoT application, the SoC requires an external flash to boot it directly. When used as a Wi-Fi adapter, the chip can be connected to a single-board microcontroller or single-board computer using SPI, I2C, or UART.
The ESP8266 SoC is designed for ultra low power technology. It is designed considering applications in wearable electronics, mobile, and the Internet of Things. The chip can operate in three modes – active, sleep, and deep sleep. In deep sleep mode, the chip consumes only 60 uA, and in sleep mode, it consumes less than 1.0 mA and 0.5 mA while staying connected to a Wi-Fi access point. The SoC has a built-in real-time clock and watchdog timer, which remain active in the sleep mode. The built-in RTC can be programmed to wake up the ESP8266 at any required interval or when a specified condition is detected. This way, an ESP8266-based device can be programmed to remain in a low-power standby mode until Wi-Fi is needed.
ESP8266, a low-power WiFi-enabled microcontroller solution, is perfect for designing battery-powered wearable electronics and portable/mobile IoT devices.
ESP8266 features
Some of the most notable features of ESP8266 SoC are as follows.
- 11 b/g/n
- Wi-Fi 2.4GHz with WPA/WPA2 security
- Wi-Fi Direct (P2P station), SoftAP, SoftAP+station
- Built-in TCP-IP protocol stack
- Support IPv4, TCP/UDP/HTTP/FTP network protocols
- Antenna diversity (External, PCB trace, Ceramic chip, IPEX connector)
- Support STA/AP/STA+AP operation modes
- GPIO, SDIO 2.0, SPI, I2C, UART, I2S, IR Remote Control, PWM
- Built-in 10-bit ADC
- Built-in TR switch, balun, LNA, power amplifier, and matching network
- Built-in power regulator, PLL, and power management units
- Support smart link for both Android and iOS devices
- Configurable via AT instruction set, Cloud Server, Android, and iOS Apps
- Support Cloud Server Development as well as SDK for custom firmware development
- Firmware can be upgraded through UART download as well as OTA (via Wi-Fi network)
- Support WEP/TKIP/AES encryption
- Integrated low-power 32-bit microcontroller
- Low power consumption, less than 10uA in deep sleep and void access point
- Wake up and transmit packets in less than 2 ms
- Wide operating temperature range -40˚C to 125˚C
ESP8266 modules
There are several ESP8266-based modules. These are either stand-alone modules or complete development boards. The stand-alone modules generally contain only the ESP8266 SoC and the components required to run it. Most stand-alone modules are available as ESP-NN (ESP01 to ESP14) series from the AI-Thinkers vendor. A stand-alone module ESP-WROOM-02 is available from Espressif itself. Other stand-alone modules are available from other vendors like Wireless-tag, Olimex, Smarttime, and Qilianer. The following table lists and compares the available stand-alone ESP8266 modules.
These stand-alone modules serve as only a Wi-Fi adaptor or a Wi-Fi-enabled microcontroller development board. These modules vary in size, pins are broken out, exposed on-chip features, antenna type, and flash memory. A bare-bones ESP8266 SoC requires an external flash memory, reset and program circuitry, chip enabling circuitry, 3.3 voltage regulator power supply, and a USB-to-Serial adapter. All of these required features may be onboard in a module, or some may be required to be provided externally.
The ESP8266-based development boards have all the required circuitry with or without a USB interface for programming. Some popular ESP8266 development boards are available from Adafruit, SparkFun, NodeMCU, and AI Thinkers. The following tables lists notable features of some of these ESP8266 development boards.
ESP8266 development boards can be divided into two categories:
- ESP8266 Development boards with USB interface: These development boards have a USB interface for programming. They have all the required circuitry onboard and do not require any external circuit setup. Some examples of such development boards include SparkFun ESP8266 Thing, Adafruit Feather HUZZA, SparkFun Blynk Board, and some of the AI Thinker ESP-NN boards. When such boards are connected to a desktop computer via USB cable, they show up in device manager on Windows PC or in lsusb on a Linux system. They have an onboard 3.3V regulator and can be programmed directly via a USB interface. Such development boards do not require any external circuit for setup and operation. At most, one may need to solder header pins or get the header already soldered.
- ESP8266 Development boards without USB interface: These development boards require a USB-to-Serial adaptor for programming. The board may have a 3.3V regulator or may not even have that. Apart from the 3.3V regulator and USB-to-Serial adaptor, the board requires an external circuit to enable the chip and add a reset and programming button.
The USB-to-Serial converter must operate at 3.3V. If the USB-to-Serial adaptor operates at 5V, it will damage the ESP8266 development board. The most popular USB-to-Serial adaptor used with ESP8266 dev boards is FTDI FT232RL, as it can be switched between 5V and 3V3 operation.
To connect USB-to-Serial adapter with ESP8266 dev board, connect ground, RX-pin, TX-pin, and DTR pin (if available) of USB-to-Serial adaptor to ground, TX, RX, and DTR pins of the ESP8266 chip.
If the ESP8266 development board does not have an onboard 3.3V regulator, the 3.3V supply can be provided either through Arduino’s 3.3V out or using LM1117-3.3. The 3.3V output of most of the Arduino boards is not powerful enough to drive an ESP dev board. Therefore, it is best recommended to supply power via LM1117-3.3. LM1117-3.3 must be connected as follow to supply power to an ESP8266 board.
To enable the ESP8266 chip, connect CH_PD (Chip Enable/Chip Power Down) pin to VCC through a 10K resistor. Disable SD card boot by connecting GPIO15 to ground through a 10K resistor. Select normal boot mode by connecting GPIO0 to VCC through a 10K resistor. To avoid random reset, connect RST pin to VCC through 10K resistor. The GPIO2 must remain not connected. Connect a push button between the RST pin and ground to add a reset button. Connect GPIO0 to ground through the 470Ω resistor to add a program button. The GPIO0 must be pulled low when programming the ESP8266. The chip enables, reset, and programming circuit for ESP8266 development board is shown below.
Programming ESP8266 development boards
Programming ESP8266 development board requires loading firmware to it. There are broadly three methods for programming ESP8266 development boards. There is not one but several ways ESP8266 development board can be programmed.
- Using Arduino IDE – Arduino provides a third-party plugin to use Arduino IDE for different CPUs. It uses the Xtensa GCC toolchain, available at Github as esp8266/Arduino. It also provides ESPTool to upload hex files (sketches/application codes) to the ESP8266 SoC. Once the board manager URL is added to the IDE’s preference setting menu and the ESP8266 board is installed through Tools->Boards->Board Manager, the code for the ESP8266 development board can be written, edited, compiled, and uploaded from the Arduino IDE like it is done for the Arduino boards.
- Setup the GCC Toolchain and SDK manually: An open-source toolchain for ESP8266 development boards is available on Github. This toolchain can be used to build a custom firmware file for yourself. The toolchain only runs on a Linux host or can be run on other desktop systems using a Linux virtual machine.
- Using pre-built custom toolchains: Some pre-built custom toolchains are available that can be directly downloaded as ESP8266 firmware, and then sketches (application codes) can be flashed to ESP8266 for that firmware. Some of the popular toolchain for ESP8266 development boards are as follow –
- Espressif firmware source
- Electrodragon’s ESP8266 AT-command firmware
- Espressif AT command firmware
- NodeMCU firmware for running LUA scripts on ESP8266
- MicroPython firmware, for running Python 3 scripts on ESP8266 and several other microcontrollers
- Moddable SDK for running 2020 standard Javascript on ESP8266, ESP32, and some other microcontrollers
- ESP8266Basic, a basic interpreter for browser-based development on ESP8266
ESP8266 applications
ESP8266 is a powerful Wi-Fi networking solution with single-board microcontroller features. It is best suited for mobile, wearable, and IoT devices. There are several ESP8266 development boards available, and they can be programmed using different toolchains. Different toolchains allow programming ESP8266 development boards in several programming languages like C, Python, Javascript, LUA scripting, and AT commands. Some of the possible IoT applications using ESP8266 development boards are home automation, mesh network, IP cameras, baby monitors, wearable electronics, industrial wireless control, security ID tags, sensor networks, Wi-Fi location-aware devices, Wi-Fi position system beacon, smart plug, and lights, internet-controlled home appliances, etc.
Design considerations with ESP8266
There are a few factors that must be considered before selecting ESP8266 development boards for WiFi-enabled IoT applications –
- ESP8266 operates at 3.3V, even a supply of 5V can kill the SoC. The GPIO of the ESP8266 can only source or sink 12 mA per output pin. So, ESP8266 is suitable only for low-power IoT applications.
- The voltage range of ESP8266’s analog to digital converter is only 0~1V. This limits the use of ESP8266 in the field of analog sensing.
- The ESP8266 shares the CPU time and system resources with the Wi-Fi transceiver. Therefore, the application code should not have long loops that never complete execution. So, ESP8266 must be used for specified IoT applications.
- The PWM and I2C on ESP8266 are emulated in software. There is no dedicated hardware for them.
You may also like:
Filed Under: Applications, Arduino, ESP8266., Featured, IoT applications, Tech Articles
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.