Sunny and Warm
An Arduino sensor, a Raspberry Pi, and a Python program help a budding naturalist keep tabs on the conditions in his snake's terrarium.
An Arduino sensor, a Raspberry Pi, and a Python program help a budding naturalist keep tabs on the conditions in his snake's terrarium.
At the end of the last school semester, one of my young friends was allowed to purchase a pet snake (Figure 1). Because snakes are very sensitive to temperature and humidity variations, he wanted a cool way to keep an eye on what was happening inside his terrarium. "You have to push buttons on the old one to switch between temperature and humidity," he explained, which meant he had to reach into the terrarium periodically to check the conditions. To improve his setup, I hooked an Arduino sensor to a Raspberry Pi and wrote a graphing temperature/humidity logger that displays the conditions of the snake's habitat on a monitor.
The temperature/humidity (T/H) sensor is a DHT11 [1] that I purchased from my local electronics outlet. This particular module is installed on a carrier board (Figure 2), so the required pull-up resistors and electrical interface are already provided.
The DHT11 uses a single data line both to receive commands and to transmit data; this line was connected to one of the GPIO pins. To talk with the sensor, the Raspberry Pi sets the GPIO line as an output and then has to pull the data line to ground (low logic state). After waiting 50 microseconds, the Rasp Pi releases the data line and then switches the GPIO pin to input (high logic state). The sensor then transmits its data. Short pulses are a binary 0 and long pulses are a binary 1. Once 40 bits are received, the data packet is complete.
[...]
Pages: 7
Price $15.99
(incl. VAT)