This project is a simple web server designed for the ESP8266 microcontroller. It provides a user-friendly web interface for controlling and configuring the device, along with over-the-air (OTA) firmware update capabilities, making it easy to update your device's firmware remotely.
- Simple web server for ESP8266 microcontroller.
- User-friendly web interface for controlling and configuring the device.
- Over-the-air (OTA) firmware update capabilities.
- Easily customizable for your specific application.
Before getting started, ensure you have the following:
- An ESP8266 microcontroller (e.g., NodeMCU, Wemos D1 Mini).
- Visual Studio Code (VSCode) with PlatformIO installed.
- A stable Wi-Fi connection for your ESP8266 to connect to.
- Clone or download this repository to your local machine.
git clone https://github.com/your-username/esp8266-webserver-ota.git
-
Open the project folder in Visual Studio Code (VSCode).
-
In VSCode, install the PlatformIO extension if you haven't already.
To set up your Wi-Fi credentials, follow these steps:
-
Make a copy of the file
secrets.h.example
and rename it tosecrets.h
. -
Update the
secrets.h
file with your Wi-Fi credentials. This file should contain your Wi-Fi SSID and password.
For the initial sketch upload to the ESP8266, use a USB connection. Follow these steps:
-
Connect your ESP8266 to your computer via USB.
-
Build and upload the code to the ESP8266 by clicking the PlatformIO toolbar's "Upload" button.
-
Connect the serial monitor and note the IP address the device prints after rebooting
-
Customize the project settings in the
platformio.ini
file, specifically the IP address of the device -
Build and upload the code to your ESP8266 by clicking the PlatformIO toolbar's "Upload" button.
To perform over-the-air (OTA) firmware updates, follow these steps:
-
Build the updated firmware using the PlatformIO "Build" command.
-
Upload the new firmware to the ESP8266 by clicking the PlatformIO toolbar's "Upload" button.
-
The new firmware will be automatically detected and applied over-the-air the next time the device connects to the Wi-Fi network.
Once the code is uploaded to your ESP8266, the device will create a local web server. You can access the web interface by opening a web browser and entering the ESP8266's IP address in the address bar.
http://esp8266-ip-address/
Here, you can interact with your ESP8266 through the web interface.
You can control a GPIO pin by making HTTP requests to the following endpoints:
/RELAY/ON
- Turns the GPIO pin low./RELAY/OFF
- Turns the GPIO pin high.
You can set the specific GPIO pin in the source code by editing
#define RELAY 0
If you'd like to contribute to this project, please feel free to submit issues, pull requests, or feature suggestions.
This project is licensed under the MIT License, which means you are free to use, modify, and distribute the code for your own purposes.