This is an ESP32 application built using the ESP-IDF framework. It reads temperature and humidity data from a DHT22 sensor connected to GPIO 4, synchronizes time using SNTP, and supports Over-the-Air (OTA) firmware updates.
- DHT22 Sensor Integration: Reads temperature and humidity data.
- SNTP Time Sync: Synchronizes time with an NTP server.
- OTA Firmware Updates: Enables wireless firmware updates.
ota-sntp-esp32-app/
├── .devcontainer/ # Containerized development configuration
├── .vscode/ # VSCode configuration files
├── esp-idf-lib/ # External libraries and dependencies
├── main/ # Source code for the application
│ ├── webpage/ # Webpage assets served by the HTTP server
│ ├── app_nvs.* # Non-volatile storage handling
│ ├── DHT22.* # DHT22 sensor integration
│ ├── http_server.* # HTTP server implementation
│ ├── rgb_led.* # RGB LED handling
│ ├── sntp_time_sync.* # SNTP time synchronization
│ ├── wifi_app.* # Wi-Fi application setup
│ └── wifi_reset_button.*# Wi-Fi reset button handling
├── partition_table/ # Partition configuration files
├── CMakeLists.txt # CMake project configuration
├── partitions.csv # Partition table file
├── sdkconfig # ESP-IDF project configuration
└── README.md # Project documentation
- Install the ESP-IDF framework.
- Connect the DHT22 sensor to your ESP32:
- VCC: 3.3V or 5V
- GND: Ground
- DATA: GPIO 4
-
Clone the Repository:
git clone https://github.com/Jjateen/ota-sntp-esp32-app.git cd ota-sntp-esp32-app -
Set Up ESP-IDF:
- Export ESP-IDF environment variables:
. $HOME/esp/esp-idf/export.sh
- Export ESP-IDF environment variables:
-
Configure the Project:
- Open the configuration menu:
idf.py menuconfig
- Set the GPIO for the DHT22 sensor under Component Config → DHT22 Settings.
- Configure Wi-Fi and OTA settings.
- Open the configuration menu:
-
Build and Flash:
- Build the project:
idf.py build
- Flash the firmware:
idf.py -p [PORT] flash
Replace
[PORT]with your ESP32's serial port (e.g.,/dev/ttyUSB0orCOM3). - Build the project:
-
Monitor Output:
- View the serial monitor:
idf.py monitor
- Exit the monitor with
Ctrl+].
- View the serial monitor:
| Command | Description |
|---|---|
idf.py menuconfig |
Configure the project settings. |
idf.py build |
Build the project. |
idf.py -p [PORT] flash |
Flash the firmware to the ESP32. |
idf.py monitor |
Monitor the ESP32's serial output. |