목차
특징
- Model : DHT11
- Power supply : 3 ~ 5.5V
- Output signal : digital signal via single-bus
- Sensing element : Polymer resistor
- Measuring range : humidity 20-90%RH; temperature 0-50 Celsius
- Accuracy : humidity +-4%RH (Max +-5%RH); temperature +-2.0Celsius
- Resolution orsensitivity : humidity 1%RH; temperature 0.1Celsius
- Repeatability : humidity +-1%RH; temperature +-1Celsius
- Humidity hysteresis : +-1%RH
- Long-term Stability : +-0.5%RH/year
- Sensing period : Average: 2s
- Interchangeability : fully interchangeable
- Dimensions size : 12*15.5*5.5mm
사이즈
데이터시트
WAT-Arduino128 에 연결
부품 목록
번호 | 부품명 | 수량 | 기능 | 판매처 |
---|---|---|---|---|
1 | WAT-Arduino128 | 1 | 아두이노 | https://kit128.com/goods/view?no=64 |
2 | DHT11 – 디지털온습도 센서 | 1 | 온습도 측정 | https://kit128.com/goods/view?no=72 |
WAT-Arduino128 | DHT11 – 디지털온습도 센서 |
---|---|
|
|
핀 연결
아래와 같이 DHT11 모듈을 WAT-Arduino128 핀을 연결합니다.
DHT11 는 3번핀을 사용하지 않습니다.
DHT11 핀 | WAT-Arduino128 핀 |
---|---|
VCC | 5V |
DATA | PB5 ( 예제에서는 PB5를 사용했고 다른 I/O 핀을 사용해도 상관 없음) |
NC | 연결하지 않음 |
GND | GND |
소스코드
최신 소스코드는 [파일]=>[예제]=> [WhiteAT UNO]=> [Starter] => [13_DHT11] 에 있으며
라이브러리는 아두이노 개발환경 (https://docs.whiteat.com/?page_id=5449)을 참조하세요
아두이노 우노 R3용 예제는 https://docs.whiteat.com/?p=2294 를 참조하세요
/* DHT11 센서로 온도와 습도를 출력하는 예제입니다. 출처: http://whiteat.com/Arduino */ #include <DHT11.h> int DHT_DATA_PIN = PB5; Dht11 dht11(DHT_DATA_PIN); int err; float temp, humi; // 프로그램 초기화 void setup() { Serial.begin(115200); // 시리얼 통신 초기화 Serial.print("Dht11 Lib version "); Serial.println(Dht11::VERSION); } // 계속 실행할 무한 루프 void loop() { if ((err = dht11.read(humi, temp)) == 0) { Serial.print("Humidity (%): "); Serial.println(humi); Serial.print("Temperature (C): "); Serial.println(temp); } else { Serial.println(); Serial.print("Error No :"); Serial.print(err); Serial.println(); } delay(DHT11_RETRY_DELAY); }
결과 – 디버깅 화면
static Dht11 sensor(DHT_DATA_PIN);
이 부분에서 아래의 오류가 뜨는데…뭔가 문제인지 고민중입니다.. ㅠㅠ
exit status 1
no matching function for call to ‘Dht11::Dht11(int)’
안녕하세요
화이트앳입니다.
(최신코드로) 아두이노 우노 R3 예제를 따로 정리해 두었습니다.
https://docs.whiteat.com/?p=2294 참조하세요.~
감사합니다.