ESP8266 Projects

Peter Jennings

AB6WM - West Coast

ESP8266 Lua Loader

LuaLoader is a Windows program for uploading files to the ESP8266 and working with the Lua serial interface. It is compatible with all versions of Windows from Windows 95 to Windows 10.

The terminal window shows the output from the ESP8266 UART and lets you type or paste commands for immediate interpretation and execution.

A selection of buttons are available to automatically type often used commands and to select files for uploading to the ESP8266 file system.


Help Menu

The Help Menu contains links to many ESP8266 and Lua resources. It also has a link to a local folder in which you can keep reference material you have downloaded, such as the pinout of the development board you are using. Saving internet shortcuts to that folder allows the user to add more online direct links to the Help menu.

Tools Menu

The Tools menu links to the latest firmware and the latest flasher applications. Run flasher from the tools menu to automatically switch the com port to the flasher software and see some help on what to do.

Settings Menu

The comm port settings can be used to select the appropriate comm port for your connection. If you have difficulty finding your comm port in the list, or connecting to it, please read the LuaLoader FAQ.

Hide Restart Garbage Data attempts to hide the random characters that appear when the processor restarts. These are actually sent at a different baud rate (usually 74800 baud), but appear as garbage at normal rates.

GPIO Monitor rate sets the repeat rate for automatically displaying port readings or ADC readings with the Read button clock.

Auto Baud Reset drops the baud rate back to 9600 baud when the processor resets so that communications is not lost.

Uploads at 921600 baud. Automatically changes the baud rate for the computer and the ESP8266 when uploading. Not all hardware is capable of this speed.

Upload as Binary. Default to binary mode for all uploads. Recommended.

The Buttons

All buttons have popup help information on mouse over. Many have right click options. A few explanations follow:

Baud Rate. Changes the connection baud rate. A command is also sent to the ESP8266 so the baud rates are changed simultaneously.

DTR and RTS. Toggle the DTR and RTS lines. On some development boards, these lines can be used to change from re-flash to run program modes. Color indicates whether the outputs are high or low. Right click to set the current setting as the default each time the port is connected. Be sure to understand your hardware when using these buttons.

CTS. Color indicates whether the input CTS is high or low.

GPIO Set the IO pins to read or write. Change their values. Read values once or multiple times on a polling schedule. Read the ADC value.

Heap. Print the current Heap (RAM) available. A common cause of restarts is running out of RAM.

Restart. Perform a soft restart. The init.lua file is run automatically on restart.

chipID. Each chip has a unique ID that can be used in a multiple IoT environment.

tmr.stop. Stops one or more of the 7 timers. Right click to set which ones.

Set AP. Set the chip to STATION mode and set the Access Point SSID and Password. The ESP8266 will automatically connect to the access point. The information is saved and after a restart the chip will automatically reconnect within 2 seconds, normally.

Get IP. Get the currently assigned IP address, if any.

Wifi Status. Show the current status of the Wifi connection.

Disconnect. Disconnect from the access point.

Upload File... Upload a file from your hard drive to the ESP8266 in text mode or binary mode. The folder used is now designated as the current workspace and the folder name is added to the File - Workspace menu.

Upload Bin (or Text). Uploads the file named in the edit box below. Right click to select text or binary uploads. Binary uploads test each block with a checksum for data integrity and are faster. However, the LLbin() function in the LLbin.lua file must be loaded first.

File Selection. A dropdown list of files in the current workspace and on the ESP8266. Files on the ESP8266 are marked with a < character. Files which have been modified since the last upload are marked with an explanation point ! If there are modified files, click Upload all changed files to update the system. The < Run file.list shows up if file.list has not been run (to tell LuaLoader what files are on the connected ESP8266).

Edit. Invokes your editor associated with *.lua files to edit the current file. Right click to open the workspace folder in Explorer.

dofile. Executes the dofile() command to execute the file named in the text box above.

remove. Remove the file named in the text box from the ESP8266 file system.

cat. List the contents of the file named in the text box.

Compile. Executes the node.compile() function on the file named in the text box.

do(lc). Executes dofile() on the .lc version of the file named in the text box.

