HowTo: ESP8266 - flashing .bin files with the "Esptool" under Windows

The actual flashing of firmware files like .bin files (also called "binarys") to the Wemos D1 Mini, the NodeMcu dev board or any other board based on the ESP8266 is done completely in the background in the Arduino IDE.

This is actually the "esptool" offered by Espressif - the manufacturer of the ESP8266. With the right parameters you can easily transfer finished .bin files to the ESP8266.

An easier and a slightly more challenging way is described in this article.


Safety instructions

I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/

Affiliate links/advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂 


Requirements

Required tool:
-no-

Required material:
-no-


The esptool

You can always find the current version of the mentioned "esptool" in the GitHub of the manufacturer under:

https://github.com/espressif/esptool

"Problem" with this is that this tool is a Python script/application and thus cannot be run directly/simply on Windows.

Conveniently, however, Python scripts can also be "packaged" into a compact .exe file. This also makes handling under Windows easier.
How to do this is described in the article Python - Translate Esptool.py to Esptool.exe described.
Alternatively, you can also access (somewhat older) prepared releases at

https://github.com/igrr/esptool-ck/releases

fall back.

For the further course of this article you don't have to organize the esptool yourself but you can simply use the esptool.exe file in the following Git.


Transfer an existing .bin file with the esptool and the ESPEasy Flasher

If you only want to transfer a .bin file to the ESP8266 with the esptool, you normally have to call the esptool from the command line with the appropriate parameters.

This is often difficult especially for not so advanced users and apart from that simply impractical.

This has also been noticed by others and therefore they have worked on how to make the flash process of the ESP8266 as simple as possible.

One of these results can be found in the following Git repository at

https://github.com/BattloXX/ESPEasyFlasher

as always there is also a backup on the nerdiy git:

https://github.com/Nerdiyde/ESPEasyFlasher

In this Git repository there is a FlashESP8266.exe in addition to the mentioned esptool.exe. The latter works like a graphical user interface, which translates the mouse input into prameters and a command line call. What this means is explained in the next paragraph. The easy way starts right here 🙂

In the mentioned Git repository you can see the files that are contained in the Git repository.
To start downloading the files click on the "Clone or Download" button and...
... then click on "Download ZIP". More information about downloading files from a Git repository can also be found in the article GitHub - How do I copy files from a Git repository to my computer?
If you have downloaded the ZIP file, you have to unpack it first. You can find more information about this in the article WinRar? WinZip? WinWhat? - Honey I shrunk the files. In the unzipped folder you should then be able to see the folder contents shown.
Now you have prepared all necessary program files for flashing. What is still missing is the .bin file that you want to transfer to your ESP. You can get it - shown in the picture - for example from the folder "bin" of the ESPEasy-Git. There as well as in the Tasmota-Git ready compiled "binarys" (that's how the .bin-files are called) are prepared and offered. Since these binaries are always compiled for a specific controller type with corresponding memory size and configuration, it is important to select the correct file. For example for a Wemos D1-Mini you can choose the file "ESP_Easy_mega-20190803_custom_ESP8266_4M.bin". Don't be irritated by the fact that the number sequence between "ESP_Easy_mega-" and "_custom_ESP8266_4M.bin" changes in newer versions. This part corresponds to the date when the binary was created. Now copy the selected binary and paste it in the...
...the same directory where the .exe file of the ESPEasy Flasher is located. This is the directory in which you have previously unpacked the program files of the esptools and Co.
Now you can start the ESPEasy Flasher by executing the FlashESP8266.exe file.
The now opened program is very simple. There is the possibility to select the COM port to which you have connected your ESP. Furthermore ...
...you can select the binary file you want to transfer to your ESP from the drop-down menu below. Here all binaries are listed, which are in the same folder as the program FlashESP8266.exe. Therefore you will find here also the binary which you have copied before from the "bin" folder into the unpacked program folder.

Now you just have to click on the "Flash" button and the selected binary will be transferred to your ESP.

One more important note: The list of available COM ports is only updated by restarting the application. So if you have connected your ESP when the program was already started, you have to close it again and open it again.


Call Esptool via the command line

As mentioned before, you can also use the esptool directly to transfer an existing binary to your ESP.

To do this, use the command line to call the esptool with specified parameters as follows:

esptool.exe -vv -cd nodemcu -cb 921600 -cp COM32 -ca 0x00000 -cf C:ESPEasy.ino.bin
  • The number "921600" corresponds to the baud rate with which your ESP is programmed. This can vary from model to model. Typical baudrates are "9600", "115200" or "921600". If one baudrate does not work you can try another one.
  • The part "COM32" corresponds to the COM port under which your connected ESP is accessible.
  • "0x00000" corresponds to the memory range from which the binary should be written into the ESP memory. Usually you should not change this value.
  • Important is now the part "C:ESPEasy.ino.bin" Here must be the path to your binary. If you have copied your binary to your C: drive and named it "ESPEasy.ino.bin", this value can remain as it is.

Further information:

https://github.com/arendst/Sonoff-Tasmota/wiki/Esptool


Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂

PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂

Buy Me a Coffee at ko-fi.com       

10 comments

  1. Hello,
    everything great, but unfortunately the COM port is not recognized. Can you help me please.
    Achim

    1. Hello Hans-Joachim,
      can you give me some more info 🙂 Can you check for example if the driver for the USB-Serial converter is installed? Which board do you have?
      The CH340G is installed on many boards. Unfortunately, there is no pre-installed standard driver for this under Windows. If you have a device in the device manager that cannot be assigned a driver, try using the driver for the CH340G. 🙂

  2. Hello all,
    very good tutorial, just rebuild the slotclock,
    Find only, as described here, the "ESP_Easy_mega-20190803_custom_ESP8266_4M.bin" unfortunately nowhere.
    Downloaded the ESPEasy git, but can't find this .bin file.
    Can anyone help me here ?

    Thanks in advance

  3. However, the tool is now no longer in the package as .exe, but as .sln.
    Unfortunately, it is not that easy to start now.

  4. Hello Fab,

    cool site and even cooler projects! Am here for the first time... 🙂

    I've been working with ESPeasy for a while, so I know the standard plugins. Now I would like to implement your "HowTo: pxlBlck - pxlBlck_8x8".
    However, the firmware update OTA with "ESP8266_ESPEasy_incl_pxlBlck_4M.bin" came something like "Magic Bit is missing" and when I do it via USB with the with the official ESPeasy Flasher, it does not emit WLAN AP afterwards. Can you tell me where the error is?

    Greetings Franz

    open-boat-projects. org

    1. Hi Franz,
      thank you and welcome 🙂
      The firmware update via OTA probably won't work because the bin file with the pxlBlck plugin is too big for most "standard partitions". I must admit that I have not yet tried the installation via OTA or use and therefore can not say so much about it, sorry. :/ I would have to take a closer look.
      Does ESPEasy start correctly when you install it with the ESPEasy Flasher? So you see an output in the serial console?
      If yes, you could try to configure the wifi access data via the serial interface. I have described this (somewhat compactly) here: https://nerdiy.de/howto-espeasy-firmware-flashen/#WLAN-Zugangsdaten_ueber_die_serielle_Schnittstelle_konfigurieren
      If not, please let me know and I'll try to recreate it 🙂 .
      Best regards
      Fabian

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.