Build a simple ESP8266 Web Server

Build a simple ESP8266 Web Server using Arduino IDE. Learn about connecting it to Wi-Fi and creating a web server using a sample text containing web page.

Step 1: Required Components

ESP8266 Module x 1
3.3V Linear Voltage Regulator (LD1117) x 1
Arduino UNO Board (Only for uploading program to ESP8266) x 1
Jumper Wires

Step 2: Circuit Time

Make a circuit as per the programming ESP8266 with Arduino Board.

Circuit Diagram of Creating web server with ESP8266

Step 3: Code Time

This is code for Creating ESP8266 web server. First, we initialized server at port 80 and two constants for Wi-Fi SSID and Password. In setup, Serial started at 115200 baud to check the status of ESP8266. Wi-Fi begins to connect with SSID and Password and waited till it connects to the Wi-Fi. Print the Local IP to Serial monitor to use that address as Web server address. Created an index page with the text “Hello! This is an index page.” using the server.on and server.send as you can see in code. And at last, Begin the Server. In loop, server.handleClient() is used for Handling incoming client requests

Step 4: Upload code to ESP8266

Make a circuit as per above-given diagram to upload code to ESP8266. Make changes to SSID and Password in code and upload the code to ESP8266 using Arduino IDE. Open the Serial monitor IP in your browser after Serial monitor shows “Server listening” It will look like as blow given screenshot.

For information about uploading code to ESP8266 Click Here.

Leave a Reply