Run Espruino on the NodeMCU devkit

Tuesday, June 21, 2016

The NodeMCU devkit v1.0 is a board consisting of a ESP8266 (ESP-12E) WiFi SoC with UART and SPI interface. It exposes one analog and several digital GPIO pins. This makes it a cheap solution for IoT related projects. Get more info here: https://github.com/nodemcu/nodemcu-devkit-v1.0

It originally comes wit a pre-installed lua firmware. But the board can be flashed with another firmware (Sming, Frankenstein, MicroPython, Arduino, Mongoose IoT, …). This post shows you how to flash the board with the Espruino JavaScript firmware under Linux.

The NodeMCU devkit comes with a CP2102 onboard USB to UART bridge. You should first download and install the CP2102 driver to be able to communicate with the board.

Then get the latest binary build of the Espruino ESP8266 firmware (you’ll find it at the end of the thread).

To flash the firmware you can use esptool.py - a python utility to communicate with the ESP8266 bootloader:

esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --verify --flash_freq 80m --flash_mode dio --flash_size 32m 0x0000 "boot_v1.4(b1).bin" 0x1000 espruino_esp8266_user1.bin 0x37E000 blank.bin
  • --port /dev/ttyUSB0 defines the port (this may differ on your machine)
  • --baud 115200 defines a baud rate of 115200 bps
  • --flash_mode dio important: the flash mode has to be DIO
  • --flash_size 32m 32MBit flash size because we are dealing with a 4MB flash memory
  • at the end specify the unpacked binaries from the Espruino ESP8266 firmware (look at the firmware README for details)

This only works for the NodeMCU v1.0 devkit with ESP-12E core!

If everything was successful you can test it with the handy Espruino Web IDE Chrome App. Navigate to Settings - Communication - Baud Rate and select 115200 from the list. Then you should be able to connect to the NodeMCU devkit and execute some JavaScript code in the console.

Since you are not using an original Espruino board, please consider donating to this great project!