Sensor Temperatura e Humidade p/ Funduino AM2302/DHT22
€24,95
Adicionar ao Carrinho de Compras- SKU :: FUN-MD0024
- Tipo:: Arduino - Funduino
- Marca:: Funduino
Descrição
O DHT-22 é um dispositivo de baixo custo para medir a humidade e a temperatura. Os sensores DHT têm duas partes. Um sensor de humidade capacitiva e um termometro. O dispositivo precisa de umafonte de alimentação de 3 a 5 V. Utiliza uma única linha de dados para comunicar com o Arduino.Caracteristicas:- Alimentação: 3-5V DC - Consumo: 2.5mA máximo - Humidade de trabalho: 0-100% - Temperatura de Trabalho: -40º a 80ºC (resolução de 0.5ºC) - Dimensões: 27x59x13.5mm - Ligações: PinosSample code:// Example sketch for DHT22 humidity - temperature sensor2 // Written by cactus.io, with thanks to Adafruit for bits of their library. public domain34 #include "cactus_io_DHT22.h"56 #define DHT22_PIN 2 // what pin on the arduino is the DHT22 data line connected to78 // For details on how to hookup the DHT22 sensor to the Arduino then checkout this page9 // http://cactus.io/hookups/sensors/temperature-humidity/dht22/hookup-arduino-to-dht22-temp-humidity-sensor1011 // Initialize DHT sensor for normal 16mhz Arduino.12 DHT22 dht(DHT22_PIN);13 // Note: If you are using a board with a faster processor than 16MHz then you need14 // to declare an instance of the DHT22 using15 // DHT22 dht(DHT22_DATA_PIN, 30);16 // The additional parameter, in this case here is 30 is used to increase the number of17 // cycles transitioning between bits on the data and clock lines. For the18 // Arduino boards that run at 84MHz the value of 30 should be about right.1819 void setup(){20 Serial.begin(9600);21 Serial.println("DHT22 Humidity - Temperature Sensor");22 Serial.println("RHtTemp (C)tTemp (F)tHeat Index (C)tHeat Index (F)");2324 dht.begin();25 }2627 void loop(){28 // Reading temperature or humidity takes about 250 milliseconds!29 // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)30 dht.readHumidity();31 dht.readTemperature();3233 // Check if any reads failed and exit early (to try again).34 if (isnan(dht.humidity) || isnan(dht.temperature_C)) {35 Serial.println("DHT sensor read failure!");36 return;37 }3839 Serial.print(dht.humidity); Serial.print(" %tt");40 Serial.print(dht.temperature_C); Serial.print(" *Ct");41 Serial.print(dht.temperature_F); Serial.print(" *Ft");42 Serial.print(dht.computeHeatIndex_C()); Serial.print(" *Ct");43 Serial.print(dht.computeHeatIndex_F()); Serial.println(" *F");4445 // Wait a few seconds between measurements. The DHT22 should not be read at a higher frequency of46 // about once every 2 seconds. So we add a 3 second delay to cover this.47 delay(3000);48 }