Download. Downloads the selected file in binary. Useful for moving .lc files to the PC for installation on other chips using the Upload Bin command.

Format. Format the flash file system on the ESP8266. Deletes all the files. Format only works if you are running firmware built after 2015.01.05.

file.list. Lists the files in the ESP8266 flash file system. This list populates the drop down menu in the file name text box above.

Custom. Associate a .lua file with this button and rename it. Clicking the button will execute the file by typing it. Useful for clearing GPIOs or checking on variables while debugging. Right click to reset the button or change to a different file.


Download: LuaLoader.zip 0.91 (2016.01.16)
Download: LuaLoader.zip 0.87 (2015.03.15)
Download: LuaLoader.zip 0.83 (2015.02.05)


Buy me a beer? Donations to support this web site are gratefully accepted. You can use PayPal, credit card, or bitcoin. No amount is too small.


If you are new to the ESP8266 or LuaLoader, you may want to look at my

Quick Start Guide to the ESP8266 and LuaLoader
ESP8266 for Dummies


Before asking questions, please read the notes above on the commands and the LuaLoader FAQ below.


New Features:

0.91 bug fix related to binary downloads with some NodeMCU firmware versions

0.90 manually add a COM port that is not detected automatically
0.90 Fix bug that made Windows 10 not find open ports
0.90 save settings to ini files instead of registry allowing multiple instances and operation on USB stick

0.89 removed Hard Restart and Soft Restart messages which appeared out of sequence and confused

0.88 Allow more baud rates such as slow rates (mostly for using LuaLoader in different context)

0.87 Set DTR and RTS to default states on each connect.

0.86 changed the default value of DTR and RTS to false = HIGH
0.86 updated Tools - Latest Firmware link to github/releases.
0.86 fixed upload all .lua files bug (was uploading .lua.bak files)
0.86 added right click to Read button and clock button - set autoread repeat rate

0.85 added download binary file to PC.
0.85 added compile button.
0.85 added do(lc) button to dofile the compiled version of filename.

0.84 fixed a bug in abort when uploading multiple files.

0.83 check for new devices when opening comm dialog. No need to restart.
0.83 add Upload all .lua files to install multiple files in one click
0.83 add Custom button that executes a user defined file.

0.82 add Upload all changed files command to filename dropdown list.
0.82 add ! to mark recently changed files in filename dropdown list.
0.82 right click DTR and RTS to set defaults at startup.

0.81 add check mark on recently accessed documentation.
0.81 automatically load LLbin.lua if missing.

0.80 better error handling on binary uploads.
0.80 added remove Workspace to File - Workspace
0.80 added change Folder to Help - Local Documentation.
0.80 added COM2 and COM4 to comm dropdown list as defaults.

0.79 upload binary files added. Load LLbin.lua first.

0.78 add filter options to file list drop down menu (right click)

0.77 removed the dofile prompt after uploading
0.77 changed the Hide Garbage setting default to False
0.77 Changed the caption above the baud rate to show the COM port number

0.76 added wifi.setmode to the [Survey] button to ensure wifi.STATIONAP mode

0.75 added ADC to [Read] button with autorepeat for continuous ADC display

0.74 added buttons to set DTR and RTS outputs
0.74 added monitor to read CTS input

0.73 fix crash when user entered an illegal com port name
0.73 fix Hide Garbage on restart (NodeMcu became NodeMCU)
0.73 added file.format() button [Format] to replace [remove all] button
0.73 updated [cat] to not require LuaLoader.lua file and format for cut and paste

0.72 add Help - Local Documentation - opens files or shortcuts in a local folder
0.72 add [remove all] button to delete all files on the ESP8266
0.72 prettify file.list formatting

0.71 Updated links to NodeMcu latest firmware
0.71 Improved formatting of [survey] command

0.70 Revision for checking version information from NodeMcu
0.70 Fixed node.heap() after upload

0.69 Revised GPIO pin numbers for build 2014.12.19 from NodeMcu
0.69 Added Help link for Bit Module

0.68 Support for COM10-COM255 added
0.68 More Help resource links in the Help Menu for Lua and ESP8266
0.68 Optional automatic change to 921600 baud when uploading
0.68 Baud rate panel turns red if comm port is disconnected
0.68 Fixed a bug related to not having a log file

