Linux: guide
MacOS: guide
Windows: guide
In this part, we will flash the light controller firmware WLED, to the ESP01 microcontroller. We will use ESPtools from Espressif in order to flash a binary.
There are three options to flash WLED to your ESP01S:
- Three options for flashing firmware:
- Easy way: Head over to https://install.wled.me/ on Chrome (or Chromium) and press install
- However this only works on devices with 4 MB memory or more, The ESP01S has 1 MB of memory so it is unfortunately not a choice. Therefore other options must be used.
- Medium way: Install ESPtools, see below
- Difficult way: Use esptools.py with VSCode and the platform.io extension ,
- This is required if you want to use usermods or compile source code:
- Easy way: Head over to https://install.wled.me/ on Chrome (or Chromium) and press install
For your computer to understand which kind of language to speak with the USB device, a driver called CH340 is needed. The CH340 driver has been included in the Linux kernel since v.2.6.24 from 2008-01-24.
On most systems it can be installed with:
pip install esptool
If Python is not installed, do:
sudo apt install python3 python3-pip
pip install esptool
Install with:
sudo pacman -S esptool
install with:
sudo apt install esptool
get a shell with it:
nix-shell -p esptool
Plug in the serial adapter and run the following command
sudo dmesg -we
Now plug in the programmer. The output should look similar to this
[Oct12 20:50] usb 1-4: new full-speed USB device number 17 using xhci_hcd
[ +0,141709] usb 1-4: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54
[ +0,000014] usb 1-4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ +0,000007] usb 1-4: Product: USB2.0-Ser!
[ +0,003645] ch34x 1-4:1.0: ch34x converter detected
[ +0,000737] usb 1-4: ch34x converter now attached to ttyUSB0
If your output is missing the last two lines, then fetch the PlatformIO udev rules and follow the instructions on the site.
- Download the latest WLED ESP01 binary called somehting like
WLED_x.x.x_ESP01.bin
- Plug an ESP01 into the programmer
- Insert the programmer into a USB-A port
- Type the following command and replace the filename with the one you have.
esptool.py write_flash 0x0 WLED_x.x.x_ESP01.bin
esptool can auto-detect the port, but it can be specified with the -p
flag. The ports are usually /dev/ttyUSB0
or /dev/ttyACM0
.
If esptool connects to the programmer starts flashing firmware, wait till 100% progress and its done.
For your computer to understand which kind of language to speak with the USB device, a driver called CH340 needs to be installed.
Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://github.com/Homebrew/install/raw/master/install)"
- Install the driver. (You will be prompted for the password you use to log in to the Mac.)
brew tap DecaturMakers/CH340_drivers-Linux-Mac-Windows https://github.com/DecaturMakers/CH340_drivers-Linux-Mac-Windows
brew cask install wch-ch34x-usb-serial-driver
- Install ESPtool
brew install esptool
Plug in the serial adapter and run the following command
sudo dmesg -we
Now plug in the programmer. The output should look similar to this
[Oct12 20:50] usb 1-4: new full-speed USB device number 17 using xhci_hcd
[ +0,141709] usb 1-4: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54
[ +0,000014] usb 1-4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ +0,000007] usb 1-4: Product: USB2.0-Ser!
[ +0,003645] ch34x 1-4:1.0: ch34x converter detected
[ +0,000737] usb 1-4: ch34x converter now attached to ttyUSB0
If your output is missing the last two lines, then fetch the PlatformIO udev rules and follow the instructions on the site.
- Download the latest WLED ESP01 binary called somehting like
WLED_x.x.x_ESP01.bin
- Plug an ESP01 into the programmer
- Insert the programmer into a USB-A port
- Type the following command and replace the filename with the one you have.
esptool.py write_flash 0x0 WLED_x.x.x_ESP01.bin
esptool can auto-detect the port, but it can be specified with the -p
flag. The ports are usually /dev/ttyUSB0
or /dev/ttyACM0
.
If esptool connects to the programmer starts flashing firmware, wait till 100% progress and its done.
For your computer to understand which kind of language to speak with the USB device, a driver called CH340 needs to be installed.
To install the CH340 driver
- head over to the WCH's english translated website
- Download the file called
CH341SER.EXE
- SHA256 checksum for v3.7:
391a615225980f5e93bb9a6196f82a6b03b67a001b9dd3a64353f4b0ba2884b8
- SHA256 checksum for v3.7:
- Execute file and follow instructions
- Download the programming tool from this repository called something like
esptool-vX.X-win64.zip
- Extract the zip file (install 7zip you do not have a program for it)
- Open a terminal in the directory containing
esptool.exe
by typingcmd
in the path field of the directory.
- Download the latest WLED ESP01 binary called
WLED_x.x.x_ESP01.bin
- Plug an ESP01 into the programmer
- Insert the programmer into a USB-A port
- Open
- Run the following command in the terminal and replace the path
WLED_x.x.x_ESP01.bin
to your WLED binaries location.
esptool.exe -p COMx write_flash 0x0 WLED_x.x.x_ESP01.bin
The com port can be found under the device manager, see the image
If esptool connects to the flasher and progresses, then you have successfully flashed firmware
esptool.py v4.3
Found 1 serial ports
Serial port /dev/ttyUSB0
Connecting.................
/dev/ttyUSB0 failed to connect: Could not configure port: (5, 'Input/output error')
A fatal error occurred: Could not connect to an Espressif device on any of the 1 available serial ports.
Solution: Fetch the PlatformIO udev rules here and follow the instructions
If calling the esptool program after successful installation returns the error esptool not found
.
Solution: The path for python modules has not been set. Do:
echo export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile
Now head over to Part C.
- Installation instruction for Windows came from Sparkfun
- Installation instructions for Mac came from Decatur Makers