In this illustration i will going demonstrate here how to build an ESP8266 standalone Web Server coded in LUA Script with ESPlorer, and remotely control the LED via Network.

Electronic Parts we need to accomplish this project.

  1. ESP8266 Module Board
  2. LED(Light Emitting diode)
  3. 220k Resistor
  4. 3.3v Power Regulator

Software Required for this demonstration.

ESPlorer IDE | Installation Guide | Programming Guide | Download
NodeMCU Flasher for Windows | Programming Guide | Download

NodeMCU is a firmware that allows you to do a programming inside the ESP8266 module using the LUA script similar to Arduino Board. With just a few lines of code you can control and connect via WiFi the ESP8266 GPIO(General Purpose Input Output) turning your ESP8266 intro a wireless web server, this is the fist step to make an Internet of Things.

14Core-ESP-Wiring

Flashing your ESP8266 / Open NodeMCU Flasher to flash the ESP8266 follow this link how to flash ESP8266 using NodeMCU Flasher.

14Core-Node-Flasher-3

You need to FLASH and it should start the process.
Note: You need to change some settings on the advance tab, after this process, it should see a green check icon.

Below the schematics used this project.
Follow this schematics to create your ESP8266 stand alone server to control 2 LED

14Core-ESP-Wiring_IOT

Software Installation

In this process we will going to use the ESPlorer IDE to program the ESP8266 Module Board. Please follow the instruction below.

1. Download the ESPlorer | Installation Manual | Download |
2. Unzip the folder
3. Open the folder look for “ESPlorer-master \ ESPlorer \ dist”
4. Run the  “ESPlorer.jar” you need to have JAVA installed in your system

14Core-ESP-Explorer-for-IOT2

Uploading LUA Script

1. Connect the FTDI(Future Technology Devices International) USB RS232 Programmer to your PC
2. Select port.
3. Click open & Close
4. Select NodeMCU with MicroPhython tab
5. Create new file named “core.lua”
6. Click Save to ESP

14Core-ESP_Programmer

The LUA Script

Flash the code into ESP8266 using ESPlorer. your file should named “core.lua”

 

Download the source code here | core.lua

You need to replace your Wifi Station detail  find the Network Name & the Password of your choice in the script above.

Access your web server from your smart phone of PC

Restart your ESP8266 Web Server, after you restart the “IP ADDRESS” on the serial monitor screen, to access the web server we need to type the http:// protocol along with the IP address.

 “Example: http://192.168.250.100”

web-server-esp8266

 

Build your own ESP8266 Web Server Tutorial
Facebooktwittergoogle_plusredditpinterestmail

7 thoughts on “Build your own ESP8266 Web Server Tutorial

  • Pingback: ESP8266 활용 가이드 - NodeMCU Lua 개발환경

  • at
    Permalink

    I’m using the NodeMCU Development Kit, but all I had to do was change the LED numbers to
    led1 = 0
    led2 = 4
    and everything worked right out of the box. Impressive!

    Reply
  • at
    Permalink

    Hi, your example work with IE, Mozilla, Chrome… but not with Safari?

    Reply
    • at
      Permalink

      That’s because there’s quite castrated and not very standard-compliant version of the HTTP response. Try adding this:
      buf = buf..”HTTP/1.1 200 OK\nContent-Type: text/html\n\n”;
      after 21th string, so that it will return HTTP/1.1 200 OK to the browser. It will not make strictly valid HTTP response, nevertheless it works for safari in my case.

      Reply
  • at
    Permalink

    This was good until NodeMCU update (which won’t flash with the NodeMCU flasher. EXPlorer doesn’t work with it either.

    Reply
  • at
    Permalink

    How to do this flashing with Arduino and without FTDI ??

    or can we make standalone web server with Arduino and esp8266??

    Reply
    • at
      Permalink

      You need to configure or set the command to your ESP8266 to auto run the Luascript when the module plug to the power. If you want to make it as standalone u need a regulator to supply 3v to vcc and gnd to gnd.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *