The following instructions will show vendors how to install the ESPHome firmware on the ESP32 microcontroller using MacBook, iMac, Mac Pro or Mac mini. They will be required for the first time during product testing when the test firmware is installed on the prototype.

You can install the firmware on the microcontroller using Python.

Flashing an ESP32 device

  1. Install the latest version of Python — you can download the stable release from the developer’s website.To flash the microcontroller, the pip3 package manager should be installed. Use the following command to download the pip3 installation file:
    curl -o

    After this, install the package manager:

    Installing the package manager

  2. Unzip the firmware file and navigate to the directory containing the archive’s firmware in the terminal.
    cd Downloads/<unzipped_archive>

    Firmware archive contents

  3. Install the necessary libraries to work with the “” script using the following command:
    pip3 install -r requirements.txt

    Installing libraries

  4. Connect your MicroUSB cable to your ESP32 Board. Then connect the other end of the USB data cable to your Mac. Enter command in the terminal:

    In example you should now see /dev/cu.usbserial-0001, you may choose your serial port. It is necessary for the flashing device in the next steps.

    Checking connected usb serial port

Let’s collaborate

We’re empower your business with our technology expertise

Let’s discuss your case
  1. Clean up the microcontroller memory by running the following command:
    ./ erase_flash

    Cleaning the microcontroller memory

    If the memory erasing stops at the “Connecting ….___….___” step, press the Boot button on the DevKit board:

    The Boot button on the DevKit board

  2. Run the “” script to flash the microcontroller, put your usb serial port after -d, for example /dev/cu.usbserial-0001:
    ./ write -d /dev/cu.usbserial-0001

    If the flashing stops at the “Connecting ….___….___” step, press the Boot button on the DevKit board.
    Flashing the microcontroller

  3. After a successful flash, you will see the “Leaving… Hard resetting via RTS pin…” notification.Flashing the microcontroller
    1. After flashing is completed, return to your 2Smart Cloud account and wait until the device is detected by the platform. If this does not happen within one to two minutes, unplug your device and plug it back into the Mac.
      The device’s “Ready” status indicates that the prototype has been successfully connected to the 2Smart Internet of Things software.Indicator of device status with the test firmware

When getting confirmation that your connection to the prototype platform with test firmware was successful, you can continue working on your product. A similar approach (steps 5 and 6) is used to install the production firmware on finished devices.

Rate this article:

4.7 / 5. 9

( 9 votes )

Don't forget to share this post!

Let’s dive into your case

Share with us your business idea and expectations about custom software development for the internet of things.

    Thanks for contacting us!

    We will get in touch soon.

    This site is protected by Google reCAPTCHA and the following Privacy policy and Terms of use apply

    Send us a message

    This site is protected by Google reCAPTCHA and the following Privacy policy and Terms of use apply