Skip to content

matteogarato/RemoteTemperatureReader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RemoteTemperatureReader

ESP32 DHT22 MQTT Sensor

This project demonstrates how to use an ESP32 microcontroller with a DHT22 temperature and humidity sensor to publish sensor data to an MQTT broker. The data can then be used for various applications such as home automation, environmental monitoring, etc.

Hardware Requirements

  • ESP32 microcontroller
  • DHT22 temperature and humidity sensor
  • LED (optional, used for indication)
  • WiFi connection for ESP32

Schematics

schematics

Software Dependencies

Installation and Setup

  1. Clone or download this repository.
  2. Open the project in the Arduino IDE.
  3. Install the required libraries through the Arduino Library Manager if not already installed.
  4. Update the following parameters in the code:
    • WiFi SSID and password
    • MQTT broker details (server, port, username, password, topic)
  5. Connect the DHT22 sensor and LED to the ESP32 as per the pin configurations in the code.
  6. Compile and upload the code to your ESP32 board.

Homeassistant Setup

mqtt:
  sensor:
    - name: "TemperaturaEsterna"
      unique_id: "TemperaturaEsterna"
      state_topic: "home/external/sensor"
      unit_of_measurement: "°C"
      value_template: "{{ value_json.temperature }}"
    - name: "UmiditaEsterna"
      unique_id: "UmiditaEsterna"
      state_topic: "home/external/sensor"
      unit_of_measurement: "%"
      value_template: "{{ value_json.humidity }}"

Usage

  1. Once uploaded, the ESP32 will connect to the specified WiFi network.
  2. It will then start publishing temperature and humidity data to the specified MQTT topic.
  3. You can monitor the data using an MQTT client or integrate it with other applications like Home Assistant.

Known Issues

  • The code includes a workaround for negative temperature values which may vary from standard DHT22 sensor behavior. Further investigation or alternative libraries may be required for precise handling.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

ESP32 DHT22 MQTT Sensor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages