Get Values From Temperature-Humidity sensor Using an Arduino
OVERVIEW
CHARACTERISTICS
- Ultra low cost
- 3 to 5.5Vmax power and I/O
- 2.5mA max current use during conversion (while requesting data)
- Good for 20-90% humidity readings with 5% accuracy
- Good for 0-50°C temperature readings ±2°C accuracy
- No more than 1 Hz sampling rate (once every second)
- Body size 15.5mm x 12mm x 5.5mm
- 4 pins with 0.1″ spacing
PIN OUT
The sensor is 4-pin single row pin package. The pin out is as shown below.
POWER:- The sensor can be powered in range 3V-5.5V on pin VCC . A 100nF capacitor added between VCC and GND can filter the power.
DATA:- The data pin gives calibrated digital signal output. You should pull-up the data pin with a 10K resistor.
DATA FORMAT
The sensor and microcontroller communicate each other with a single wire. A complete data transmission is 40bit, and the sensor sends higher data bit first. Data consists of decimal and integral parts . The first 16 bit of the data is relative humidity, next 16 bits consist of temperature and last 8 bits are checksum of relative humidity and temperature. Check the following table.
COMMUNICATION BASICS
You can choose any 8 bit microcontroller of your choice. Here we used to interface with an Arduino Uno. Default the data pin is high because of external hardware pull up. The microcontroller initiates the communication by sending a low voltage level on data line. which lasts minimum of 18ms. The sensor wake up from sleep when detect the start signal and wait for finish the signal. The sensor will send out a low-voltage-level response signal, which lasts 80us, then pulls the data line high for next 80us. The stream of 40 bits start with bit interval of 50us low pulse. Width of high voltage level signal determines whether data bit is “0” or “1” .
0 –> 26 – 28us
1 –> 70us
The communication process is as shown below.
When the last bit data is transmitted, DHT11 pulls down the voltage level and keeps it for 50us. Then the Single-Bus voltage will be pulled up by the resistor to set it back to the free status.
Hardware Interface with Arduino
Once you finished hardware, download the zip file, adafruits DHTxx library with an example sketch from github. Add the library Sketch>Import Library>Add Library. Now load up the Examples->DHT->DHTtester sketch. Power up the hardware and upload the sketch on arduino after selecting proper com port and device from tools. Open the serial monitor or any other terminal, you can see the output as shown below.
Reference
Shop with us
Leave a Reply
You must be logged in to post a comment.