This is a step by step installation guide on how to run micropython on NodeMCU and a sample Blink micropython code
- You would first need NodeMCU-PyFlasher to flash the NodeMCU with the required firmware. You can download NodeMCU-Pyflasher for your machine from here. You can directly get the executable file from here for 64-bit and here for 32-bit. For Mac you can get the dmg file from here for dmg. You can also get the source code from here - zip file and here - tar.gz file
- You would also need the MicroPython firmware for ESP8266 to flash the NodeMCU with it. You can either directly download it from here or can go to the MicroPython Download Section and get it yourself. I recommend you download a stable firmware.
- You will also be needing ESPlorer to write MicroPython code and run it on NodeMCU. You can get it from here or you can just download form here. If you want to take a look at their source code, you can do so from here.
- You should have the latest Java version on your system to run the ESPlorer. You can get Java from here
- First you need to Flash the NodeMCU with the MicroPython Firmware. For this Open the NodeMCU-PyFlasher and select the firmware from where you downloaded it. Make sure Erase flash setting is set to yes.
- Run the ESPlorer.bat file in the ESPlorer folder. That will execute a series of commands for you which will be used to run ESPlorer.
- After this click on Open in ESPlorer while NodeMCU is connected to your machine. Then while it is Open RESET the NodeMCU.
You can now write basic MicroPython code in the ESPlorer. Sample Blink Code:
import time
import machine
pin=machine.Pin(14,machine.Pin.OUT)
pin1=machine.Pin(2,machine.Pin.OUT)
pin2=machine.Pin(16,machine.Pin.OUT)
while(True):
pin1.on()
time.sleep(1)
pin1.off()
time.sleep(2)
Just click on Send to ESP
and the code will execute in your NodeMCU. You will be able to see the NodeMCU LED Blinking.