Become a subscriber (Free)

Join 29,000 other subscribers to receive subscriber sale discounts and other free resources.
:
:
Don't worry -- youre-mail address is totally secure. I promise to use it only to send you MicroZine.

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 and 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


New! Comments

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




Privacy Policy | Contact | About Me

Site Map | Terms of Use



Visit our Facebook Page:
To Visit Click Here


Recent Articles

  1. How to use the ADS1115

    A tutorial on using the ADS1115 precision 16 bit ADC for low power use.

    Read more

  2. ESP8266 Webserver in Lua

    ESP8266 Webserver: This code shows you how to use lua to create a webserver using html button inputs to contrtol an LED on the ESP module.

    Read more

  3. ESP8266 NodeMCU Firmware: ESP8266 flash

    How to flash nodemcu firmware into a ESP8266 so you can use the LUA scripting language.

    Read more

  4. NodeMCU Examples

    Nodemcu examples starting off wioth simple ones and progressing to wifi coding. This is an excellent tutorial to start learning how to use nodeMCU with lua.

    Read more

  5. How to use ESPLorer to upload lua scripts

    Find out how to download the ESPLorer and use it to upload lua scripts

    Read more

  6. The TCS230 Color Sensing Chip: How it works and how to use it.

    How to use the TCS230 (/TCS3200) Color detector chip and easily add it to any of your projects.

    Read more

Readers Comments

"I wanted to thank
you so so so much
for all the information
you have provided in
your site it's

SUPERB and FANTASTIC."

- Ranish Pottath

"This site really is
the best and my favorite.
I find here many useful
projects and tips."

- Milan

bursach<at>gmail.com<

"Awesome site,
very, very easy and nice
to navigate!"


- Matt
matt_tr<at>
wolf359.cjb.net


Learn Microcontrollers

"Interested in
Microcontrollers?"

Sign up for The
Free 7 day guide:

FREE GUIDE : CLICK HERE


"I am a newbie to PIC
and I wanted to say
 how great your
site has been for me."


- Dave

de_scott<at>bellsouth.net

"Your site is a great
and perfect work.
congratulations."


- Suresh

integratredinfosys<at>
yahoo.com

"I couldn't find the correct
words to define
yourweb site.

Very useful, uncovered,
honest and clear.

Thanks so much for
your time and works.
Regards."


- Anon

Back to Top