Skip to content

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.

Notifications You must be signed in to change notification settings

Jjateen/ota-sntp-esp32-app

Repository files navigation

ESP32 DHT22 App with OTA and SNTP

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.


Features

  • DHT22 Sensor Integration: Reads temperature and humidity data.
  • SNTP Time Sync: Synchronizes time with an NTP server.
  • OTA Firmware Updates: Enables wireless firmware updates.

Folder Structure

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

Prerequisites

  1. Install the ESP-IDF framework.
  2. Connect the DHT22 sensor to your ESP32:
    • VCC: 3.3V or 5V
    • GND: Ground
    • DATA: GPIO 4

Setup and Usage

  1. Clone the Repository:

    git clone https://github.com/Jjateen/ota-sntp-esp32-app.git
    cd ota-sntp-esp32-app
  2. Set Up ESP-IDF:

    • Export ESP-IDF environment variables:
      . $HOME/esp/esp-idf/export.sh
  3. Configure the Project:

    • Open the configuration menu:
      idf.py menuconfig
    • Set the GPIO for the DHT22 sensor under Component ConfigDHT22 Settings.
    • Configure Wi-Fi and OTA settings.
  4. 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/ttyUSB0 or COM3).

  5. Monitor Output:

    • View the serial monitor:
      idf.py monitor
    • Exit the monitor with Ctrl+].

Commands Summary

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.

About

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.

Resources

Stars

Watchers

Forks