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
'피지컬컴퓨팅 > 아두이노' 카테고리의 다른 글
#인공지능 AI 활용 - 아두이노와 파이썬 연동하기 (1) | 2024.10.24 |
---|---|
ESP32 와 TFT LCD(ILI9341) 연결하기 (0) | 2024.08.20 |
ESP32 연결 시 포트 인식 못할 때 해결방법 (0) | 2024.08.18 |
ESP32 사용 기초(WIFI, LCD연결) (0) | 2024.08.13 |
#1편-ESP32 활용 온도-습도 알림기 만들기(ILI9341, DHT11활용) (0) | 2024.08.13 |