Using MicroPython with a NodeMCU
Download MicroPython firmware
Install esptool for flashing the NodeMCU
Flash the MicroPython firmware to the NodeMCU
Start the NodeMCU in ROM Flash Mode
- Connect the power to the NodeMCU while holding down the Flash button.
- The flash button will startup the NodeMCU in ROM flash mode.
Connect the NodeMCU using a USB Hub or external power supply
- The NodeMCU will draw 5.5v of power.
- If you are programming the NodeMCU using a Raspberry Pi, you will find that the power draw will be too large and your Raspberry Pi will shutdown.
- I find it easiest to connect to the NodeMCU through a powered USB hub.
Erase the NodeMCU
Write the rom to the NodeMCU
- After flashing the NodeMCU with MicroPython, recycle the power on it twice.
Connect to the MicroPython NodeMCU
Connect to the MicroPython NodeMCU using minicom
Verify the MicroPython firmware
The Internal Filesystem
When the NodeMCU boots the MicroPython framework for the first time, a FAT filesystem will be setup in the firmware.
The filesystem can be accessed over (Web)REPL using the appropriate client.
List files via REPL
There are two startup scripts: boot.py and main.py
- boot.py is executed first
- main.py is executed second