IoT-ESP8266-Based Web Server-Irrigation

In this post you see a Home IoT Project, I’ve created a simple powerful system using the ESP8266 microcontroller. With a few clicks on a user-friendly web interface, you can control various devices in your home, like lights or pumps, Light sensors or curtains, from anywhere with a LAN internet connection.

Here are the components needed.

Components

Proteus Software: To simulate the circuit and test the functionality of our Home IoT Project before implementing it physically.

ESP8266 NodeMCU: The brain of our project, this microcontroller board provides WiFi connectivity and processing power

LEDs (Light Emitting Diodes): These are used to demonstrate control over lights in your home

Pumps or Motors

-Resistors: To protect the LEDs from excessive current

-Wires: and Breadboard: will be used to make connections between the components.

Power Supply: To power the ESP8266 NodeMCU and other components. You can use a USB cable connected to a computer or a USB power adapter.

Simply download the Proteus project and ESP8266 Protuse library file below, where the Proteus schema provides a visual guide on how to connect these elements seamlessly.

Download Proteus Project

ZIP password: hussamalhayek.com

Download to add Esp8266 library to proteus by electonicstreet.com

Arduino IDE Code

The code is for an ESP8266-based web server that controls two outputs through a web interface. In this project I used a water pump 12V DC on Pin D3 and Red led R-led on Pin D2.

Code functionality:

Including Necessary Libraries: The code includes the ESP8266WiFi library to enable WiFi connectivity.

Defining Network Credentials: The network SSID and password are stored in variables for connection.

Setting up Web Server: It initialises a web server on port 80 using the WiFiServer class.

Variables Initialisation: It initialises variables to store HTTP requests and output states.

Assigning GPIO Pins: Defines GPIO pins for controlling the outputs.

Setup Function: Configures serial communication and pins as outputs. Connects to the WiFi network and starts the server.

Loop Function: Listens for incoming client connections. Upon connection, reads the HTTP request and parses it. Responds to specific requests to toggle the states of the outputs.

Constructs an HTML page to display the current state of the outputs and buttons to control them.

Sends the HTML response to the client. Closes the connection.

Download the Arduino IDE code

ZIP password: hussamalhayek.com

Router Configuration

You need to enable a guest network on your router and typically need to access your router’s administration interface through a web browser. Within the wireless settings, there should be an option to enable a guest network. This might be labeled as “Guest Network”, “Guest Wi-Fi”, or similar. Click on this option to enable it .

This Home IoT Project showcases a seamless integration of the ESP8266 microcontroller with diverse components, resulting in a user-friendly system for remotely controlling devices. Utilising the Proteus schema as a simulation visual guide enhances understanding and facilitates the implementation of this project, making it even more convenient to achieve