236d5e4a8c5ce29bbb94b8142fadd1d939926f5b
ESP32 Custom Libraries Collection
A collection of custom libraries designed for ESP32 development with ESP-IDF framework. These libraries are optimized for IoT sensor projects and provide reliable, reusable components.
Libraries Overview
🌡️ DHT22 Sensor (dht22_sensor)
- Version: 1.0.0
- Description: Custom DHT22/AM2302 sensor library with bit-banging implementation
- Features: Temperature and humidity reading with robust timing control
- Use Case: Environmental monitoring projects
Method 1: Git
cd your_project_directory
mkdir dht22
git clone https://home.arcoa.eu:8413/esp32libs/dht22_sensor.git
Method 2: Manual Copy
- Clone or download this repository
- Copy the desired library folders to your project's
lib/directory - Include the headers in your main code
Method 3: PlatformIO Library
Each library contains a library.json file for PlatformIO compatibility.
Usage Example
#include "dht22_sensor.h"
#include "wifi_manager.h"
#include "mqtt_manager.h"
#include "led_manager.h"
void app_main(void) {
// Initialize WiFi
wifi_manager_config_t wifi_config = {
.ssid = "YourSSID",
.password = "YourPassword"
};
wifi_manager_init(&wifi_config);
// Initialize MQTT
mqtt_manager_config_t mqtt_config = {
.broker_url = "mqtt://your-broker.com",
.client_id = "esp32_sensor"
};
mqtt_manager_init(&mqtt_config);
// Initialize DHT22 sensor
dht22_init(GPIO_NUM_4);
// Initialize LED for status indication
led_manager_init(GPIO_NUM_8, 1);
// Your application logic here
while (1) {
float temperature, humidity;
if (dht22_read(&temperature, &humidity) == ESP_OK) {
mqtt_publish_sensor_data(temperature, humidity);
led_manager_set_color(0, 255, 0); // Green for success
} else {
led_manager_set_color(255, 0, 0); // Red for error
}
vTaskDelay(pdMS_TO_TICKS(30000)); // 30 second interval
}
}
Library Dependencies
mqtt_manager → (none)
Configuration
Library includes configuration options through header files. Check individual library documentation for specific configuration parameters.
Common GPIO Assignments
- DHT22: Any GPIO pin (recommended: GPIO 4)
- LED Strip: Any GPIO pin (recommended: GPIO 8)
- Built-in LED: GPIO 2 (ESP32-C6)
Compatibility
- Framework: ESP-IDF
- Platforms: ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6
- Tested: ESP32-C6 DevKit
- License: MIT
Project Structure
MyESP32Libs/
├── README.md
├── CHANGELOG.md
├── dht22_sensor.c
├── dht22_sensor.h
├── README.md
├── CHANGELOG.md
├── library.json
Contributing
- Fork this repository
- Create a feature branch (
git checkout -b feature/new-library) - Commit your changes (
git commit -am 'Add new library') - Push to the branch (
git push origin feature/new-library) - Create a Pull Request
Development Notes
⚠️ VSCode Include Errors: If you see cannot open source file "esp_err.h" errors in VSCode, this is expected for standalone library development. See DEVELOPMENT.md for solutions.
License
This project is licensed under the MIT License - see individual library.json files for details.
Support
For issues and questions:
- Create an issue in this repository
- Check individual library headers for API documentation
- Refer to ESP-IDF documentation for framework-specific details
Description
Languages
C
100%