Initial commit

This commit is contained in:
Andrey Aleksandrov
2025-12-30 21:48:48 +02:00
commit 236d5e4a8c
5 changed files with 581 additions and 0 deletions

134
README.md Normal file
View File

@@ -0,0 +1,134 @@
# 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
```bash
cd your_project_directory
mkdir dht22
git clone https://home.arcoa.eu:8413/esp32libs/dht22_sensor.git
```
### Method 2: Manual Copy
1. Clone or download this repository
2. Copy the desired library folders to your project's `lib/` directory
3. Include the headers in your main code
### Method 3: PlatformIO Library
Each library contains a `library.json` file for PlatformIO compatibility.
## Usage Example
```c
#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
1. Fork this repository
2. Create a feature branch (`git checkout -b feature/new-library`)
3. Commit your changes (`git commit -am 'Add new library'`)
4. Push to the branch (`git push origin feature/new-library`)
5. 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](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