Hardware Reference
In-Depth Information
The DHT11 communication protocol is slightly complicated. The data pin
is normally at a logical high. To read from the DHT11, the Arduino must pull
this data line down to zero for more than 18 milliseconds (ms) before returning
it to a logical high for 40 μs. As a response, the DHT11 pulls the data line low
for 54 μs and then pulls it high for 80 μs. This is an acknowledgment; it tells
the Arduino that the request has been received and that data will follow. The
DHT11 then sends 5 bytes for a total of 40 bits.
The timing of the data is the complicated part. The difference between a 1
and a zero is the amount of time that the data line remains high; 24 μs means
a zero, and 70 μs means a 1, as shown in Figure 10-2.
+5 V
Bit 1
0
54 μs
24 μs
+5 V
Bit 0
0
54 μs
70 μs
Figure 10-2: DHT11 sending a logical zero and a logical 1
At the end of the communication, the DHT11 pulls the data line back to a
logical high.
Hardware
The hardware coni guration is fairly straightforward. For this, you need an
Arduino Uno. The WiFi shield is socketed on top of the Arduino. The DHT11
will be connected to +5 V and ground, and the data pin will be connected to
digital pin 10. There is also a 10-kilohm pull-up resistor on the data line. Digital
output 13 will also be used to turn on and off the internal LED for status indi-
cation. If the LED is on, then there is a problem with the board. The setup is
shown in Figure 10-3.
 
Search WWH ::




Custom Search