DHT22·Î ¾Ë·ÁÁø AM2302±â¹ÝÀÇ ¿Â½Àµµ ÃøÁ¤¼¾¼ÀÔ´Ï´Ù. µðÁöÅÐ ¼± 1°³¿Í Àü¿ø¼± 2°³¸¦ ÅëÇØ »ç¿ëÇÏ¿© Á¤¹ÐÇÑ °ªÀÇ ¿Âµµ, ½Àµµ¸¦ ÃøÁ¤ÇÒ ¼ö ÀÖ½À´Ï´Ù.
AM2302 ȣȯ ¼¾¼·Î µ¿ÀÛ ¹æ½ÄÀº µ¿ÀÏÇϳª, ½æ³×ÀÏ À̹ÌÁö¿Í ÇüÅ°¡ ´Ù¸¦ ¼ö ÀÖ½À´Ï´Ù.
»ç¿ë¿¹Á¦´Â ¾Æ·¡ÀÇ ¸µÅ©¸¦ Âü°íÇØÁÖ¼¼¿ä.
AM2302 ¿Â½Àµµ ¼¾¼
µðÁöÅÐ ÀÎÅÍÆäÀ̽º
ÀÛµ¿Àü¾Ð 3.3 ~ 5.5V
½Àµµ¹üÀ§ 0~100% (»ó´ë½Àµµ RH)
¿Âµµ¹üÀ§ -40~80¡É
Á¤¹Ðµµ ½Àµµ ¡¾2%, ¿Âµµ ¡¾0.5¡É
ÃøÁ¤´ÜÀ§ ½Àµµ 0.1%, ¿Âµµ 0.1¡É
Å©±â 15 x 7.5 x 25 (ÇɺκРÁ¦¿Ü)
#include "DHT.h"
#define DHTPIN 2 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
int maxHum = 60;
int maxTemp = 40;
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
// Wait a few seconds between measurements.
delay(1000);
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius
float t = dht.readTemperature();
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C ");
}