This guide shows how to generate a .bin (binary) file from your sketch on Arduino IDE.
Generate a .bin file in Arduino IDE
As an example, we’ll generate a .bin file from the Blink example. Follow the next steps to generate a .bin file from your sketch in Arduino IDE.
1) First, go to Tools > Board and select the right board (for example, ESP32 DEVKIT DOIT Board).
2) Save your sketch.
3) To generate a .bin file from your sketch, go to Sketch > Export compiled Binary
4) A new file on the folder sketch should be created. Go to Sketch > Show Sketch Folder.
5) You should have two files in your Sketch folder: the .ino and the .bin file.
Related content: ESP32 Over-the-air (OTA) Programming – Web Updater Arduino IDE
We hope you’ve found this guide useful.
Thanks for reading!
Thank you Sarah, for the instructions on making a .bin file.
Now please tell me/us why we would do that?
What advantage is there to having a .bin file?
Possible it might load faster but so what, a few seconds more to load doesn’t seem like I want to do this.
Thank you, I really appreciate your tutorials!
Ralph
Hi Ralph.
We created this tutorial after the “ESP32 Over-the-air (OTA) Programming – Web Updater Arduino IDE“.
That tutorials requires you to upload a .bin file. At the time of building that tutorial we’ve also built this one to make it easier to know how to get .bin files.
I’m sure they have other applications that I’m not aware of.
Thank you for supporting our work.
Regards,
Sara 🙂
Another application is when one has few arduini to get the same program (ex : detect tft shield; detect I2C devices; according to the presnce of I2C devices, display the sensor -might be temperature in different rooms- ; if serial is avalaible, send it to the PC…) Having the same program is not that absurd on an Arduino Mega…. if it can handle gracefully the lack of sensors+screens, and cope with the existing ones…This makes software somewhat bigger, and compiling/linking can be felt too slow to be comfortable (remains “only” uploading : theoretically, detecting avrdudes option can make this last step almost automatic)
Hi Dennis!
Thank you so much for sharing your expertise about this topic!
Regards,
Sara 🙂
bin file upload in esp32 via ota but not blink led in esp32 via bluetooth
Hi Sara! What is the purpose of this? Thank you
Hello Daniel, you can read what you can do with it in the comment’s above. Here’s a summary: We created this tutorial after the “ESP32 Over-the-air (OTA) Programming – Web Updater Arduino IDE“: https://randomnerdtutorials.com/esp32-over-the-air-ota-programming/
That tutorials requires you to upload a .bin file. At the time of building that tutorial we’ve also built this one to make it easier to know how to get .bin files.
I had to program a remote-control module which had no bootloader (STM32).
The bin-file was copied to a sd-card and plugged into the remotecontrol and programmed
to the STM32 internally.
I was very happy to find this how2 here – Thanks a lot !
Well, there is something people sometimes miss :
can one generate an easy to read assembly file (to detect where pieces of code can be optimized, or, more likely, to get an idea of time spent servicing an IT or a time constrained part): this is rather easy with gcc (–save-temps ), of course with g++, whatever the cpu. But I feel the arduino IDE does hide this option, which may be useful when there are some time constraints (at least, to detect something cannot be done)
I am using the ESP8266 implementation of the Homie Convention and this bin can be used by the built-in OTA for easy firmware upgrades over WiFi.
Thank you Sara for sharing this!
Thanks.
Regards,
Sara 😀
When creating a bin file, it is automatically named as follows: FileName.ino.esp32.bin. Is it possible to change the automatic naming to exclude or change esp32 to something other than esp32? Thank you, Florian
No, it generates a .hex file and a bootloader.bin file, but not a .bin file without bootloader
Is it possible to use this .bin file to update an ESP32 without using OTA? The sketch is too large to fit on an OTA partition.
The idea is to provide the end user (with no knowledge of arduino) a .bin file and a Windows program or script that would do the update via USB.
Is this possible and are there any examples of this kind of thing?
Thanks for all these great tutorials!
hi Sara,
thank you for great tutorials!
now I have Async OTA in my ESP, it support upload .bin file for system datafile ex: html, javascript …etc. Are there any other way to make .bin for the file data system that can use OTA upload tool instead of use the upload tool in IDE : file https://randomnerdtutorials.com/esp32-web-server-spiffs-spi-flash-file-system/
thank you in advance!
Hello Sara and Rui
Maybe this is off topic, just as a suggestion, can you make a tutorial for the Arduino Nano BLE 33 Sense that can run machine learning?
Rui/Sara, The Arduino IDE 2.3.3 is not storing the file in the sketch folder. It acts like it’s compiling it, but that’s it. I see no bin file in the folder, only the ino. I made mention of this in the sketch to do ESP32 OTA updates as well. Is there another way to get the bin file?
Hi.
You mentioned you got a build folder. It should be there.
Regards,
Sara
Sort of. Under build, I found a subfolder named esp32.esp32.nodemcu-32s. In that subfolder I found 4 different bin files. I chose (sketch name).ino.bin that worked (I think). The other files are
(sketchname).ino.bootloader.bin
(sketchname).ino.merged.bin &
(sketchname).ino.partitions.bin
Along with an .elf file and a .map file.
Thank you for all your patience, I trying to get an efficient OTA going for remote temperature sensors quickly before winter freezes. Trying to merge that into old sketches along with IDEs updating, libraries going deprecated makes it confusing to an old guy who started out with vacuum tubes. Thanks again