0.67 New coloured skin
0.67 Fixed a bug in adding ESP files to drop down menu

0.66 Added Workspace selection to File menu - Workspaces are automatically created when uploading a file.
0.66 Files in dropdown menu that are on the ESP are indicated with a < prefix.
0.66 Fixed file not found bug if files have been moved.

0.65 fixed random characters in entry window bug
0.65 tmr.stop menu addition - right click to choose 0 to 7 timers

0.64 [Load] file list automatically populated with Working Directory contents (*.lua)

0.63 Save typed text in pulldown history for rapid re-entry

0.62 reconnect COM port automatically after bin reflash

0.61 log time stamps for Hard restart and soft restart
0.61 added Wifi status button
0.61 automatically revert to 9600 baud on connection errors (usually restart)

0.60 Upload with no echo.
0.60 Set baud rate up to 921600.

0.58 Monitor firmware and API on github and notify of changes.
0.58 Added folder of examples to try.

0.55 Date stamp the log file each time [dofile] is clicked.
0.55 Tools menu - links to download latest firmware, flasher
0.55 Added 74880 to baud rate list.
0.55 Allow non-standard baud rates.

0.54 tmr.stop() - stops timers 0 and 1 on click and upload.

0.53 View Log menu item (file association must be set for .log).
0.53 Edit button for lua files (file association must be set for .lua).

0.52 Added support for pullup resistors in gpio.mode()

0.51 Checks for using latest LuaLoader and latest NodeMCU.
0.51 Logs to a file.
0.51 GPIO monitor shows on a single line.
0.51 Optionally hide garbage when doing node.restart().

0.5 Autorepeat GPIO read function for monitoring an input.
0.5 Sample code included in zip file.
0.5 Additional Help links to useful resources.

0.4 Set mode, read and write GPIO buttons.
0.4 Status Bar shows latest LuaLoader and NodeMCU version at start.


Tips:

Run LuaLoader as administrator to enumerate the comm ports correctly.

Use the terminal log file to look back at the code that worked when you suddenly find it doesn't.

Commands can be edited in the terminal window, selected and pasted to the chip for quick debugging and testing.

Quick code tests are done by pasting a few lines with the [Paste Text] button. Longer examples are best uploaded as files and run with [dofile].

You can use GPIO1, usually the UART0 Tx to light the blue LED on the ESP-01 boards. To restore communications, just change the baud rate in LuaLoader which sends a uart.setup() command to the board.


Frequently Asked Questions:

Why doesn't LuaLoader see my comm port?

The short answer is, “I don't know”. Try running as administrator. Running LuaLoader as administrator has solved this problem in Windows 10 and earlier versions of Windows. Try reassigning the port to a different number, such as COM4 (Device Manager - Select Driver - Advanced Settings). The drop-down menu of available comm ports is populated by a list provided by a call to a Windows function. If the hardware configuration is changed, it may be necessary to quit LuaLoader and start it again to correctly populate the drop-down menu.

The problem is, that on my Windows 7 x64 machine, I have had no problem with FTDI, CH340, and CP2102 drivers. But for some reason, a few users are having this problem. If you have this problem and solve it, please let me know how. There are many versions of the drivers available and not all of them are good, it seems.

Some Windows 8 users have solved the missing port problem by right clicking the LuaLoader.exe file in explorer and selecting Windows 7 compatibility mode for the LuaLoader program. It probably works for 8 and 10, too.

LuaLoader 0.90 has improved the port search for Windows 10 compatibility. There is also a manual port name capability that can be used when Windows does not list the port.

LuaLoader sees my port, but can't connect?

Most likely the port is in use by another program. In some cases, it may be necessary to reboot your computer or re-assign the port using the Device Manager to get the other application to release the port. It may be necessary to run the program as administrator to access the ports.

file.list and Survey display incorrectly?

NodeMCU build 20150127 introduced bugs in string functions such as string.format, so instead of formatting the SSID or file name, 10s is typed out. In the meantime, use the Custom button to define the function without the formatting. I am sure this problem is temporary.