Fireduino/Fireduino Temperature and humidty collector

来自Firefly wiki
跳转至: 导航搜索

DHT22 temperature and humidity sensor

   This paper describes how to use DHT22 temperature and humidity sensors on the Fireduino to achieve temperature and humidity acquisition.
   DHT22 is single bus digital sensors,temperature measuring range:-40℃--80℃,measuring accuracy:0.5℃.Humidity measurement range:0--100%RH,measurement accuracy:2%RH,resolution:16位.

Fireduino and DHT22 sensor connection

   DHT22 can use 3.3V or 5.0V power supply,you can easily on the Arduino board 3.3V or 5.0V on the interface to take power.
   The hardware connection is very simple,only need to connect the DHT22 sensor and the PIN5 pin.

Prepare DHT22 sensor support library

   Read the sensor has packaging good library,the download link:
   After download,extract the libraries directory of the arduino.

Example explanation

#include <dht.h>       //Include the header file
dht DHT;               //Define the dht sensor object
#define DHT22_PIN 5    //According to the connection situation of the dht sensor signal to determine
//Read DHT22 sensor
int chk = DHT.read22(DHT22_PIN);
//Read to the sensor data,output to the serial port
Serial.print(DHT.humidity, 1);
Serial.print(DHT.temperature, 1);