Menu Close

Starting with LUA on ESP8266 Wifi module

Robo India presents tutorial on starting with LUA on ESP8266 wifi module and ESPlorer. 

1. Introduction:

To start with LUA programming on ESP8266 wifi module you will need ESPlorer. Here in this tutorial it is explain in detail to start with LUA on ESP8266 and ESPloer.

1.1 Prerequisites:

1.1.1 Setup connections of ESP8266This tutorial of Robo India explains setup connections of ESP8266.
1.1.2 NodeMCU firmware on your ESP8266This tutorial of Robo India explains how to flash ESP8266 wifi module with NodeMCU.
1.1.3 JAVA 7 and above installed: You may get it if you don’t have from here. http://java.com/download

Connect RX and TX pins of ESP8266 module to the Serial Port of you computer, if you don’t have one in your computer, FTDI or CP2102 can be used.

2. Required Software

Following software will be required to start with LUA programming on ESP8266 using ESPlorer.

2.1 ESPlorer 

Download ESPlorer Software from the below link.

https://github.com/4refr0nt/ESPlorer

As you open above link there will be a button on the right side of the page,

download-ZIP-2

 click on this and download master folder.

or you may download it from the following link-

After downloading ESPlorer.zip extract the same to your desired place. This is how it looks like.

The highlighted file in the following image is the file to run ESPlorer. Double click on the highlighted file to run ESPlorer.

2.2 LUA Editor

Though ESPlorer has got LUA Editor in itself. But we recommend to use following LUA Editor for ease. LUA Editor is an open source software for developing LUA programs. you may download it from the following link. 

http://luaedit.sourceforge.net/

3. Introduction to ESPlorer

Open ESPlorer as explained in Step 2.1. It looks like following image –

Connect your ESP8266 to your computer and note down the COM port(Mine is COM2). You will need to restart ESPlorer after connecting ESP8266 to the computer. Select you COM port. COM Port selection area is high lighted in the following image.

Select Baud Rate as shown highlighted in the below image, It is to be 9600, but some time it doesn’t work. So you will need to repeat these steps with other baud rates.

Click on open button to connect ESPlorer to the ESP8266 wifi module.

Following window is response window, you will know what exactly is happening in ESP8266 through this window, After successful connection you will see message as shown highlighted in following image.

Following window is user window where you can write codes or commands for ESP8266

4. Hello World programming 

Write following code in user window-

print(‘hello world’);

and click on the button highlighted in the following image-

As you click on the said button your code gets transferred to the ESP8266 wifi module and you get following response from ESP8266 wifi module.

ESP8266 wifi Module repeats whatever we say to it. Thus the response shown highlighted in above image has got 2 lines first is the repetition of our code and in the next line is the execution of our code.

5. File system on ESP8266 wifi module

Set of commands can be saved in a form of file with .lua extension. Such files can be transferred to ESP8266 and be executed by calling their name.

init.lua this file is executed at the starting. So as the ESP8266 wifi modules gets power it find init.lua and executes all of the command set written in this file.

For uploading file to ESP8266 you need to have that file prepared with you. You may use Notepad, LUA Editor, or ESPlorer to do the same. Click on the highlighted button locate the file you created and it will be uploaded to ESP8266 wifi module.

See the response from ESP8266 wifi module after uploading of file.

Status bar of ESPlorer is highlighted in the following image, It shows current status of process-

To execute any file which is already there in ESP8266, use following code-

dofile(‘filename.lua’);

If your click on the highlighted button shown in the following image, You will get list of files on the response window and on the below of this button in the form of button. After that you just need to click on the button to execute that file.

This is basics of ESPlorer and LUA Programming on ESP8266 wifi module. 

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
http://roboindia.com

Leave a Reply