Esp8266 Web Control (with Nodemcu and Lua)

Introduction: Esp8266 Web Control (with Nodemcu and Lua)

I have used the Nodemcu firmware and Lua uploader to upload the program.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Terminologies Used

It is very confusing to start working with ESP8266 just by googling. It took me three days to understand that there are two types of firmwares and one uploader do not work with other. I have not worked with Espressif firmware as i found Nodemcu(Lua) easy for my requirements.

Links to download nodemcu-flasher:

Links to download Lua downloader:

So, first you are required to add an firmware(operating system) to the ESP8266. Then you can start with coding.

Step 2: Flashing the Firmware

Download firmware from the following link.

Procedure to build your own firmware

Your email:-provide your email id, the built firware link will be sent to your email id.

Select branch to build from: select "dev"

Select modules to include: go with the defaults or select some more.(recommanded default).

Click on "Start your build"

It will take 5 minutes to 15 minutes.

Now open the "ESP8266Flasher.exe". Goto advanced tab change the baud rate to 115200,Flash size 1Mb(depending on your module). Goto congif and select the bin file downloaded from the link received in your meail. GOTO operation and select your COM port(it will be auto select) and click on Flash. If the MAC ID is visible your flash will start otherwise just unplug the USB and connect back and click flash.Blue lights on ESP and USB will start flickering.

Step 3: Writing Code

The above picture might look same as the previous step but the GPIO to GND connection is removed.

Open LuaUploader.exe

Select COM port or justt refresh it, change baud rate to 115200.

Change the file name to "init.lua"(its like startup program).

Copy paste the code in attachment.

Change the following parameter in the code:--(do not remove the " and ' )




4) netmask and gateway of your router(gateway is your router IP eg: or

5) GIVE IMAGE URL( open an image from google copy the link and paste it)

Then click "Save to ESP"

Blue light on ESP and USB with start flickering.

Step 4: Connection With the Relay

After uploading(Save to ESP) disconnect the USB and remove the conection with USB. and connect the ESP as per the above diagram. Instead of a different power supply the CP2102 also can be used.

Switch on the power and in your phone or laptop web browser open with STATIC IP you have given in the code.

Thank you

for reading.

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Arduino Contest 2020

      Arduino Contest 2020

    3 Discussions


    Question 2 years ago

    kindly explain GIVE IMAGE URL( open an image from google copy the link and paste it)


    Question 2 years ago on Step 4

    Hello ,

    It is very useful tutorial. I have a question. I update firmware my esp8266-01 module successfully and I upload your code as init.lua. Everything seems good. I can login web page on esp module and I click on button then there is no action on relay module. I tired to other relay module also I used to led then but it was same. Do I have to use mosquito services while using this web control. Do you have any advice for troubleshooting to solve my problem ?

    Best Regards.


    3 years ago

    Thanks, very useful tutorial