This project demonstrates how to connect an ESP8266 microcontroller to a WiFi network and send periodic HTTP POST requests to a backend server. The project is useful for applications like IoT devices that require data logging or reporting to a remote server at regular intervals.
- Connects to a WiFi network using credentials.
- Sends HTTP POST requests to a specified backend server every 4 hours.
- Automatically reconnects to WiFi if the connection is lost.
- ESP8266 (e.g., NodeMCU ESP8266)
- Arduino IDE or PlatformIO (for development)
- WiFi access point
- Backend server to handle HTTP POST requests
ESP8266WiFi
: For connecting the ESP8266 to a WiFi network.ESP8266HTTPClient
: For sending HTTP POST requests.
-
Clone this repository:
git clone https://github.com/umuttopalak/electric-checker-esp8266.git
-
Open the project in Arduino IDE or PlatformIO.
-
Install the required libraries via the Arduino Library Manager:
ESP8266WiFi
ESP8266HTTPClient
-
Modify the following lines in the code to include your WiFi credentials and backend URL:
const char *ssid = "your-wifi-name"; const char *password = "your-wifi-password"; const char *serverUrl = "your-backend-url";
-
Compile and upload the code to your ESP8266 board.
- Once uploaded, the ESP8266 will attempt to connect to the specified WiFi network.
- After a successful connection, the ESP8266 will send an HTTP POST request to the backend server every 4 hours.
- If the WiFi connection is lost, the device will try to reconnect automatically.
This project is licensed under the MIT License. See the LICENSE
file for more details.