The ESP01 is an ESP8266 module installed on a miniature development board that has four expansion slots (GPIO). The difference between the versions lies in the quantity of flash memory on board by the board, 512Ko (ESP01) or 1Mo (ESP01S).
Initially developed to add WiFi connectivity to the Arduino, it has become a stand-alone module for making mini connected objects. Relays, various sensors (temperature, humidity, energy consumption, etc.), OLED display, etc.
ESP-01 vs ESP-01S, which one to choose?
The ESP01 is simply an ESP8266 module installed on a miniature development board (24.8 x 14.3mm). There are only 2 pins of the ESP8266EX module that are exposed on the GPIO GPIO0 and GPIO2 as well as the pins et for programming and debugging via the serial port.
The difference between the versions lies only in the amount of flash memory, 512 KB or 1 MB.
A few years ago, you could tell by the color of the board. This is no longer the case today even if some manufacturers keep this marketing difference.
The table below summarizes the main differences between the two versions.
|Flash Memory||512 Mo||1 Mo|
|Possible mention||AI Cloud Inside||S Series|
|Note||The red (Power) and blue (WiFi) LEDs are placed next to the antenna engraved on the PCB|
Given the very small price difference (a few tens of cents) between the two models, it is preferable to opt directly for an ESP-01S module.
Whatever the version, the input / output connector (GPIO) is perfectly identical. It has not changed since the first version of the ESP01 module.
Here is the pin identification for the 2 models
Put the ESP01 module in Flash Mode
Most of the ESP32 and ESP8266 development boards most of the time integrate a UART to USB converter (CH340, CP212 …). In addition to this, the ESP8266 development kit takes care of putting the module in a particular mode which allows the binary file of the program to be uploaded to the flash memory.
However, to be as compact, the ESP01 module does not include a UART to USB converter.
You must put the module in Flash Mode yourself each time you want to upload a program from the Arduino IDE or any other code editor.
It’s quite simple, you need the pin GPIO2 be connected to GND when the module is powered on.
Then you can upload the program using a module or a USB to TTL (UART) cable. It is also necessary that the power supply is sufficiently powerful to avoid any failure to transfer the program.
The following diagram uses an external power supply (2 AA batteries). This is not necessary if the USB to TTL adapter delivers enough power. Problems are often encountered with serial cables.
It quickly becomes tedious!
The best is to buy a programmer (Programmer in English) which embeds both a power supply and a USB to TTL adapter.
This article explains everything in detail
There are few programmers who allow you to activate Flash Mode and in the end it is not very useful because you have to disconnect / reconnect the module each time to be able to use it normally.
It is enough to solder a push button and hold the button while inserting the programmer in the USB port of the computer.
How to upload a program from the Arduino IDE?
Before you can develop a program for the ESP-01 WiFi module, you need to install the official ESP8266 SDK. Follow the detailed instructions in this tutorial
There is no dedicated configuration for ESP-01 modules.
1 Open the Tools -> Development board menu and select Generic ESP8266 Module.
2 Adapt the configuration to your board
The default configuration is fine most of the time.
115200 by default but recent modules very well support the maximum speed of 921600 bauds
Select 1MB or 512KB. It is possible to reserve part of the flash memory for the SPIFFS or LittleFS file system.
A series of articles to learn how to use the SPIFFS or LittleFS (its successor) file system.
3 Connect the programmer
Here the case of a modified programmer. To activate Flash Mode, keep the button pressed while plugging the programmer into the computer’s USB port.
5 Upload the project
6 Disable Flash Mode
After uploading an Arduino program, the ESP01 module will restart. Depending on the modification of the program, the module will remain in Flash Mode (or not). To return to standard operation, here is what to do depending on the solution chosen.
|Resistor||Jumper||Push Button||Integrated selector|
|Remove the ESP01 from the holder
Replace the ESP01
|Remove the programmer from the USB port
Remove the jumper
Reconnect the programmer
|There is nothing to do !||Remove the programmer from the USB port
Return the selector to the UART position
Reconnect the programmer
7 If necessary open the serial monitor to debug the program!
How do I upload a program from PlatformIO?
There is nothing special to do on PlatformIO.
1 Create a new project.
In the board field, do a search with the keyword esp-01. Choose the 512KB or 1MB version from the list.
Here are two configuration examples that you can use directly.
|512KB version||1 MB version|
2 Modify the main parameters
CPU Frequency By default the CPU frequency is 80MHz. The board_build.f_cpu option allows to modify the CPU frequency to 160MHz.
board_build.f_cpu = 80000000L
board_build.f_cpu = 160000000L
Assign the serial port speed used in your program
monitor_speed = 115200
Start the compilation and upload of the program from the PIO menu
If the board is in Flash Mode, the program is directly uploaded
> Executing task: platformio run --target upload --target monitor --environment esp01_1m < Processing esp01_1m (platform: espressif8266; board: esp01_1m; framework: arduino) -------------------------------------------------------------------------------------------------------------------------------- Verbose mode can be enabled via `-v, --verbose` option CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp01_1m.html PLATFORM: Espressif 8266 (2.6.2) > Espressif Generic ESP8266 ESP-01 1M HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash PACKAGES: - framework-arduinoespressif8266 3.20704.0 (2.7.4) - tool-esptool 1.413.0 (4.13) - tool-esptoolpy 1.20800.0 (2.8.0) - tool-mklittlefs 1.203.200522 (2.3) - tool-mkspiffs 1.200.0 (2.0) - toolchain-xtensa 2.40802.200502 (4.8.2) LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf LDF Modes: Finder ~ chain, Compatibility ~ soft Found 41 compatible libraries Scanning dependencies... Dependency Graph |-- <ESP8266WiFi> 1.0 Building in release mode Retrieving maximum program size .pio/build/esp01_1m/firmware.elf Checking size .pio/build/esp01_1m/firmware.elf Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" RAM: [=== ] 33.4% (used 27392 bytes from 81920 bytes) Flash: [==== ] 36.0% (used 274504 bytes from 761840 bytes) Configuring upload protocol... AVAILABLE: espota, esptool CURRENT: upload_protocol = esptool Looking for upload port... Auto-detected: /dev/cu.usbserial-1410 Uploading .pio/build/esp01_1m/firmware.bin esptool.py v2.8 Serial port /dev/cu.usbserial-1410 Connecting.... Chip is ESP8266EX Features: WiFi Crystal is 26MHz MAC: 58:ge:34:e0:0h:0e Uploading stub... Running stub... Stub running... Configuring flash size... Auto-detected Flash size: 1MB Compressed 278656 bytes to 204802... Writing at 0x00000000... (7 %) Writing at 0x00004000... (15 %) Writing at 0x00008000... (23 %) Writing at 0x0000c000... (30 %) Writing at 0x00010000... (38 %) Writing at 0x00014000... (46 %) Writing at 0x00018000... (53 %) Writing at 0x0001c000... (61 %) Writing at 0x00020000... (69 %) Writing at 0x00024000... (76 %) Writing at 0x00028000... (84 %) Writing at 0x0002c000... (92 %) Writing at 0x00030000... (100 %) Wrote 278656 bytes (204802 compressed) at 0x00000000 in 19.9 seconds (effective 112.1 kbit/s)... Hash of data verified. Leaving... Soft resetting... ========================= [SUCCESS] Took 23.60 seconds ====================== --- Available filters and text transformations: colorize, debug, default, direct, esp8266_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time --- More details at http://bit.ly/pio-monitor-filters --- Miniterm on /dev/cu.usbserial-1410 115200,8,N,1 --- --- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --- Connecting to MON_RESEAU_WIFI ..... WiFi connected Server started Use this URL to connect: https://192.168.1.47/
Problems uploading a program to an ESP01 from PlatformIO
If you are having trouble uploading the project, you can try to decrease the upload speed by adding the platformio.ini file. Recent modules support the default maximum bit rate very well.option in the
upload_speed = 115200
For older models, it may be necessary to force the protocol and flash mode.
upload_protocol = esptool board_build.flash_mode = dout
To master the important options of the platformio.ini file, you can continue by reading this article.
- 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