ESP WRoom 02 is a low-power 32-bit MCU Wi-Fi module, based on the ESP8266 chip. It uses a 2 MB SPI flash connected to HSPI, working as SDIO/SPI slave, with the SPI speed being up to 8 Mbps and it is fully certified by Wi-Fi Alliance, SRRC, FCC, CE ( RED ), TELEC, IC & KCC.
The only downside of this awesome wifi module is the lack of stock firmware capabilities. Unfortunately the delivered AT Commands firmware is somehow outdated and does not support MQTT which imo should be a default choice of this module if you want to develop IoT/Smart House applications.
Why MQTT is useful for IoT? Well, to make the long story short, MQTT is designed for controlling/exchanging data with low-powered devices. The implementation is really straight forward, and you avoid creating custom complex implementation which in the end will missing several features and stability if you do not spend a good amount of time. Unless you want to create something really special, MQTT is the way. (For more information just google it… 🙂 )
In this post we will try to upgrade the ESP module with the latest firmware that supports MQTT AT Commands. Fortunately there are several information available on the internet, however collecting them in one place and provide a step by step procedure is better.
- Window 10 PC (+ linux subsystem)
- ESP WROOM 02 Module
- ESP test stand/burner (aliexpress)
Step 1: Install the correct toolchain
Open the linux subsystem of windows and install the following packages
sudo apt-get install gcc git wget make libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-cryptography python-future python-pyparsing
pip install pyyaml xlrd
Afterwards, download, install and update your
PATH environment variable for the ESP32 toolchain:
wget https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz mkdir -p ~/esp cd ~/esp tar -xzf ~/Downloads/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz export PATH="$HOME/esp/xtensa-esp32-elf/bin:$PATH"
Step 2: Download and configure the AT Commands Firmware
git clone https://github.com/espressif/esp-at
rm sdkconfig rm -rf esp-idf
Now we have to create a configuration file according to our module. For that, run the following command and check the screenshots below
Step 3: Compile and flash
Finally, just use the following two commands and your ESP wifi module will support the MQTT commands 🙂
make make flash