This is not going to be a comprehensive project, but a list of things I discovered while getting a ESP8266-12E to run Lua, which may help you get going. If you are already using ESP8266 or NodeMCU you already know these things, nothing for you here. The project will stop at the point where I get blink.lua to work, anything further belongs elsewhere as far as I'm concerned. Also I will only discuss Linux but many of the tools I used are cross-platform.
How I got
sucked in involved
I'm always a sucker for bargains so when I saw that the development board shown in the photo for sale on AliExpress for $2, I thought cheap
headaches entertainment! The description mentioned running Lua. I have been an admirer of this lightweight embeddable language for many years but never wrote anything substantial in it. So I ordered one and it arrived in about 3 weeks, pretty good for economy delivery.
Connecting it up is easy
All you need is a USB A to MicroUSB cable. I found that some of my cables rescued from the e-waste bin, are actually charging only cables, not data cables. Once connected, you will see the USB to serial converter (FTDI type) device detected. This is not necessarily the CP2102; the Chinese manufacturer may have used another chip, so that area of the board may look slightly different. But it doesn't matter as long there is a driver for Linux. The device /dev/ttyUSB0 was created. You should check for any steps you have to take to make the device R/W to your account. In my case I am already in the dialout group, so I had permissions. Do not run your software as root, this is sloppy, hazardous, and unnecessary.
Get a terminal session
I had earlier installed the requisite packages for Arduino. This is one of many tutorials on the Internet for doing this. By the way a shout out to Random Nerd Tutorials who have a lot of documentation resources for the ESP8266. You can then develop in C++ Arduino style, using the Espressif toolchain. You can use the serial terminal to talk to the ESP8266.
However I wanted Lua so I looked for something else and found Esplorer, which is a Java based IDE for developing in Lua or MicroPython for the ESP8266. It also has an excellent serial interface. Support the author if you like the software.
Lua is not preloaded
The AliExpress listing makes it sound like Lua is already on the board. It is not. It's supported and you have to flash it yourself. This is obvious when you think about it. Why would the factory spend a bit more money and time adding this software? And it may be out of date by the time you get the board. So it's for the best that you flash the latest software yourself anyway.
At this point I should mention the definitive NodeMCU documentation site.
The boot sequence
There is actually a comprehensive list of steps that the MCU will take to boot. I'll just write about what you need to know.
When reset, the MCU serial interface is set to 74880 baud (yes!). You will see a boot banner, among other things showing boot mode(x,y). x will be 1 or 3, meaning boot from serial or boot from flash. How do you select? It's done by GPIO0 (D3). Leaving it open boots to flash, taking it to ground by holding down the Flash button boots to serial. I though I needed a jumper to do this, but that's what the Flash button is for, duh! So to flash firmware, hold down the Flash button, and click the Reset button, then you can release the Flash button.
The firmware will switch to 115200 baud. That's why text is shown as garbage after the firmware takes control. In practice you can leave your terminal emulator at this speed. Only if you need some boot info do you need 74880 baud.
If like my board, Lua isn't installed yet, it will print out something about BELTLINE-01. Must be built-in firmware in the chip.
Pin header spacing
At this point I should mention that the spacing between the two rows of header pins is 1 inch so it won't fit on a narrow breadboard, or rather there will be no...Read more »