A comprehensive framework for building IoT applications on the ESP8266 microcontroller. This library provides functionality for handling common IoT tasks such as WiFi connectivity, OTA updates, MQTT communication, and more.
- HTTP Server: Serve static files (e.g., HTML, CSS, JS) and handle HTTP requests (GET, POST, etc.). Built-in WebSocket integration. Allows integration of additional endpoints.
- Logger: Abstract logging for debugging.
- OTA: Over-The-Air updates for the ESP8266.
- WiFi: Manage WiFi connections.
- MQTT: Publish and subscribe to MQTT topics.
- Configuration: Manage configuration files in JSON format, with support for reading, writing, and HTTP API access..
- Download the library as a ZIP file or clone the repository into a directory:
git clone https://github.com/sovietmir/IoTesp8266Framework.git
- Add the library to your PlatformIO project by placing it in the
lib/folder or specifying the local path (adding it as a dependency) inplatformio.ini:lib_deps = file:///path/to/IoTesp8266Framework
- Add the library to your PlatformIO project by adding it as a dependency in
platformio.ini:lib_deps = https://github.com/sovietmir/IoTesp8266Framework.git
To use features like HTTPServerManager, OTA, and ConfigurationManager, you need to build and upload a filesystem image to the microcontroller. This filesystem contains static files (e.g., HTML, CSS) and an example of configuration file that could be used by the framework.
- Copy the
data/folder from the framework into your project directory. - Configure PlatformIO to use LittleFS by adding the following to
platformio.ini:build_flags = -DPIO_FRAMEWORK_ARDUINO_LITTLEFS -I include board_build.filesystem = littlefs board_build.ldscript = eagle.flash.4m2m.ld
- Build the filesystem image:
The buildfs target compiles and packages the files from your project's data directory into a filesystem image that can be uploaded to the microcontroller. The output of the above command is a .bin file (
pio run --target buildfs
littlefs.bin), which contains the filesystem image. This file can now be uploaded to the microcontroller's flash memory. - Upload the filesystem image to the microcontroller:
Note: Ensure the microcontroller is in flash mode (booted with
pio run --target uploadfs
GPIO0grounded) during the upload process.
In your project include the main library header, that includes all the class headers:
#include <IoTesp8266Framework.h>or include individual modules:
#include <ConfigurationManager/ConfigurationManager.h>
#include <HTTPServerManager/HTTPServerManager.h>
#include <Logger/TelnetLogger.h>
#include <OTA/OTA.h>
#include <WiFiManager/WiFiManager.h>
#include <MqttManager/MqttManager.h>
#include <Sensor/Sensor.h>| Component | Description | Documentation |
|---|---|---|
HTTPServerManager |
HTTP server with static file serving | View |
Logger |
Unified logging interface | View |
OTA |
Over-the-air updates | View |
WiFiManager |
Dual-mode WiFi management | View |
MqttManager |
MQTT client wrapper | View |
ConfigurationManager |
JSON config management | View |
Sensor |
Generic sensor templatet | View |
IoTesp8266Framework/
├── src/
│ ├── HTTPServerManager/ # [Docs](documentation/HTTPServerManager.md)
│ ├── Logger/ # [Docs](documentation/Logger.md)
│ ├── OTA/ # [Docs](documentation/OTA.md)
│ ├── WiFiManager/ # [Docs](documentation/WiFiManager.md)
│ ├── MqttManager/ # [Docs](documentation/MqttManager.md)
│ ├── ConfigurationManager/ # [Docs](documentation/ConfigurationManager.md)
│ └── Sensor/ # [Docs](documentation/Sensor.md)
├── data/ # Static files and configs
├── documentation/ # Component documentation
├── library.json
├── CHANGELOG.json
└── README.md