HowTo: ESP8266 – Flashing .bin files under Windows using “Esptool”

The actual flashing of firmware files such as .bin files or “binarys” on the Wemos D1 Mini, the NodeMcu dev board or any other board that is based on the ESP8266 takes place completely in the background of the Arduino IDE.

Behind it 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 without having to rely on the Arduino IDE.

A simple and a slightly more challenging how to do that is described in this article.

Hints for our lovely english readers: Basically, many of the articles on Nerdiy.de are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section. 
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂


Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/en/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 shop via this link, Nerdiy.de receives a commission from the online shop or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support Nerdiy.de in being able to offer further useful projects in the future. 🙂


Requirements

Tools required:
-no-

Required material:
-no-


The esptool

You can always find the current version of the addressed “esptool” in the manufacturer’s git at:

https://github.com/espressif/esptool

“Problem” is that this tool is a Python script / application and therefore cannot be run directly / easily under Windows.

Conveniently, Python scripts can also be “packed” into a compact .exe file. This also makes handling under Windows easier.
How to do this is described in the article Python – Pack Esptool.py into Esptool.exe.
Alternatively, you can also use the (somewhat older) prepared releases at

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

For the rest of this article you don’t have to organize the esptool yourself but you can also 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 “armed” with the esptool to transfer a .bin file to the ESP8266, this usually means that you have to call the esptool from the command line and with the appropriate parameters.

This is often difficult for less advanced users and, apart from that, it is simply impractical.

Others have already noticed this and therefore worked on how to make the flash process of the ESP8266 as simple as possible.

You can find one of these results in the following git at

https://github.com/BattloXX/ESPEasyFlasher

as always there is a backup on the Nerdiy-Git:

https://github.com/Nerdiyde/ESPEasyFlasher

In addition to the esptool.exe mentioned in this git, there is also a FlashESP8266.exe. The latter functions like a graphical user interface, which translates the inputs made with the mouse into parameters and a command line call. Exactly what that means is explained in the next paragraph. The easy way starts right here. 🙂

In the mentioned Git you can see the files that are contained in the Git.
To start the download of the files click on the “Clone or Download” button and …
… then on “Download ZIP”. You can find more information on downloading files from a git in the article GitHub – How to copy files from a github to my computer.
If you have downloaded the ZIP file, you have to unzip it first. You can find information about this in the article WinRar? WinZip? WinWhat? – Darling I shrunk the files. In the extracted folder you should then be able to see the folder contents shown.
Now you have prepared all the necessary program files for flashing. What is still missing is the .bin file that you want to transfer to your ESP. You get this – shown in the picture – for example from the “bin” folder of the ESPEasy-Git. Completely compiled “binarys” (that is what the .bin files are called) are prepared and offered both there and in Tasmota-Git. Since these binarys have always been compiled specifically for a controller type with the appropriate memory size and configuration, it is important to select the correct file here. For example, for a Wemos D1-Mini you can select the file “ESP_Easy_mega-20190803_custom_ESP8266_4M.bin”. Don’t be confused by the fact that the number sequence between “ESP_Easy_mega-” and “_custom_ESP8266_4M.bin” changes with newer versions. This part corresponds to the date on which the binary was created. Now copy the selected binary and paste it in …
… same directory in which the .exe file of the ESPEasy Flasher is located. So this is the directory in which you have previously extracted the program files of the esptools and Co.
Now you can start the ESPEasy Flasher by executing the FlashESP8266.exe file.
The program that is now open is very simple. There is the possibility to select the COM port to which you have connected your ESP. Moreover …
… in the selection menu below you can select the binary file that you want to transfer to your ESP. All binarys that are in the same folder as the FlashESP8266.exe program are listed here. That is why you will also find the binary that you copied from the “bin” folder into the extracted program folder.

Now all you have to do is click on the “Flash” button and the selected binary will be transferred to your ESP.

Another important note: The list of available COM ports is only updated when the application is restarted. If you have connected your ESP when the program was already started, you have to close it and open it again.


Call Esptool from the command line

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

To do this, you must use the command line to call the esptool with the 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 baud rates are “9600”, “115200” or “921600”. If one baud rate doesn’t work, you can simply try another one.
  • The “COM32” part corresponds to the COM port under which your connected ESP can be reached.
  • “0x00000” corresponds to the memory area from which the binary should be written to the ESP memory. Usually you shouldn’t change this value.
  • The part “C: ESPEasy.ino.bin” is important now. The path to your binary must be specified here. If you have copied your binary to your C: drive and called it “ESPEasy.ino.bin”, this value can remain the same.

Additional information

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


I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂

Fab

P.S. 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 appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at ko-fi.com

6 comments

  1. Hallo,
    alles super, aber leider wird der COM-Port nicht erkannt. Kannst du mir bitte helfen.
    Achim

    1. Hallo Hans-Joachim,
      kannst du mir ein paar mehr INfos dazu geben? 🙂 Kannst du zum Beispiel mal prüfen ob der Treiber für den USB-Seriell converter installiert ist? Welches Board hast du denn?
      Auf vielen Boards ist der CH340G verbaut. Für diesen gibt es leider keinen vorinstallierten Standardtreiber unter Windows. Falls du bei dir im Geräte-Manager ein Gerät hast, dem kein Treiber zugeordnet werden kann, versuch es doch mal mit dem Treiber für den CH340G. 🙂

  2. Hallo zusammen,
    sehr gute Anleitung, baue gerade die Slotclock nach,
    Finde nur, wie hier beschrieben, die „ESP_Easy_mega-20190803_custom_ESP8266_4M.bin“ leider nirgends.
    Habe das ESPEasy-Git herunter geladen, finde jedoch nicht diese .bin-Datei.
    Kann mir hier jemand weiterhelfen ?

    Danke im voraus

  3. Hallo,

    wie ist da WLAN Kennwort für dieses image “ESP8266_4M_17.02.2021.bin”

    Vielen Dank

Leave a Reply

Your email address will not be published. Required fields are marked *