This post is intended to help beginners flash NodeMCU firmware in ESP Modules and thus try lua coding In ESP modules. The steps were tested with ESP-12 based NodeMCU development kit. But the steps are similar for almost all ESP modules available in the market.
No microcontrollers are required to control your ESP. Why use Arduino and unstable AT command interface when you have a 4MB, 80MHz SOC at hand…?? The spec of ESP12 is just amazing and will help to explore the IOT world even faster.
Download links : NODEMCU loader, NodeMCU firmware, ESPlorer IDE for lua scripting.
To enable ESP to boot into the firmware mode, connect the GPIO0 pin to ground and restart the module. For NodeMCU development kit Flash button can be pressed and hold while reapplying power to enter bootloader mode.
Open NODEMCU Flasher. Browse the bin file Configuration tab as below. Select the correct COM port from the config tab. Press flash and wait for the operation to finish
Open ESPlorer IDE. On the right pane click refresh, select the COM port and choose 9600 Baud rate.
Write a sample code as follows for turning on an LED connected to GPIO0 of the ESP module.
Copy the code to the script location in ESPlorer IDE. Press send to ESP button to send the code to ESP module. The lua interpreter will execute the code and output of the code can be seen at the right hand side console window.
pin = 1 gpio.mode(pin,gpio.OUTPUT) gpio.write(pin,gpio.HIGH) print(gpio.read(pin))
Congratulations. You have turned on an LED using LUA scripting!!