{"id":80239,"date":"2019-01-19T17:45:47","date_gmt":"2019-01-19T17:45:47","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=80239"},"modified":"2023-07-27T16:02:06","modified_gmt":"2023-07-27T16:02:06","slug":"flashing-micropython-firmware-esptool-py-esp32-esp8266","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/flashing-micropython-firmware-esptool-py-esp32-esp8266\/","title":{"rendered":"Flashing MicroPython Firmware with esptool.py on ESP32 and ESP8266"},"content":{"rendered":"\n<p>This post shows how to flash MicroPython firmware on ESP32\/ESP8266 boards using the esptool.py. It works on Windows, Mac OS X, and Linux. For the official documentation, you can visit the esptool.py&nbsp;<a href=\"https:\/\/github.com\/espressif\/esptool\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub page<\/a>.<\/p>\n\n\n\n<!--more-->\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/flash-micropython-esptool.png?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80322\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/flash-micropython-esptool.png?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/flash-micropython-esptool.png?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/flash-micropython-esptool.png?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/flash-micropython-esptool.png?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p><strong>Tip:<\/strong>&nbsp;for an easier method to flash the ESP32\/ESP8266 with MicroPython, we recommend reading this guide to <a href=\"https:\/\/randomnerdtutorials.com\/flash-upload-micropython-firmware-esp32-esp8266\/\">flash MicroPython with uPyCraft IDE<\/a>. However, we&#8217;ve recently received comments from our readers about having trouble installing\/using uPyCraft IDE. For that reason, we&#8217;re posting an alternative method using the esptool.py software.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing&nbsp;esptool.py in your computer<\/h2>\n\n\n\n<p>To work with esptool.py, you&#8217;ll need either Python 2.7, Python 3.4 or a newer Python installation on your system. <strong>We recommend using <a href=\"https:\/\/www.python.org\/downloads\/\" target=\"_blank\" rel=\"noopener noreferrer\">Python 3.7.X<\/a><\/strong>, so go to <a href=\"https:\/\/www.python.org\/downloads\/\" target=\"_blank\" rel=\"noopener noreferrer\">Python&#8217;s website<\/a> and install it on your computer.<\/p>\n\n\n\n<p>With Python 3 installed, open a Terminal window and install the latest stable esptool.py release with pip:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>pip install esptool<\/strong><\/pre>\n\n\n\n<p><strong>Note:<\/strong> with some Python installations that command may not work and you&#8217;ll receive an error. If that&#8217;s the case, try to install esptool.py with:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span class=\"rnthl rntliteral\">pip3 install esptool<\/span><\/li>\n\n\n\n<li><span class=\"rnthl rntliteral\">python -m pip install esptool<\/span><\/li>\n\n\n\n<li><span class=\"rnthl rntliteral\">pip2 install esptool<\/span><\/li>\n<\/ul>\n\n\n\n<p><span class=\"rnthl rntliteral\">Setuptools<\/span> is also a requirement that is not available on all systems by default. You can install it with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install setuptools<\/code><\/pre>\n\n\n\n<p>After installing, you will have esptool.py installed into the default Python executables directory and you should be able to run it with the command <em>esptool.py<\/em>. In your Terminal window, run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>python -m esptool<\/strong><\/pre>\n\n\n\n<p>If it was installed properly, it should display a similar message (regardless of your operating system):<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-py-running.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"1060\" height=\"908\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-py-running.png?resize=1060%2C908&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80285\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-py-running.png?w=1060&amp;quality=100&amp;strip=all&amp;ssl=1 1060w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-py-running.png?resize=300%2C257&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-py-running.png?resize=768%2C658&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-py-running.png?resize=1024%2C877&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1060px) 100vw, 1060px\" \/><\/a><\/figure><\/div>\n\n\n<p>With esptool.py installed on your computer, you can easily flash your ESP32 or ESP8266 boards with the MicroPython firmware. This post is divided into two parts, read Part 1 or Part 2 depending on your board:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Part 1 &#8211; ESP32<\/li>\n\n\n\n<li>Part 2 &#8211; ESP8266<\/li>\n<\/ul>\n\n\n\n<p><strong>Note:<\/strong> after installing MicroPython firmware on your ESP32 or ESP8266, you can go back and use Arduino IDE again. You just need to upload code using Arduino IDE. Then, if you want to use MicroPython again, you need to flash MicroPython firmware.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">[Part 1 &#8211; ESP32] Downloading and Flashing the MicroPython Firmware on ESP32<\/h2>\n\n\n\n<p>To download the latest version of MicroPython firmware for the ESP32, go to the <a href=\"http:\/\/micropython.org\/download#esp32\" target=\"_blank\" rel=\"noopener noreferrer\">MicroPython Downloads page<\/a>&nbsp;and scroll all the way down to the <a href=\"https:\/\/micropython.org\/download\/esp32\/\" target=\"_blank\" rel=\"noreferrer noopener\">ESP32 section<\/a>.<\/p>\n\n\n\n<p>You should see a similar web page (see figure below) with links to download <span class=\"rnthl rntliteral\">.bin<\/span> files. Download the latest release. At the time of writing this article, the latest release is <strong><em>v1.17 (2021-02-02).bin<\/em><\/strong>. Don\u2019t download the Nighlty builds; those versions are not stable and are only recommended for advanced programmers.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Micropython-firmware.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"461\" height=\"538\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Micropython-firmware.png?resize=461%2C538&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Download MicroPython Firmware\" class=\"wp-image-108999\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Micropython-firmware.png?w=461&amp;quality=100&amp;strip=all&amp;ssl=1 461w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Micropython-firmware.png?resize=257%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 257w\" sizes=\"(max-width: 461px) 100vw, 461px\" \/><\/a><\/figure><\/div>\n\n\n<p><strong>Note:<\/strong> if you&#8217;re using a different board (like a PyBoard, WiPy, or other), go to <a href=\"http:\/\/micropython.org\/downloads\" target=\"_blank\" rel=\"noopener noreferrer\">MicroPython Downloads<\/a> page and download the right firmware for your board.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Finding the Serial Port Name<\/h3>\n\n\n\n<p>It&#8217;s a bit different to find the Serial port name in each operating system, so for simplicity reasons we recommend finding your ESP serial port name through the Arduino IDE. Follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Connect your board to your computer<\/li>\n\n\n\n<li>Open the Arduino IDE<\/li>\n\n\n\n<li>Go to&nbsp;<strong>Tools<\/strong> &gt; <b>Port<\/b><\/li>\n\n\n\n<li>Save your ESP32 serial port name (in our case it&#8217;s COM7)<\/li>\n\n\n\n<li>Close your Arduino IDE software<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"489\" height=\"408\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/arduino-ide-com-port.png?resize=489%2C408&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80248\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/arduino-ide-com-port.png?w=489&amp;quality=100&amp;strip=all&amp;ssl=1 489w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/arduino-ide-com-port.png?resize=300%2C250&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 489px) 100vw, 489px\" \/><\/figure><\/div>\n\n\n<p><span style=\"color: #ff0000;\"><strong>Important:<\/strong><\/span> if you plug your ESP32 board into your computer, but you can\u2019t find the ESP32 Port available in your Arduino IDE, it might be one of these two problems: <strong>1.<\/strong>&nbsp;USB drivers missing or <strong>2.<\/strong>&nbsp;USB cable without data wires.<\/p>\n\n\n\n<p><strong>1.<\/strong> If you don\u2019t see your ESP\u2019s COM port available, this often means you don\u2019t have the USB drivers installed. Take a closer look at the chip next to the voltage regulator on board and check its name.<\/p>\n\n\n\n<p>The <a href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\" rel=\"noopener noreferrer\">ESP32 DEVKIT V1 DOIT<\/a> board uses the&nbsp;<strong>CP2102<\/strong> chip.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"379\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-chip-esp32.jpg?resize=750%2C379&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-67783\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-chip-esp32.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-chip-esp32.jpg?resize=300%2C152&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Go to Google and search for your specific chip to find the drivers and install them in your operating system.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"311\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-driver-download-750.jpg?resize=750%2C311&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-67784\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-driver-download-750.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-driver-download-750.jpg?resize=300%2C124&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>You can download the CP2102 drivers on the&nbsp;<a href=\"https:\/\/www.silabs.com\/products\/development-tools\/software\/usb-to-uart-bridge-vcp-drivers\" target=\"_blank\" rel=\"noopener noreferrer\">Silicon Labs<\/a>&nbsp;website.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"520\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-drivers-download-site.jpg?resize=800%2C520&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-67785\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-drivers-download-site.jpg?w=800&amp;quality=100&amp;strip=all&amp;ssl=1 800w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-drivers-download-site.jpg?resize=300%2C195&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-drivers-download-site.jpg?resize=768%2C499&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure><\/div>\n\n\n<p>After they are installed, restart the Arduino IDE and you should see the serial port in the <strong>Tools<\/strong>&nbsp;&gt; <strong>Port<\/strong> menu.<\/p>\n\n\n\n<p><strong>2.<\/strong> If you have the drivers installed, but you can&#8217;t see your device, double-check that you&#8217;re using a USB cable with data wires.<\/p>\n\n\n\n<p>USB cables from powerbanks often don&#8217;t have data wires (they are charge only). So, your computer will never establish a serial communication with your ESP32. Using a proper USB cable should solve your problem.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Finding your MicroPython .bin file<\/h3>\n\n\n\n<p>After downloading the&nbsp;ESP32 <em>.bin<\/em> file, it should be in your <strong>Downloads<\/strong> folder. So, with your Terminal window, you&#8217;ll need to navigate to the Downloads folder using the <em>cd<\/em> command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>cd Downloads<\/strong><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"537\" height=\"153\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/terminal-downloads.png?resize=537%2C153&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80251\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/terminal-downloads.png?w=537&amp;quality=100&amp;strip=all&amp;ssl=1 537w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/terminal-downloads.png?resize=300%2C85&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 537px) 100vw, 537px\" \/><\/figure><\/div>\n\n\n<p>List all files in your Downloads folder to ensure that&#8217;s where the <em>.bin<\/em> file is located. In Windows, you use:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>dir<\/strong><\/pre>\n\n\n\n<p>On Mac OS X or Linux, run the next command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls<\/strong><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"747\" height=\"209\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/find-bin-file-micropython-firmware.png?resize=747%2C209&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80260\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/find-bin-file-micropython-firmware.png?w=747&amp;quality=100&amp;strip=all&amp;ssl=1 747w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/find-bin-file-micropython-firmware.png?resize=300%2C84&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 747px) 100vw, 747px\" \/><\/figure><\/div>\n\n\n<p>As you can see in the preceding screenshot, the ESP32 <em>.bin<\/em> file is located in the Downloads folder:&nbsp;<em>esp32-20190113-v1.9.4-779-g5064df207.bin<\/em>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Erasing ESP32 Flash Memory<\/h3>\n\n\n\n<p>Before flashing the MicroPython firmware, you need to erase the ESP32 flash memory. So, with your ESP32 connected to your computer, hold-down the &#8220;<strong>BOOT\/FLASH<\/strong>&#8221; button in your ESP32 board:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"435\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/boot-button.jpg?resize=750%2C435&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-67778\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/boot-button.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/boot-button.jpg?resize=300%2C174&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p><strong>Note<\/strong>: if your board doesn&#8217;t have a BOOT\/FLASH button, it will probably go into flashing mode automatically.<\/p>\n\n\n\n<p>While holding down the &#8220;<strong>BOOT\/FLASH<\/strong>&#8221; button, run the following command to erase the ESP32 flash memory:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">python -m esptool --chip esp32 erase_flash<\/pre>\n\n\n\n<p>When the &#8220;<strong>Erasing<\/strong>&#8221; process begins, you can release the &#8220;<strong>BOOT\/FLASH<\/strong>&#8221; button. After a few seconds, the ESP32 flash memory will be erased.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"739\" height=\"367\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-py-running-erase-flash-esp32-success.png?resize=739%2C367&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80255\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-py-running-erase-flash-esp32-success.png?w=739&amp;quality=100&amp;strip=all&amp;ssl=1 739w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-py-running-erase-flash-esp32-success.png?resize=300%2C149&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 739px) 100vw, 739px\" \/><\/figure><\/div>\n\n\n<p><strong>Note: <\/strong>if after the &#8220;<strong>Connecting &#8230;<\/strong>&#8221; message you keep seeing new dots appearing, it means that your ESP32 is not in flashing mode. You need to repeat all the steps described earlier and hold the &#8220;<strong>BOOT\/FLASH<\/strong>&#8221; button again to ensure that your ESP32 goes into flashing mode and completes the erasing process successfully.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"739\" height=\"301\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-py-running-erase-flash-esp32.png?resize=739%2C301&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80256\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-py-running-erase-flash-esp32.png?w=739&amp;quality=100&amp;strip=all&amp;ssl=1 739w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-py-running-erase-flash-esp32.png?resize=300%2C122&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 739px) 100vw, 739px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Flashing MicroPython Firmware on ESP32 with esptool.py<\/h3>\n\n\n\n<p>With your ESP32 flash memory erased, you can finally flash the MicroPython firmware. You need your serial port name (COM7 in our case) and the ESP32 <em>.bin<\/em> file location. Replace the next command with your details:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>python -m esptool --chip esp32 --port <span style=\"color: #ff0000;\">&lt;serial_port&gt;<\/span> write_flash -z 0x1000 <span style=\"color: #ff0000;\">&lt;esp32-X.bin&gt;<\/span><\/strong><\/pre>\n\n\n\n<p>In our case, the command looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">python -m esptool --chip esp32 --port <strong>COM7<\/strong> write_flash -z 0x1000 <strong>esp32-20190113-v1.9.4-779-g5064df207.bin<\/strong><\/pre>\n\n\n\n<p>Hold down the &#8220;<strong>BOOT\/FLASH<\/strong>&#8220;, before running the flash command. After a few seconds this is what you should see:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esp32-flash-firmware.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1182\" height=\"374\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esp32-flash-firmware.png?resize=1182%2C374&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80266\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esp32-flash-firmware.png?w=1182&amp;quality=100&amp;strip=all&amp;ssl=1 1182w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esp32-flash-firmware.png?resize=300%2C95&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esp32-flash-firmware.png?resize=768%2C243&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esp32-flash-firmware.png?resize=1024%2C324&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1182px) 100vw, 1182px\" \/><\/a><\/figure><\/div>\n\n\n<p>Your ESP32 was successfully flashed with MicroPython firmware!<\/p>\n\n\n\n<p><strong>Note:<\/strong> if you receive an error trying to flash the firmware, run the command again and make sure you are holding down the ESP32 &#8220;<strong>BOOT\/FLASH<\/strong>&#8221; button.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1060\" height=\"250\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/error-esptool-py-fatal-error-occurreed-fail-to-connect-to-esp32.png?resize=1060%2C250&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80271\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/error-esptool-py-fatal-error-occurreed-fail-to-connect-to-esp32.png?w=1060&amp;quality=100&amp;strip=all&amp;ssl=1 1060w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/error-esptool-py-fatal-error-occurreed-fail-to-connect-to-esp32.png?resize=300%2C71&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/error-esptool-py-fatal-error-occurreed-fail-to-connect-to-esp32.png?resize=768%2C181&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/error-esptool-py-fatal-error-occurreed-fail-to-connect-to-esp32.png?resize=1024%2C242&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1060px) 100vw, 1060px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">[Part 2 &#8211; ESP8266] Downloading and Flashing the MicroPython Firmware on ESP8266<\/h2>\n\n\n\n<p>To download the latest version of MicroPython firmware for the ESP32, go to the <a href=\"http:\/\/micropython.org\/download#esp32\" target=\"_blank\" rel=\"noopener noreferrer\">MicroPython Downloads page<\/a>&nbsp;and scroll all the way down to the <a href=\"https:\/\/micropython.org\/download\/esp8266\/\">ESP8266 section<\/a>.<\/p>\n\n\n\n<p>You should see a similar web page (see figure below) with links to download <span class=\"rnthl rntliteral\">.bin<\/span> files. Download the latest release. At the time of writing this article, the latest release is <strong><em>v1.17 (2021-02-02).bin<\/em><\/strong>. Don\u2019t download the Nighlty builds; those versions are not stable and are only recommended for advanced programmers.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Micropython-firmware.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"461\" height=\"538\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Micropython-firmware.png?resize=461%2C538&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Download MicroPython Firmware\" class=\"wp-image-108999\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Micropython-firmware.png?w=461&amp;quality=100&amp;strip=all&amp;ssl=1 461w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Micropython-firmware.png?resize=257%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 257w\" sizes=\"(max-width: 461px) 100vw, 461px\" \/><\/a><\/figure><\/div>\n\n\n<p><strong>Note:<\/strong> if you&#8217;re using a different board (like a PyBoard, WiPy, or other), go to <a href=\"http:\/\/micropython.org\/downloads\" target=\"_blank\" rel=\"noopener noreferrer\">MicroPython Downloads<\/a> page and download the right firmware for your board.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Finding the Serial Port Name<\/h3>\n\n\n\n<p>It&#8217;s a bit different to find the Serial port name in each operating system, so for simplicity reasons we recommend finding your ESP serial port name through the Arduino IDE. Follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Connect your board to your computer<\/li>\n\n\n\n<li>Open the Arduino IDE<\/li>\n\n\n\n<li>Go to&nbsp;<strong>Tools<\/strong> &gt; <b>Port<\/b><\/li>\n\n\n\n<li>Save your ESP8266 serial port name (in our case it&#8217;s COM4)<\/li>\n\n\n\n<li>Close your Arduino IDE software<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"504\" height=\"606\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/arduino-ide-com-port-esp8266-1.png?resize=504%2C606&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80299\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/arduino-ide-com-port-esp8266-1.png?w=504&amp;quality=100&amp;strip=all&amp;ssl=1 504w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/arduino-ide-com-port-esp8266-1.png?resize=250%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 250w\" sizes=\"(max-width: 504px) 100vw, 504px\" \/><\/figure><\/div>\n\n\n<p><span style=\"color: #ff0000;\"><strong>Important:<\/strong><\/span> if you plug your ESP8266 board to your computer, but you can\u2019t find the ESP8266 Port available in your Arduino, it might be one of these two problems: <strong>1.<\/strong>&nbsp;USB drivers missing or <strong>2.<\/strong>&nbsp;USB cable without data wires.<\/p>\n\n\n\n<p><strong>1.<\/strong> If you don\u2019t see your ESP\u2019s COM port available, this often means you don\u2019t have the USB drivers installed. Take a closer look at the chip next to the voltage regulator on board and check its name.<\/p>\n\n\n\n<p>The <a href=\"https:\/\/makeradvisor.com\/tools\/esp8266-esp-12e-nodemcu-wi-fi-development-board\/\" target=\"_blank\" rel=\"noopener noreferrer\">ESP8266 ESP-12E NodeMCU<\/a>&nbsp;board uses the&nbsp;<strong>CP2102<\/strong> chip.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"388\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/10\/esp8266-cp2102-driver.jpg?resize=750%2C388&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-75010\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/10\/esp8266-cp2102-driver.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/10\/esp8266-cp2102-driver.jpg?resize=300%2C155&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Go to Google and search for your specific chip to find the drivers and install them in your operating system.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"311\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-driver-download-750.jpg?resize=750%2C311&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-67784\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-driver-download-750.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-driver-download-750.jpg?resize=300%2C124&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>You can download the CP2102 drivers on the&nbsp;<a href=\"https:\/\/www.silabs.com\/products\/development-tools\/software\/usb-to-uart-bridge-vcp-drivers\" target=\"_blank\" rel=\"noopener noreferrer\">Silicon Labs<\/a>&nbsp;website.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"520\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-drivers-download-site.jpg?resize=800%2C520&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-67785\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-drivers-download-site.jpg?w=800&amp;quality=100&amp;strip=all&amp;ssl=1 800w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-drivers-download-site.jpg?resize=300%2C195&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cp2102-drivers-download-site.jpg?resize=768%2C499&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure><\/div>\n\n\n<p>After they are installed, restart the Arduino IDE and you should see the serial port in the <strong>Tools&nbsp;<\/strong>&gt; <strong>Port<\/strong> menu.<\/p>\n\n\n\n<p><strong>2.<\/strong> If you have the drivers installed, but you can&#8217;t see your device, double-check that you&#8217;re using a USB cable with data wires.<\/p>\n\n\n\n<p>USB cables from powerbanks often don&#8217;t have data wires (they are charge only). So, your computer will never establish a serial communication with your ESP8266. Using a proper USB cable should solve your problem.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Finding your MicroPython .bin file<\/h3>\n\n\n\n<p>After downloading the&nbsp;ESP8266&nbsp;<em>.bin<\/em> file, it should be in your <strong>Downloads<\/strong> folder. So, with your Terminal window, you&#8217;ll need to navigate to the Downloads folder using the <em>cd<\/em> command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>cd Downloads<\/strong><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"537\" height=\"153\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/terminal-downloads.png?resize=537%2C153&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80251\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/terminal-downloads.png?w=537&amp;quality=100&amp;strip=all&amp;ssl=1 537w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/terminal-downloads.png?resize=300%2C85&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 537px) 100vw, 537px\" \/><\/figure><\/div>\n\n\n<p>List all files in your Downloads folder to ensure that&#8217;s where the <em>.bin<\/em> file is located. In Windows, you use:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>dir<\/strong><\/pre>\n\n\n\n<p>On Mac OS X or Linux, run the next command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls<\/strong><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"747\" height=\"209\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/find-bin-file-micropython-firmware.png?resize=747%2C209&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80260\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/find-bin-file-micropython-firmware.png?w=747&amp;quality=100&amp;strip=all&amp;ssl=1 747w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/find-bin-file-micropython-firmware.png?resize=300%2C84&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 747px) 100vw, 747px\" \/><\/figure><\/div>\n\n\n<p>As you can see in the preceding screenshot, the ESP8266&nbsp;<em>.bin<\/em> file is located in the Downloads folder: <em>esp8266-20180511-v1.9.4.bin<\/em>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Erasing ESP8266&nbsp;Flash Memory<\/h3>\n\n\n\n<p>Before flashing the MicroPython firmware, you need to erase the ESP8266&nbsp;flash memory. So, with your ESP8266&nbsp;connected to your computer, hold-down the &#8220;<strong>BOOT\/FLASH<\/strong>&#8221; button in your ESP8266&nbsp;board:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"547\" height=\"385\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/10\/esp8266-flash-button.jpg?resize=547%2C385&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-75011\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/10\/esp8266-flash-button.jpg?w=547&amp;quality=100&amp;strip=all&amp;ssl=1 547w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/10\/esp8266-flash-button.jpg?resize=300%2C211&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 547px) 100vw, 547px\" \/><\/figure><\/div>\n\n\n<p>While holding down the &#8220;<strong>BOOT\/FLASH<\/strong>&#8221; button, run the following command to erase the ESP8266 flash memory:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>python -m esptool --chip esp8266 erase_flash<\/strong><\/pre>\n\n\n\n<p>When the &#8220;<strong>Erasing<\/strong>&#8221; process begins, you can release the &#8220;<strong>BOOT\/FLASH<\/strong>&#8221; button. After a few seconds, the ESP8266&nbsp;flash memory will be erased.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"347\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esp8266-esptool-erase-flash-memory.png?resize=706%2C347&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80305\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esp8266-esptool-erase-flash-memory.png?w=706&amp;quality=100&amp;strip=all&amp;ssl=1 706w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esp8266-esptool-erase-flash-memory.png?resize=300%2C147&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 706px) 100vw, 706px\" \/><\/figure><\/div>\n\n\n<p><strong>Note: <\/strong>if after the &#8220;<strong>Connecting &#8230;<\/strong>&#8221; message you keep seeing new dots appearing, it means that your ESP8266 is not in flashing mode. You need to repeat all the steps described earlier and hold the &#8220;<strong>BOOT\/FLASH<\/strong>&#8221; button again to ensure that your ESP8266 goes into flashing mode and completes the erasing process successfully.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Flashing MicroPython Firmware on ESP8266&nbsp;with esptool.py<\/h3>\n\n\n\n<p>With your ESP8266&nbsp;flash memory erased, you can finally flash the MicroPython firmware. You need your serial port name (COM7 in our case) and the ESP8266&nbsp;<em>.bin<\/em> file location. Replace the next command with your details:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>python -m esptool --chip esp8266 --port <span style=\"color: #ff0000;\">&lt;serial_port&gt;<\/span> write_flash --flash_mode dio --flash_size detect 0x0 <span style=\"color: #ff0000;\">&lt;esp8266-X.bin&gt;<\/span><\/strong><\/pre>\n\n\n\n<p>In our case, the final command looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">python -m esptool --chip esp8266 --port <strong>COM4<\/strong> write_flash --flash_mode dio --flash_size detect 0x0 <strong>esp8266-20180511-v1.9.4.bin<\/strong><\/pre>\n\n\n\n<p>Hold down the &#8220;<strong>BOOT\/FLASH<\/strong>&#8220;, before running the flash command. After a few seconds this is what you should see:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-flash-esp8266-firmware.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"378\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-flash-esp8266-firmware.png?resize=1200%2C378&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-80306\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-flash-esp8266-firmware.png?w=1251&amp;quality=100&amp;strip=all&amp;ssl=1 1251w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-flash-esp8266-firmware.png?resize=300%2C94&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-flash-esp8266-firmware.png?resize=768%2C242&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/esptool-flash-esp8266-firmware.png?resize=1024%2C323&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><\/figure><\/div>\n\n\n<p>Your ESP8266 was successfully flashed with MicroPython firmware!<\/p>\n\n\n\n<p><strong>Note:<\/strong> if you receive an error trying to flash the firmware, run the command again and make sure you are holding down the ESP8266 &#8220;<strong>BOOT\/FLASH<\/strong>&#8221; button.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<p>If you encounter a permission error while trying to run the esptool command, open the command prompt as a administrator (or as sudo on Linux).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"487\" height=\"111\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/cmd_run_as_admin.png?resize=487%2C111&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"run commands as an administrator command prompt\" class=\"wp-image-133764\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/cmd_run_as_admin.png?w=487&amp;quality=100&amp;strip=all&amp;ssl=1 487w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/cmd_run_as_admin.png?resize=300%2C68&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 487px) 100vw, 487px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>We hope you\u2019ve found this tutorial useful. Your ESP32\/ESP8266 should now be flashed with MicroPython firmware. To learn more about MicroPython read:&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/getting-started-micropython-esp32-esp8266\/\">Getting Started with MicroPython on ESP32 and ESP8266<\/a>.<\/p>\n\n\n\n<p>If you liked this post, you might like our next ones, so make sure you <a href=\"https:\/\/randomnerdtutorials.com\/download\/\">subscribe to the RNT blog<\/a> and download our free electronics eBooks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post shows how to flash MicroPython firmware on ESP32\/ESP8266 boards using the esptool.py. It works on Windows, Mac OS X, and Linux. For the official documentation, you can visit &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Flashing MicroPython Firmware with esptool.py on ESP32 and ESP8266\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/flashing-micropython-firmware-esptool-py-esp32-esp8266\/#more-80239\" aria-label=\"Read more about Flashing MicroPython Firmware with esptool.py on ESP32 and ESP8266\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":80322,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[281,265,269,310,309,264],"tags":[],"class_list":["post-80239","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32-project","category-esp8266-project","category-guide-project","category-micropython","category-0-esp32-micropython","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/01\/flash-micropython-esptool.png?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/80239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=80239"}],"version-history":[{"count":5,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/80239\/revisions"}],"predecessor-version":[{"id":133770,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/80239\/revisions\/133770"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/80322"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=80239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=80239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=80239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}