Installing and using ESPlorer and Lua

ESPlorer is a tool that uploads your LUA scripts to an ESP module that has been flashed with LUA. At the moment you can only use ESP8266 based boards but ESP32 is in progress (or use a dev build for that). You can also use it for microPython, AT commands and RN2483.

TIP: You will need java installed on your PC to run this program.

This page shows you how to install the program and connect it to an ESP module. It then gives you a few example scripts - including a simple web page server - to show you what you can do with lua.

Note: The advantage of Lua is that it is immediately loaded - you don't compile for a minute and then wait for an upload for a minute. The disadvantage is that it is a new language to learn. However this page shows you some of its usage.

ESPlorer Tutorial

Esplorer Download

Download the zip file from here.

Download the zip file and unzip on your PC then double click on the ESPlorer.bat file. You may have to wait a short time while some libraries are downloaded and installed. Then you will see the main ESPlorer interface:

Main Esplorer interface

Esplorer interface

There are two panels - the left one is for script editing and upload - the right one is for serial communications with the ESP module.

The first thing you need to do is select the COM port in use by the EPS8266 (top right drop down box).  The baud rate will be:

  • 9600 Baud for older nodeMCU installs
       (typically what you get when a module has been bought online).
  • 115200 Baud for newer flash installs.

You can flash new nodeMCU files here.

Note: With a newer flash version of nodeMCU you can take advantage of new features such as a more Object Oriented methods e.g. timer usage.

After setting the baud rate just hit the 'Open' button to connect to the board. You should see the following:

Esplorer Startup Screen

Com port opend in ESPlorer

Now hit the reset hit the reset button on the board or click the RTS button (twice to hold it active, then inactive) as this is connected the reset pin (on nodeMCU boards). You should see:

Esplorer Startup with nodeMCU firmware

If you are using a newer flashed nodeMCU you will see something like this:

new nodeMCU flash output after reset

Note: Don't worry about the gibberish characters that preceed each reset - these are just status data at a different baud rate (74880 Baud).

How to Upload a Simple Lua Program using ESPlorer

The following instructions show you how to add a file to the ESp8266 by enetering text into ESPlorer and uploading it to the file system inside the ESP8266.

Enter the following text on two lines in the left panel of ESPlorer.

print("Hello")
print("World")

Click the save as button (or use File > Save as) and save as "init.lua"

In the lower part of the screen click "Save to ESP". Now click Run and you should see the following in the Serial terminal window.

> dofile('init.lua')
Hello
World
>

You can also see the same output when the reset button is pressed as the file init.lua is run at start up.

Improve ESPlorer upload reliability

I found that the communication was unreliable (probably too many tabs open in the browser etc.) so if you find the same click the Settings tab and uncheck the following check button - so that "Dumb Mode" is unchecked as below. This slows down communication but checks the data sent so that it is reliably transmitted.

Uncheck dumb mode for reliability

In another session I did not need to do it so experiment with this.

Some Esplorer and Lua commands

Listing the files loaded with Esplorer

If you click the commands tab and then hit the button labelled 'List files' you'll get a list of files similar to the following.

>  _dir=function() local k,
----------------------------
init.lua        : 30 bytes
----------------------------
Total file(s)   : 1
Total size      : 30 bytes

Total : 3441461 bytes
Used  : 7781 bytes
Remain: 3433680 bytes

Removing a file from the file system

Now remove the file using a lua command:

file.remove("init.lua")

Enter the command into the bottom right box, then click 'Send'.

Remove a file using the esplorer interface


Now you will see it has been removed (Use commands tab, 'list Files' button)
----------------------------
No files found.
----------------------------
>
Total : 3441461 bytes
Used  : 7279 bytes
Remain: 3434182 bytes

How to reset the NodeMCU

You can either reset the nodeMCU using the board reset button or hit the RTS button in the right hand pane twice. or in the command tab click Restart ESP.

I find the RTS button to be the most convenient.

The RTS wire  is an RS232 control (meaning Request To Send) and was originally used to signal to a device that the controller wanted to send some data. Here it is repurposed as a ESP reset signal.

Bottom Left ESPlorer controls

ESPlorer bottom left controls

The four bottom left ESPlorer controls let you:

1. Save to ESP

    Upload the currently opened file i.e. the visible one in the text window
    This also saves the file to the PC and to the ESP module and then runs it.

2. Send to ESP

3. Run

    Executes the currently opened file.

4. Upload

    Upload a bunch of files (useful for large projects). Select multiple files and they get uploaded one after another.

What's Next

NEXT: Now you have installed the ESPlorer software its time to make the nodeMCU do some useful stuff. On this page you will find out how to start using the Lua scripting language. It starts off with a simple LED blink, progressing to complex code e.g. how to serve a page from the ESP8266 to your local network.

CLICK HERE for Lua Examples>>>

<<< Back to NodeMCU Firmware


Comments

Have your say about what you just read! Leave me a comment in the box below.

Don’t see the comments box? Log in to your Facebook account, give Facebook consent, then return to this page and refresh it.




Privacy Policy | Contact | About Me

Site Map | Terms of Use