ESP01. Get started with the Arduino or PlatformIO IDE. Which module to choose? Pinout

get started esp01 esp-01s ide arduino platformio pinout
Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on email
Share on whatsapp

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 RX et TX 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.

ESP-01ESP-01S
esp01 esp-01 esp8266ex blue 512MBesp01 esp-01 esp8266ex 512Mb black noiresp01s esp-01s esp8266ex black 1Mb
Flash Memory512 Mo1 Mo
ColorBlueBlackBlack
Possible mentionAI Cloud InsideS Series
NoteThe 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.

ESP-01 Pinout

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

esp01 esp01s pinout esp8266ex

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.

This is Flash Mode or Boot Load

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.

ESP-01 ESP8266 cablage wiring flashing mode_

Setup for uploading a program from the Arduino IDE or PlatformIO to an ESP-01 using a USB to TTL adapter.

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.

See more offers

It is enough to solder a push button and hold the button while inserting the programmer in the USB port of the computer.

Souder un bouton pour activer le Flash Mode de l'ESP01 sur un programmateur

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.

esp01 esp01s ide arduino generic ESP8266 module selection

2 Adapt the configuration to your board

The default configuration is fine most of the time.

Upload speed 115200 by default but recent modules very well support the maximum speed of 921600 bauds

Flash Mode DOUT

Flash Size 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.

esp01 programmer push button activate falsh mode

4 Select the COM port on which the programmer is connectedesp01 ide arduino esp8266 port com

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.

ResistorJumperPush ButtonIntegrated selector
Remove the ESP01 from the holder

Remove resistance

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!

esp01 esp01s ide arduino upload programmer serial monitor

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.

platformio esp01 esp-01s board 512k 1M

Here are two configuration examples that you can use directly.

512KB version1 MB version
[env:esp01] 
platform = espressif8266 
board = esp01
framework = arduino
[env:esp01_1m]
platform = espressif8266
board = esp01_1m
framework = arduino

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.

80MHz160MHz
board_build.f_cpu = 80000000L
board_build.f_cpu = 160000000L

Note, for battery operation, it is preferable to keep a low frequency.

Serial port speed Assign the serial port speed used in your program

monitor_speed = 115200

3 Upload

Start the compilation and upload of the program from the PIO menu

esp01 esp-01s upload arduino code platformio

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 upload_speed option in the platformio.ini file. Recent modules support the default maximum bit rate very well.

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.

Click to rate this post!
[Total: 0 Average: 0]

Are you having a problem with this topic?

Maybe someone has already found the solution, visit the forum before asking your question
Ask your question

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on email
Share on whatsapp

Did you like this project ? Don't miss any more projects by subscribing to our weekly newsletter!

We will be happy to hear your thoughts

      Leave a Reply

      DIY Projects