There are 3 ways I can explain how you can flash an esp via usb. There are more, yet I’ll stick to this 3. Those 3 are:
- via browser (Microsoft Edge and Chrome only)
For esptool and esphome-flasher you only need the firmware. When using the browser, you’ll need ESPHome and your own version of the config (can be copied from here). It’s recommended to run your own ESPHome so you can update without loosing the wifi connection and adjust all settings to your own preferences.
Install USB driver
First install the USB driver, which is needed. You can skip this step when you already have this driver. Linux will most of the time work without the need of installing extra drivers.
As I’m using a Wemos D1, I’ll stick to those drivers. 80~90% is using CH340 chip and the other remaining uses the ftdi chip.
Installing esptool on MacOS
Probably more ways to install it, yet on my Mac I’m using this method:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install esptool
Installing esptool on Windows
Download and install Python: https://www.python.org/downloads/. During install make sure checkbox is checked for “Add Python 3.8 to PATH”. After installation open command prompt and install esptool via:
pip install esptool
After installation you can test the version via:
See also this website: https://cyberblogspot.com/how-to-install-esptool-on-windows-10/
Installing esptool on Linux
Currently I’m using only Debian-based linux, like Ubuntu. As this is also most used on Raspberry Pi’s (Raspbian), I’ll use that to explain. Most Linux users using other distro will probably know more than enough to install esptool themselves (assumption 🙂 ).
sudo apt update sudo apt install esptool
Flashing ESPHome via esptool
For flashing an esphome firmware via esptool, use this command:
esptool.py --before default_reset --after hard_reset --baud 115200 --chip esp8266 --port <usb serial port> write_flash 0x0 <firmware>
Flashing esp-link via esptool
For flashing esp-link on the SlimmeLezer, download it from my website and extract it. Use this command to flash it:
esptool.py -p <usb serial port> --baud 230400 write_flash --flash_mode dio -fs 4MB -ff 40m 0x00000 boot_v1.7.bin 0x3FE000 blank.bin 0x3FC000 esp_init_data_default.bin 0x01000 user1.bin
Download esphome-flasher from GitHub (available for MacOS, Windows and Linux). Open the esphome-flasher, select the firmware and serial port and press ‘Flash ESP’.
There’s a known issue on Windows 10, probably not for everyone, but at least one customer. When getting the error message ‘Unexpected error: could not open port ‘COM4’: PermissionError(13, ‘Access is denied.’, None, 5)‘ than try v1.0 instead of v1.3
You can not use esphome-flasher to flash esp-link on the SlimmeLezer, unfortunately.
Via browser (Chrome or Edge and ESPHome)
First of al, I recommend everyone to run ESPHome and have a own SlimmeLezer configuration on it. Make sure you’re filling your own wireless credentials. That way, when updating your device, it will always reconnect to your wireless network after updating. Secondly, you can modify your own device the way you want/need it.
When ESPHome is installed and running, your config is added and valid, than click on install:
Choose for ‘Plug into this computer’ and select the right serial port:
Click on Connect or Verbinding maken and leave the browser open/focussed:
A short moment later: