The ESP8266 was released in 2014. In just a few years it has gone from a simple WiFi module project for Arduino for a few euros to a full development board. The ESP8266 is a true Arduino Killer.
It has several inputs / outputs (GPIO), a WiFi connection, a power saving mode (Sleep esMode) and can be programmed either using the Arduino IDE or Lua (firmware NodeMCU), in MicroPython. Even better, with the ESP Easy firmware, you do not even need to know how to program to develop your connected objects and connect them to a DIY home automation server!
The models ESP8266EX 2018
The ESP8266 is developed by the Chinese company Espressif. Released in October 2014, the ESP8266 immediately aroused great interest from the community. The project is supported by a large community that you can follow here. This module does not content to offer a Wi-Fi connection to Arduino projects, it has its own inputs / outputs (GPIO) whose number depends on the model. Espressif first developed a very large family of circuits. In 2018, there are only three models of ESP8266 now called ESP8266EX. There are only four versions of the module. The difference between the modules is essentially at the antenna level.
Key features of the ESP8266EX
- Single-core processor clocked at 160 MHz
- +19.5 dBm output on the antenna ensures good physical reach
- Standby current is less than 20 μA
- WiFi 802.11 b / g / n at 2.4 GHz
- The ESP8266EX supports UART, GPIO, I2C, I2S, SDIO, PWM, ADC and SPI inputs / outputs
- CE and FCC certified
|Module||Description||SoC||Dimensions (mm)||Pins||Flash (MB)|
|The ESP-WROOM-02 is the basic module. The WiFi antenna is engraved on the PCB is based on ESP8266EX, measuring as small as 18x20x3 mm.
|The ESP-WROOM-02D is built around the ESP8266EX. The antenna engraved on the PCB is more efficient
|The ESP-WROOM-02U is a more compact version (18 x 14.3 x 3.2 mm). It does not have an antenna. Instead, it has a connector U.FL (IPEX) on which we will connect an external antenna.
|The ESP-WROOM-S2 is a specific model that can work as an SDIO / SPI slave. The SPI bus has been optimized to reach a speed of 8 Mbps
The old models of ESP8266
Before 2018, there were about 18 versions of the ESP8266, of which the following are the main features. I prefer to leave this part of the article for the record because we always find these modules for sale. Most often, the ESP-12E or ESP-12F modules are still marketed. The ESP-01 is always on sale, but it slowly begins to disappear from the shelves. There is only one page of results on AliExpress.
|ESP-01||Not approved FCC and CE||PCB engraved
|14.3 x 24.8||8|
|14.2 x 14.2||8|
|17.3 x 12.1||14|
|14.7 x 12.1||14|
|14.2 x 14.2||5|
|ESP-06||Not approved FCC and CE||?
|ESP-07||Not approved FCC and CE||Ceramic
|20.0 x 16.0||16|
|ESP-08||Not approved FCC and CE||No
|17.0 x 16.0||14|
|18.0 x 16.0||16|
|10.0 x 10.0||12+GND|
|14.2 x 10.0||5|
|17.3 x 12.1||8|
|ESP-12||CE certificate n°BCTC-141212468
FCC certificate n°2ADUIESP-12
|24.0 x 16.0||16|
|ESP-12-E/Q||Probably the same certifications as the ESP-12||PCB
|24.0 x 16.0||22|
|24.3 x 16.2||22|
|20 x 18 x 3||18||Read|
|WT8266-S1||CE certificate n°BCTC-150809775
FCC certificate n°2AFOSWT8266
|15.0 x 18.6||18||Read|
Find all the models available at this address. Image sources: esp8266.com.
Which model of ESP8266EX to choose for your DIY projects in 2018
Espressif has simplified its range and consequently the choice. All four versions ship the same ESP8266EX module. Completed the 4MB or 16MB versions that the Wemos d1 mini Pro has never been able to exploit elsewhere. Now we will have to settle for 2MB. Do not worry, it’s good enough for most applications. The memory of the ESP8266 is not intended to store data, we can always use an SD board reader for that.
At the moment, ESP8266EX-based development boards are still non-existent. There are some modules on AliExpress like this with the mention Special Client Only. It will therefore still wait a few months, the time that manufacturers use their inventory of old models.
If you have the necessary equipment and skills, you can buy the chip directly in a standard QFN32 package.
Which older generation model to choose?
Although Espressif has simplified the entire ESP8266 familly in 2018, the old modules are still on sale. Before 2018, there were many versions of the ESP8266 (about 18). However, among all these models, there are very few that are suitable for use for DIY projects (without tinkering pinning), this is the case of ESP-01 and ESP-05.Which model to choose for your DIY projects
All other models are assembled in the form of a soldering PCB (SMD). You will most often find them already integrated in an Arduino board but there are also 2.54mm pitch adapters for breadboards on which you will be soldering an ESP8266 module (ESP-07, ESP-08 or ESP-12). The most popular model is the ESP-12E (or E/Q).
The ESP-01 is probably the best known module (and the most sold). This very compact module, no bigger than a 2€ coin (14.3 x 24.8mm), has 512kB of flash memory , an antenna printed on the PCB as well as 2 GPIO pins. This is the module is ideal to add a WiFi connection to an Arduino project for less than €3.
The ESP-01 is not directly usable on a breadboard. Second, it is not CE or FCC certified. I noticed some disturbance of the WiFi of neighboring devices when powering up. It may be due to my equipment.
Unlike the ESP-01, the ESP-05 does not have a GPIO pin. Very compact (14 x 14 mm). The ESP-05 has 4 pins in pitch of 2.54mm (so compatible with a breadboard) 3.3V, GND, RX and TX. You will also find some models with a 5th pin Reset. It will be perfect to add a WiFi connection to an Arduino project for around €3.25.
Pay attention to the time of purchase because all models sold do not seem to be delivered with the same firmware.
ESP-12E or ESP-12F (replaced by ESP8266EX)
This is the module used by almost all NodeMCU boards. Compact and versatile, it is the ideal board for creating connected objects projects.
To begin, I recommend the WeMos d1 Mini development board. It is fully supported by the Arduino IDE. No need to put the board in Bootloader mode whenever you want to upload the program from the Arduino IDE
How to power an ESP8266 module
Some ESP8266 modules must be powered by 3.3 Volts and no protection exists. Here are several solutions to feed your modules.
Another important point to know. If you have to reinstall the firmware (NodeMCU or ESPEasy for example), the power supply must be able to deliver 300mA during the flashing of the firmware. Some FTDI cables can not deliver sufficient power. In this case, an external power supply will be required.
The ESP8266 is ideal for making connected objects that run on battery power. In sleep mode, the power consumption does not exceed 20 μA (on the new models ESP-WROOM-02 / ESP8266EX at least). It is possible to manufacture its own solar power circuit but there is an even more practical solution, the solar Powerbank. Place the Powerbank in a brightly lit place, ideally in direct sunlight to ensure a full charge during the day.
Some tips to save battery and ensure a continuous operation of your objects:
- Turn on Deep Sleep mode in your ESP8266 and ESP32 programs. The power consumption will be limited to 20 μA.
- Limit the sending of data to a minimum. Use optimized technology for fast, lightweight data transfer. For example MQTT or the Websocket
- Limit the frequency of sending data to a server (local or remote). The WiFi connection is very greedy in energy.
- Optimize your code by limiting energy consuming calculations.
- Use the interrupts to wake up the module when an actuator is pressed (bell button,
- Use energy-saving sensors. Do not use a physico-chemical sensor of the MQx series (for example the MQ2 or MQ135). They must be hot (permanently) so that pollutant measurement is possible. Instead, use self-calibrating sensors such as the MH-Z19 to measure CO2 content.
- If your project uses energy-consuming actuators (servomotor, Nema motor …), opt for a very big Powerbank (at least 20000mAh)
- The performance of the batteries decreases when the temperature drops (even more below 0 ° C), isolate the Powerbank to protect the battery.
- Below 0°C, electrolytes (contained in capacitors for example) can freeze. Your projects may not work properly. It is not necessarily the Powerbank that is unloaded.
Read this tutorial to learn how to measure battery voltage using an Arduino or ESP8266.
The complete selection of Solar Powerbank
2xAA batteries holder
ESP is ideal for developing connected object projects. The first solution to power your projects is to use a case for AA batteries. Depending on the number of 1.5V batteries, the voltage delivered by the power supply box will be higher or lower. For example with 4xAA 1.5V batteries, we can supply the module in 6V. Beyond, for example with a box of 6xAA batteries that can deliver 9V, it will be necessary to add a voltage regulator (for example a detailed LD1117V33 below).
The complete selection of 4xAA batteries holder
LiPo 3,7V battery
Some development boards come with a JST connector for LiPo battery. This is for example the case of Olimexino-85S. WeMos offers a LiPo battery shield equipped with a JSH XH2-2.54mm connector that allows to power and charge the battery simultaneously.
Features of the shield battery for Wemos d1 mini
- Charging voltage: nominal 5V (max 10V)
- Load current: 0.5A by default. Solder the jumper J1 to increase to 1A (be careful, check the compatibility with the battery before any modification)
- Supported Lithium Battery: 3.3 to 4.2V
- Voltage converter up to 5V (max. 1A)
- Battery connector in JST XH2-2.54mm
- Micro-USB connector (OTG) for recharging (5V, max 10V)
- Green Led: On when charging is complete
- Red Led: On during charging
- Jumper J1: Increases the load current from 0.5A to 1A
Opt for a battery of at least 850mAh for a connected probe project that publishes on a WiFi server its measurements every hour.
Shield for 18650 battery
Sold less than $2 / $2.3 on AliExpress or eBay, this shield makes it very easy to power your projects of connected objects and even a Raspberry Pi using a LiFePO4 18650 battery. The board is equipped with a circuit allowing to charge the battery (pay attention to polarity) even when operating with a micro-USB connector. It is possible to feed multiple boards simultaneously with 3 output 5V and 3 output 3.3V (solder pins) and a conventional USB connector. Here are the characteristics of the board
- Power supply: 5 to 8V via micro USB port up to 0.5A
- Output power
- 5V via USB Type A port
- 3 connectors to deliver 3V up to 1A
- 3 connectors to deliver 5V up to 2A
- Misc: 1 USB output, LED for the state of charge (green = battery charged, red = charging)
- Battery protection (overcharging or over-discharging). Attention, no protection in case of reverse polarity
- Dimensions: 98 x 29 mm
Depending on your project and how often you send the data, choose a large capacity battery.
3.3V or 5V breadboard power supply
During the entire development and development phase of your project, it is very practical to use a breadboard with a 5V / 3.3V power supply. There are breadboard power boards for less than €2.
3.3V power supply using LD1117V33 voltage regulator
You can use an old power supply of a smartphone. For this you will need a jack adapter with a screw terminal and a voltage regulator (LD1117V33 for example) to deliver the 3.3 Volts needed for the ESP8266. Be careful not to exceed the recommended supply voltage (technical documentation). Finally, take into account in the design of your projects that the LD1117 heats (a lot). You can also add a 10μF capacitor for a more stable power supply.
How to program an ESP8266 module
USB cable or FTDI module?
The ESP-12 (or ESP-12E) modules are usually equipped with a USB port. A simple micro-usb cable will be enough. Some boards must be programmed using a Serial / USB adapter, called the FTDI module that can be purchased for around €2.50.
Be careful though. Some FTDI cables are not able to deliver the 300mA needed for the upload.
ESP Easy: no programming needed
ESP Easy is a firmware that allows you to program, or rather configure, the ESP module on which it is installed. To learn more, read this introductory article that explains how to install the firmware.
To go further, here are the latest tutorials published on the ESP Easy firmware
- The firmware ESP Easy Mega arrives on ESP32, test on the Wemos LoLin32 Lite, novelties of the firmware
- #Hack: SONOFF S20 plug to make it a super intelligent plug with ESP Easy
- ESP Easy: flash the firmware with esptool.py on ESP8266 (GitHub)
- ESP Easy: firmware ESP8266 to create connected and home automation objects without programming
- ESP Easy: flash the firmware with esptool.py on ESP8266 (GitHub)
- Domoticz: Lua script to create a remote OLED display with ESP Easy
- ESP Easy + MQTT + Node-RED: bi-directional communication, dashboard
- ESP Easy (Rules). Setpoint for connected thermostat. Home Assistant, Domoticz, Node-RED
- Shield Wemos D1 Mini DHT11 or DHT22: Arduino code – ESP Easy
- Jeedom, create an OLED SSD1306 remote display with ESP Easy and HTTP request
Develop in C++ with the Arduino IDE
If you are new to Arduino programming or are new to ESP8266, this is probably the easiest way to get started. The ESP8266Wifi library is now very advanced and greatly simplifies programming. This is an argument that also favors the Arduino IDE. Read this tutorial to get started with the ESP8266 modules and the Arduino IDE (installation of libraries, GPIO, Web Server, Web Client).
Pin correspondence between Arduino and ESP8266 (NodeMCU)
The ESP8266 is programmed exactly like an Arduino, it will just need to look for the matching pins for your board. Here is for example the correspondence of the pins of a Wemos D1 Mini.
In Lua (NodeMCU)
NodeMCU is a firmware that allows you to program ESP8266 modules in a language called Lua. You can consult the open-source project NodeMCU here. There are two versions of NodeMCU:
- NodeMCU v0.9 for ESP-12 modules
- NodeMCU v1.0 for ESP-12E modules
To program in Lua, the simplest is to use ESPlorer presented (quickly) in this article.
If you already have some Python knowledge, you can install the MicroPython firmware. It is a Python language port for ESP8266 modules. The syntax is exactly the same. We find all the basic functions of the language as well as functions specific to ESP8266 modules. Management of WiFi, GPIO …
Here is a series of tutorials to start in MicroPython
- ESP32 MicroPython project with several DS18B20 probes, publish the measurements to Domoticz using the HTTP JSON API
- OLED display SSD1306 in MicroPython, example with a I2C digital barometer BME280 (or BMP180)
- MicroPython tutorial, manage WiFi connection at startup on ESP8266 / ESP32
- uPiCraft, a MicroPython IDE dedicated to the development of IoT based on ESP8266, ESP32, microbit, pyBoard
- How to reinstall the MicroPython firmware on an ESP8266 or ESP32 with the esptool.py script
- Unpacking the Wemos ESP32 Lolin32 Lite, testing the firmware MicroPython with a Raspberry Pi 3
How to install a firmware ?
It is very simple to change the firmware of an ESP8266. Be aware that the firmware (NodeMCU, ESP Easy) is cleared as soon as you upload from the Arduino IDE. Here are several articles that deal with the subject.
- Hack Sonoff 4CH Pro with firmware MQTT Tasmota, inclusion in Domoticz
- Esptoo. Update ESP8266 NodeMCU firmware on macOS
- Nodemcu-build: Firmware NodeMCU ESP8266 custom (Frightanic)
- How to store data on a micro SD card. Arduino code compatible ESP32, ESP8266
- Getting started Arduino. Receive commands from the serial port (ESP32 ESP8266 compatible)
- C++ functions print•println•printf•sprintf for Arduino ESP32 ESP8266. Combine•format → serial port
- C++ String functions. concat•c_srt•indexOf•replace•subString… for Arduino, ESP32, ESP8266
- How to assign a fixed IP to an ESP32 ESP8266 or ESP01 project