Skip to content
This repository has been archived by the owner on Nov 30, 2019. It is now read-only.
Develo edited this page Mar 21, 2016 · 6 revisions

NodeMCU Platform

So you got a nodemcu dev kit and want to play with lua. The module probably comes with the AT firmware pre-installed, so you have to start by flashing the nodemcu firmware. To get the firmware, you have to build it from the dev branch, since the master branch (and associated pre-built fw image) is currently outdated. You can do that in the nodemcu build service. Then, you probably want to learn what you can do with lua. Check out the examples subdir in the firmware repo to get started. But after that comes the serious development of your own application. And that's where NodeMCU platform comes in.

Step by Step guide

Build ESPlorer from sources

This is not really required, but the multifile upload capability that is missing from the latest pre-built jar makes life easier. Check out these instructions to get this done.

Build the nodemcu firmware

The nodemcu build service is pretty self-explanatory, except for having to choose which modules you want to include. If you're just getting started, you most likely will want something like this:

  • Select dev<>
  • Modules ADC, CJSON, crypto, file, GPIO, net, node, PWM, UART, WIFI, timer

If you intend to connect some peripheral to the module, like an SPI LCD or whatever, then you'll have to figure out the specific modules for your own needs.

Leave SSL and debug off for your first development steps, you can always come back and rebuild later once you know what you're doing.

You'll get an email with 2 links: an integer and a float. Unless you want to do some floating point math calcs on board (something which I don't recommend at all, considering the very limited hw capabilities), you should use the integer.

For further details, read the docs!

Flash the image

  1. Get the flasher tool You can either get it from sources here, or get it prebuilt from the blob. Alternatives (which I haven't tried):
  1. Open espflasher8266.exe (or one of the others), point to the .bin you should have downloaded from the email, make sure uart is set to 115200,8,N,1, SPI mode DIO. For the ESP-12/E/F, flash size is 4M. COM Port is whatever port the nodemcu was assigned when connected. In windows you can figure that out in the device manager. In linux you can look at the usb tty devices.

  2. Press and hold the flash button on the nodemcu module, and without letting go press the reset button. Click on the Flash button, and wait to see if the AP/STA MAC addresses show up. Let go of the flash button. In theory you shouldn't have to hold the flash button this long, but I've found that letting go after the reset and before clicking flash is a bit flaky. Wait till you get the green icon on the flasher status at the bottom.

  3. Reset nodemcu.

NodeMCU first light

Start up ESPlorer, select the COM port (same one used for flashing), make sure speed is set to 115200bps. Click RTS (turns green), click it again, and the nodemcu should restart. You should see some garbage (coming from the low level rom at 74880 bps), and then an intro message from the build service. At the end you should see an error message saying init.lua not found. Now do a file format. If you forget this, you'll end up with instability issues. either type file.format() in the ESPlorer console, or click on the file format button in the Commands tab.

The Platform

Get the platform on the module

Clone the platform repo (or download as zip or w/e). In ESPlorer, click on Upload, and select all files in the root of the repo (except maybe the readme). ESPlorer should start uploading the files one by one. Once done, click on upload again, and go to the http subdir of the repo. Select all files there and upload. Once done, click on RTS (turns green), click again to reboot the module. On startup you see some messages in ESPlorer about compiling all the luas, creating default configs, starting up the wifi, etc. At this point, the nodemcu module could work with its own power supply, disconnected from your computer.

Configure wifi to your liking

Connect to the ESP hotspot (SSID is ESP-somenumber, password is theballismine by default), point your browser to 192.168.111.1, follow wifi configuration. Setup the SSIDs, passwords, etc. If you want the ESP to connect to your router, look at the Station sections. Submit.

Upload some files remotely

the platform has a tftp client on board, which lets you upload/download files to the on-board file system. At this time I'm using this client for development, but you can use any that supports tftp.