본문 바로가기

피지컬컴퓨팅/아두이노

ESP32와 DHT22로 온도, 습도 측정하기

반응형

ESP32와 DHT22(온습도 측정 센서)를 활용하여 온도와 습도를 측정해보겠습니다.

 

1) 온습도 측정하기

- 준비물 : ESP32 보드 , DHT22 센서

 

- 참고 사이트 : https://wokwi.com/projects/322410731508073042

 

esp32-dht22.ino - Wokwi ESP32, STM32, Arduino Simulator

Run IoT and embedded projects in your browser: ESP32, STM32, Arduino, Pi Pico, and more. No installation required!

wokwi.com

 

- 회로도

 

 

- 소스코드

/**
   ESP32 + DHT22 Example for Wokwi
   
   https://wokwi.com/arduino/projects/322410731508073042
*/

#include "DHTesp.h"

const int DHT_PIN = 15;

DHTesp dhtSensor;

void setup() {
  Serial.begin(115200);
  dhtSensor.setup(DHT_PIN, DHTesp::DHT22);
}

void loop() {
  TempAndHumidity  data = dhtSensor.getTempAndHumidity();
  Serial.println("Temp: " + String(data.temperature, 2) + "°C");
  Serial.println("Humidity: " + String(data.humidity, 1) + "%");
  Serial.println("---");
  delay(2000); // Wait for a new reading from the sensor (DHT22 has ~0.5Hz sample rate)
}

 

 

- 결과

 

 

2) 온습도 측정하여 ILI9341 디스플레이에 표시하기

- 참고사이트

https://www.techrm.com/lcd-tft-display-for-monitoring-temperature-and-humidity-with-dht22/

 

LCD TFT display for monitoring temperature and humidity with DHT22 - Techrm

Welcome to this hands-on exploration of the world of LCD TFT displays and environmental monitoring with the ESP32. In this article, we will dive into the

www.techrm.com

 

https://github.com/Philc333/ESP32_ILI9341_DHT11

 

GitHub - Philc333/ESP32_ILI9341_DHT11

Contribute to Philc333/ESP32_ILI9341_DHT11 development by creating an account on GitHub.

github.com

 

https://youtu.be/mYH8ADLHVwo?si=qvIsZ1BcwbXHQIq2

 

 

- 소스코드

https://github.com/Philc333/ESP32_ILI9341_DHT11

 

GitHub - Philc333/ESP32_ILI9341_DHT11

Contribute to Philc333/ESP32_ILI9341_DHT11 development by creating an account on GitHub.

github.com

 

반응형