Temperature and humidity are vital data in your lab, kitchen, manufacturing line, office, killer robots, and even your home. If you need to monitor multiple locations or rooms or spaces you need something that is reliable, compact, accurate and affordable. You can buy expensive sensors but if you are monitoring multiple rooms this can cause your expenses to skyrocket. This tutorial will show you how to build these sensors and monitor your data without breaking the bank.
This is a perfect application for a $14 Raspberry Pi Zero WH as this device is compact, inexpensive, powerful, and has built-in WiFi. Here is the list of everything we need per sensor node and the approximate cost:
Raspberry Pi Zero WH ($14)
Micro SD card ($4)
Raspberry Pi power supply ($8)
DHT22 Temperature/Humidity Sensor ($5)
(Optional) Raspberry Pi Zero W case ($6)
The setup for each sensor node is going to cost ~$31 plus shipping, taxes, and the case. You can easily get each item above in bulk to minimize shipping costs with the exception of the Raspberry Pi Zero WH, which may be more challenging outside of the UK. You cannot find a vendor that allows you to purchase more than one Zero per Raspberry Pi Foundation rules.
We are using the $14 Zero WH instead of the $10 Zero W since the Zero WH has the header pre-soldered, which will make our project assembly super quick and easy.
We are using the DHT22 temperature/humidity sensor because of its temperature accuracy (+/- 0.5 °C), humidity range (0–100%), and low cost. We also want something really easy to wire up without having to add a pull-up resistor.
The DHT22 will have three pins that you will need to connect to your Pi Zero WH: 5V, Ground, and data. The power pin on the DHT22 will be labeled ‘+’ or ‘5V’. Connect this to pin 2 (the top right pin, 5V) of the Pi Zero WH. The Ground pin on the DHT22 will be labeled ‘-’ or ‘Gnd’. Connect this to pin 6 (two pins below the 5V pin) on the Pi Zero WH. The remaining pin on the DHT22 is the data pin and will be labeled ‘out’ or ‘s’ or ‘data’. Connect this to one of the GPIO pins on the Zero WH such as GPIO4 (pin 7).
You will need a monitor and keyboard to setup your Pi Zero WH the first time. Once it is setup, you won’t need either a monitor or a keyboard to run when deployed in your space. We want to keep each node as small and compact as possible.
You need to install the standard Raspbian operating system so your Pi Zero WH will boot. You can follow the instructions on Raspberry Pi's website to setup your Pi Zero WH.
Connect your Pi Zero WH to your WiFi network. You can follow the instructions on Raspberry Pi's website to connect your Pi Zero WH to WiFi.
Install the Adafruit DHT Python module on your Pi to make reading DHT22 sensor data super easy. Enter the following in your command prompt:
$ sudo pip install Adafruit_DHT
You now have everything you need to communicate with your sensor. Next, you need a destination for your sensor data so you can turn that data into an awesome dashboard or an SMS/email alert. We will use Initial State for this step of the project.