Standalone IoT: Control LEDs With ESP8266 Web Server (No Internet)
by BlinkNBuild in Circuits > Remote Control
29 Views, 0 Favorites, 0 Comments
Standalone IoT: Control LEDs With ESP8266 Web Server (No Internet)
In this tutorial, we will learn how to build a simple IoT project that controls three LEDs using an ESP8266 module. Unlike many IoT projects that require a cloud connection, this system works in Access Point mode. The ESP8266 creates its own Wi-Fi network and hosts a web server, allowing you to control the lights directly from a mobile browser without needing an internet connection or a router.
Supplies
• ESP8266 Module (NodeMCU or similar)
• 3x LEDs (Any colour or white)
• 3x Resistors (220 Ohms)
• Breadboard
• Jumper Wires (Male-to-Male)
• Micro USB Cable (For programming and power)
The Circuit Assembly
• Mount the Board: Insert the ESP8266 module into the breadboard, ensuring it fits properly.
• Connect Resistors: Connect the three 220-ohm resistors to pins D0, D2, and D6 on the ESP module.
• Connect LEDs: Attach the positive terminal (longer leg) of each LED to the other end of the respective resistors.
◦ First LED connects via resistor to D0.
◦ Second LED connects via resistor to D2.
◦ Third LED connects via resistor to D6.
• Common Ground: Short all the negative terminals of the LEDs together. Connect this common negative rail to the GND pin of the ESP module using a jumper wire.
Demonstration
Circuit Diagram
Software and Upload
• Open Arduino IDE: Create a "New Sketch" and maximize the window.
• Board Setup: Go to Tools > Board and select your specific ESP8266 module. Ensure the correct Port is selected (check Device Manager if unsure).
• Get the Code: Open the GitHub link provided in the description of the Tutorial video. Copy the code titled "esp_3LED_control.ino" completely.
• Upload: Paste the code into your sketch. Click Upload. You will see the ESP LED blink as it writes to the memory address. Wait for the "Done Uploading" message.
Connecting to the Web Server
Once powered on, the ESP8266 acts as a Wi-Fi Access Point.
1. Open Wi-Fi settings on your phone or laptop.
2. Connect to the network named: ESPI266 LED IP.
3. Enter the password: 12345678.
4. Important: If your phone warns "No internet connection," select the option to "Keep Wi-Fi connection".
Testing and Operation
1. Open a web browser (Chrome, Safari, etc.).
2. Type the IP address 192.168.4.1 into the search bar.
3. Pro Tip: Select "Desktop site" in your browser settings for the best view.
4. Control: Use the on-screen buttons to toggle the LEDs.
5. Dynamic Mapping: You can change the GPIO pins in the web interface (Default are 0, 2, and 6). For example, if you change the first button to "D6", it will control the third LED instead of the first.
Full Video Tutorial