Difference between revisions of "DHT"

From Ethersex_Wiki
Jump to: navigation, search
Line 79: Line 79:
 
== [[ECMD]] ==
 
== [[ECMD]] ==
  
IRMP implements an [[ECMD]] interface for reading humidity and temperature values. See [[ECMD_Reference|ECMD reference]].
+
DHT implements an [[ECMD]] interface for reading humidity and temperature values. See [[ECMD_Reference|ECMD reference]].
  
 
== [[Control6|Control6]] ==
 
== [[Control6|Control6]] ==
  
 
[[Category:Sensors]]
 
[[Category:Sensors]]

Revision as of 07:40, 5 March 2013

DHT
Status
Experimental
menuconfig I/O->Humidity & temperature sensors->DHT 11/22
Pinning yes
Ecmd yes
Control6 no
Code https://github.com/ethersex/ethersex/tree/master/hardware/dht

DHT11/DHT21/DHT22 etc. Temperature & Humidity sensors

These sensors are very basic and slow, but are great for hobbyists who want to do some basic data logging. The DHT sensors are made of two parts, a capacitive humidity sensor and a thermistor. There is also a very basic chip inside that does some analog to digital conversion and spits out a digital signal with the temperature and humidity.

DHT11 vs DHT22

There are two versions of the DHT sensor available, they look a bit similar and have the same pinout, but have different characteristics. Here are the specs:

DHT11

  • Ultra low cost
  • 3 to 5V power and I/O
  • 2.5mA max current use during conversion (while requesting data)
  • Good for 20-80% 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

DHT22

  • Low cost
  • 3 to 5V power and I/O
  • 2.5mA max current use during conversion (while requesting data)
  • Good for 0-100% humidity readings with 2-5% accuracy
  • Good for -40 to 125°C temperature readings ±0.5°C accuracy
  • No more than 0.5 Hz sampling rate (once every 2 seconds)
  • Body size 15.1mm x 25mm x 7.7mm
  • 4 pins with 0.1" spacing

Connection

Likewise, it is fairly easy to connect up to the DHT sensors. They have four pins

  1. VCC (3 to 5V power)
  2. Data out
  3. Not connected
  4. Ground

Simply ignore pin 3, it is not used. You will want to place a 10K resistor between VCC and the data pin, to act as a medium-strength pull up on the data line.

The data out can be connected to any port pin of the ATmega, i.e. PA0 as listed in the pinning example:

ifdef(`conf_DHT', `dnl
  pin(DHT, PA0, INPUT)
')

Configuration

Ethersex polls the sensors every n seconds. The advantage of this feature is that the reading opererates without any noticeable lags. Also it is easier to have multiple applications requesting sensor information since more request will not increase traffic.

 | | I/O  --->
 ...
 [*] Humidity & temperature sensors  --->
 ...
 [*] DHT 11/22  --->
 | |    (DHT11) Sensor type
 | |    (30) Time between polling in 1s steps
 | |    --- Debugging Flags
 | |    [*] DHT       

ECMD

DHT implements an ECMD interface for reading humidity and temperature values. See ECMD reference.

Control6