Raspberry Pi: Measuring temperature and humidity

If you want to measure and record humidity and temperature, you can use a Raspberry Pi with an SHT21 sensor. Here the construction and the mode of operation is shown.

SHT21 at RaspberryPi
SHT21 at RaspberryPi
The heart of the project is the SHT21 sensorwhich can measure both temperature (from -20 to +127°C) and humidity (from 0 to 100%). The 13,- Euro expensive component is connected via the GPIO pins of the Raspberry Pi, the data is transferred via i2c (the corresponding driver must be loaded). As a basis I use Raspbian, but in principle it would also work with any other Linux. To get started, you have to download the software for the SHT21 sensor necessary: these are available as Example program on the emsystech website.

The sample program can be used to start using the SHT21 directly. Background in my case: in some rooms there has been mould growth in the past, which is favoured by too high humidity and low temperatures. So first of all I wanted to determine how long ventilation has to be carried out so that the humidity drops significantly and does not immediately return to its original values.

SHT21: Temperature & humidity evaluated Raspberry Pi
SHT21: Temperature & humidity evaluated Raspberry Pi
Even with the very simple evaluation it is possible to see how temperature and humidity have developed over a period of 9 hours. If you want more flexibility, it is a good idea to write the data not in a CSV file but in a SQL database - from a certain amount of data this should be easier from the resources than reading a large CSV file. Extensions of the script could be e.g. that a mail is sent when reaching or falling below certain limits or any other action is triggered - the possibilities are hardly limited here.

Conclusion SHT21 & Raspberry Pi

The SHT21 breakout board can be put into operation without any effort, the example application of emsystech.de is already sufficient for a first useful use. If you want to log the temperature and humidity in rooms, you will find a favourable solution here, which also opens up many more possibilities. I will consider which other possibilities are available for my purposes - e.g. automatic ventilation when certain limits are reached (I am open for ideas).

Leave a Reply

Your email address will not be published. Required fields are marked *