With the DHT11 library, the humidity and temperature sensor DHT11 can be read out via one wire and a microcontroller of the MSP430 series. As microcontroller is used the MSP430G2553 (on the EXP430G2 launchpad) and as a development environment is used the IAR Embedded Workbench.
Download DHT11 library
Schematic EXP430G2 and DHT11
The circuit is quite simple. The DHT11 can tolerate voltages of 3 up to 5.5 V, but since the MSP430 can handle 3.3 V, both ICs are operated with 3.3 V. In addition, a 4.7 kΩ pull-up is required. The complete circuit can be seen in the following figure.
Description DHT11 library
|void DHT11_init (void)|
|Initialization of DHT11, the MSP430 Timer A and GPIO-Pin 1.4 are initialized|
|int DHT11_read (unsigned char *p)|
|Reads a complete packet (humidity, temperature, and CRC checksum) from the DHT11.|
|*p||Array contains the information for temperature and humidity. The array has the following format:
P  = start bit
P  = humidity of the DHT11
P  = humidity (decimal place) of the DHT11
P  = temperature of the DHT11
P  = temperature (decimal place) of the DHT11
P  = CRC check sum of the DHT11
|return||Returns the status of the DHT.
-1: Transmission is faulty
0: Transmission correct
-4: No start bit