A Trip to the LUA or NOT

Ok, I was clutching at straws for the title…  Last night there was an update to the firmware for ESP8266 (in my case the ESP-01) that looked worth a try – and so here is a “first impression” blog. 

After downloading the firmware to my board, I powered up the Windows terminal (I’m just using the Arduino terminal for now) and on plugging in the board was greeted with this

V‚Š‡ ‡ŠŽþ‡þ
lua: cannot open init.lua
NodeMcu 0.9.2  powered by Lua 5.1.4

I really don’t know why it is necessary to have that crap at the start but I’m sure there will be a reason. Now, the initial stuff you see there about not opening a file is not an error.  The LUA interpreter can use a startup file (when I say “file” I mean text stored in the ESP-01 itself) and all of this can be done from your terminal.

In making this blog I have my little board and all I have in front of me is the documentation that comes with the source code. I have no knowledge of LUA at all (I’m pretty ok at Javascript, C etc etc but never heard of LUA before last weekend – so we’re talking “amateur night out” at this point).

So to address the lack of startup file – line by line I’m putting this into the serial port…


file.writeline([[print(“Pete’s Little Board”)]])


Un-plug the board, plug it back in and…

<—Ž þ‚Šƒ,‡.(Š‡ ‡‡ŠŽþ‡ú
Petes Little Board
NodeMcu 0.9.2  powered by Lua 5.1.4

Hey! What a start  – it really WAS that easy – the function is restored after loss of power.

So – next thing – connect to my WIFI


Looks GREAT – firstly I get IP address 0 – then my IP address – we’re IN. (I’ve changed my password to protect the innocent).

So all you have to do is put that into the init file, yes?

file.writeline([[print(“Petes Tester 3”)]])
file.writeline([[print(wifi.sta.getip()) ]])
file.writeline([[print(wifi.sta.getip()) ]])

And power down and…

Petes Tester 3
NodeMcu 0.9.2  powered by Lua 5.1.4

Ho hum… back to the drawing board….


6 thoughts on “A Trip to the LUA or NOT

  1. Hi Peter

    This is looking good.

    In terms of your last test, remember in the previous test you connected to ‘office’ and that worked. So I would suggest re-running your last test trying to connect to ‘office’.

    I would even question if the hyphen in ‘loft-east’ is a problem for the LUA interpreter.

    • If it is that’s a problem as it is in a string! I tried Office – that’s the one that won’t work. So in the AT commands I can look up my routers, both show, but in LUA the “office” one won’t work at all… “loft-east” works a treat if you do it line by line from the serial port – NO problem – the problem is it won’t work on start up and a colleague has the same issue in his home – we both came to the conclusion simultaneously that this has to be resolved (or we’re doing something wrong) as without power up connection, stand alone operation is, well, it won’t work!

  2. First of all, thank you for a really interesting blog. Maybe the “crap” being written out is at another baud rate? Maybe at 115200. I’ve sometimes seen it with these firmwares for the ESP8266. Don’t know why they have these mixed baud rates.

    • Yes I think there is conflict here, if this is a high level language for people – then those people are not going to want garbled control messages at any baud rate…. Ok, so here are our thoughts… If you put “HELLO” into the start up code – it appears BEFORE the signon info from the firmware itself – our guess is that if you wrote a loop in the startup code, the powerup message would never come on – and the radio would never start. That’s a GUESS. If that is true, then you could never run this firmware stand-alone… that needs sorting!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s