Build custom NodeMCU firmware and flash it on ESP8266
Posted on by Wim Mostmans
![ESP8266 on white paper](https://www.sitebase.be/images/posts/2016/esp8266-01-firmware.jpg)
In this quick reference I’ll show you how to build the NodeMCU firmware from source and flash it on your ESP8266. In this case I used the ESP8266-01.
You can use these exact same steps to flash any version of ESP8266 but the way you will connect it to your FTDI will differ. A simple Google images search will help you to find the connection schema for your ESP8266 version.
- Clone the NodeMCU project
git clone https://github.com/nodemcu/nodemcu-firmware.git
. Or download it manually from GitHub if you’re not a command line lover. - Open the
nodemcu-firmware
folder - To enable and/or disable modules and settings in the firmware you can open
/app/includes/user_config.h
and/app/includes/user_modules.h
and comment/uncomment what you need - Run following Docker command
sudo docker run --rm -ti -v `pwd`:/opt/nodemcu-firmware marcelstoer/nodemcu-build build
. I need to run this as super user otherwise I get an error about the docker daemon not running. - Wait for the command to finish and you’ll find your custom build firmware in the
bin
folder - Install esptool using
pip install esptool
which we will use to flash the ESP8266 - Connect your ESP8266 to your FTDI using the diagram above. Do make sure your FTDI is 3.3v. If you use a 5v one you’ll toast your ESP. Trust me I’ve done this before. You can use a 5v FTDI but you’ll have to use a separate 3.3v power supply to power your ESP8266.
- Flash your ESP8266 using following command
esptool.py --port <USB-kport-with-ESP8266> write_flash 0x00000 <NodeMCU-firmware-directory>/bin/nodemcu_[integer|float]_<Git-branch>.bin
- You can use a tool like ESPlorer to see if your flashed ESP8266 is working.
Tip Jar
If you like this blog, leave a tip! Your tip will help provide the basic necessities which sustain this blog: coffee, beer and raincoats for surviving the pitiful Belgium climate.
Buy me a coffee![Wim Mostmans](https://www.sitebase.be/images/avatar-wim.jpg)
About Wim Mostmans
Freelance full stack developer and Co-founder of the Employee Advocacy platform Ambassify, with a general interest for web technologies and electronics.