Quick Start for PlatformIO and esptool.py

Uploading to ESP8266 with PlatformIO

  1. Download and Install Atom, it should come along with pio (PlatformIO) preinstalled. If not, go to Preferences/Settings → Install and search for platformio, install the top three results.

  1. Restart the IDE if required. The toolbar to the left belongs to pio, at ‘Home’ find Platforms → Embedded, and search for esp8266, install it.

  1. Go to File → Add Project Folder… and open the project, for example, emonESP.

(Now make sure your ESP module will start in bootloader mode, there are different methods for different hardware, it involves somehow holding GPIO0 LOW.)

  1. At the pio toobar to the left.
    . Click the ‘tick’ to compile the project, (all dependencies are downloaded on first compile),
    . click the ‘arrow’ to upload to the main PROGMEM, (the program is uploaded),
    . and then the ‘terminal-tick’ icon and from the dropdown menu PIO Upload File System Image to upload the SPIFFS, (in the case of emonESP, the webpage data stored in the /src/data folder).

53 (this is what I call the ‘terminal-tick’ icon…)

(a bug exists where this command doesn’t show in the list, in which case open a terminal panel and enter ‘platformio run --target uploadfs’.)

  1. The Serial Port monitor is available as part of the pio toolbar on the left also, if no serial output is found, remove the bootloader mode jumper on your ESP module!

Next, I’ll show the simplest way I can find to make use of esptool.py, which uploads significantly faster than PIO’s standard, even with ‘fast’ settings, very useful if flashing multiple devices with the same image(s).
To use esptool.py a version of python must installed on your system, Windows users will have to make sure to do an install of Python.

Keeping within pio:

  1. Open a terminal using pio’s toolbar button here:

  2. Type ‘pip install esptool.py’ and enter to install esptool.py!

  3. Type ‘cd .pioenvs/emonesp/’ to navigate Terminal to the compilation directory (.pioenvs/ is a hidden folder within the project folder).

  4. Type ‘esptool.py -b 921600 write_flash 0x0 firmware.bin 0x300000 spiffs.bin’ to upload at baud of 921600 bits per second, the serial port is automatically detected.

Sometimes 921600bps is too fast. See GitHub - espressif/esptool: Espressif SoC serial bootloader utility for alternative baud rates and other options, as well as the remaining documentation for esptool!

An example script to run the above commands would be like this:
esptool.zip (668 Bytes)
Put in the project folder, along-side platformio.ini, and run with terminal command:
‘sh esptool’