#Guide: which ESP8266 module to choose, power supply, how to program it in C++ with Arduino IDE, MicroPython, ESP Easy

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)
esp-wroom-02-esp8266ex-2018
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.  Technical documentation ESP8266EX 18x20x3 18 2
esp-wroom-02d-esp8266ex-2018
The ESP-WROOM-02D is built around the ESP8266EX. The antenna engraved on the PCB is more efficient Technical documentation ESP8266EX 18x20x3.2 18 2
esp-wroom-02u-esp8266ex-2018
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. Technical documentation ESP8266EX 18Xx14.3×3.2 18 2
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 Technical documentation ESP8266EX 16x23x3 20 2

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.

Warning. The ESP8266 modules operate with a voltage of 3.3 Volts that is dangerous to exceed. Some boards that ship a voltage regulator that protects the ESP8266 module and allows you to use a 5Volt power supply (usually between 3.3 and 6.2 Volts).

Model Photo Certifications Internal Antenna

External Antenna

Dimensions

(mm)

Pins (GPIO) Datasheet
ESP-01 esp8266 esp-01  Not approved FCC and CE PCB engraved

No

14.3 x 24.8 8
ESP-02 esp8266 esp-02  ? No

Yes

14.2 x 14.2 8
ESP-03 esp8266 esp-03 ? Ceramic

No

17.3 x 12.1 14
ESP-04 esp8266 esp-04 ? ?

?

14.7 x 12.1 14
ESP-05 esp8266 esp-05  ? No

Yes

14.2 x 14.2 5
ESP-06 esp8266 esp-06 Not approved FCC and CE ?

?

? 12+GND
ESP-07 esp8266 esp-07 Not approved FCC and CE Ceramic

Yes

20.0 x 16.0 16
ESP-08 esp8266 esp-08 Not approved FCC and CE No

No

17.0 x 16.0 14
ESP-08 New  ? No

No

18.0 x 16.0 16
ESP-09 esp8266 esp-09 ? No

No

 10.0 x 10.0 12+GND
ESP-10 esp8266 esp-10 ? No

No

 14.2 x 10.0 5
ESP-11 esp8266 esp-11  ? Ceramic

No

 17.3 x 12.1 8
ESP-12 esp8266 esp-12 CE certificate n°BCTC-141212468

FCC certificate n°2ADUIESP-12

PCB

No

 24.0 x 16.0 16
ESP-12-E/Q esp8266 esp-12-eq Probably the same certifications as the ESP-12 PCB

No

 24.0 x 16.0 22
ESP-13 esp8266 esp-13 ? PCB

No

 ? 18
ESP-14 esp8266 esp-14 PCB

No

 24.3 x 16.2 22
ESP-WROOM-02 esp8266 WROOM-02 CE

FCC

PCB

No

 20 x 18 x 3 18 Read
WT8266-S1 esp8266 WT8266-S1 CE certificate n°BCTC-150809775

FCC certificate n°2AFOSWT8266

PCB

No

 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 card 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.

adaptateur adaptor esp8266 esp-07 esp-12 esp-12e

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).

ESP-01 (obsolete)

esp8266 esp-01The 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.

ESP-05 (obsolete)

esp8266 esp-05Unlike 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)

The ESP-12E is an improved version of the ESP-12. The ESP-12E has 11 GPIO pins as well as an analog / digital converter (ADC) with a resolution of 10 bits.

This is the module used by almost all NodeMCU cards. Compact and versatile, it is the ideal card 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 card 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.

Solar Powerbank

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

wemos d1 mini shield batterie lipoSome 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 card 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 cards 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 5V arduino power supply breadboard alimentation électrique3.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 cards 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.

alimentation 3.3V breadboard arduino LD1117 jack

How to program an ESP8266 module

USB cable or FTDI module?

module ftdiThe ESP-12 (or ESP-12E) modules are usually equipped with a USB port. A simple micro-usb cable will be enough. Some cards 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.

espeasy plugin playground develop

To go further, here are the latest tutorials published on the ESP Easy firmware

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).

esp8266 web server spiffs bootstrap dht22 bmp180 google charts

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 card. Here is for example the correspondence of the pins of a Wemos D1 Mini.

Correspondance Pins GPIO 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.

In MicroPython

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

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.

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.

DIY Projects