Quick Arduino Hygrometer with OLED display
We have been having some condensation and mould issues in our apartment recently due to, I think, the humidity levels. Our property is relatively newly built and, as such, has very good insulation properties (double glazed windows etc.). The side effect of this is that there is very little ventilation and therefore humidity rises over a period of time and water then condensates on windows causing puddles on the sills and mould in dark, cool corners.
Our solution to this problem was to buy a dehumidifier (pictured), however I would still like to know what the relative humidity in the room is (the target is between 40%RH and 50%RH) and thus the need for a hygrometer. I could of course have bought one, but having an Arduino and OLED display to hand I thought I would make one (obviously!).
Step 1: Design & Assembly
The design is dead simple. As I said, I had an Arduino and an OLED display to hand so all I needed was a humidity sensor which I picked up on eBay for ~£3. The full parts list is as follows:
- Arduino Leonardo Pro Micro (clone)
- Adafruit SSD1306 0.96″ OLED Display
- DHT11 Digital Temperature and Humidity Sensor
- USB cable and mobile phone charger or similar to power it all
The schematic shows how the various components were connected together and the picture show how they were arranged on a breadboard.
Step 2: Software
The code was created using the Arduino IDE and is attached. I created my own class for communicating with DHT11 sensor (which has it own particular protocol) and used the Adafruit and Wire libraries to communicate with the display which uses the I2C protocol.
The design is very simple indeed. The setup() function quite literally sets up the display. The loop() function then reads the temperature and humidity values from the sensor and prints them on the display via the displayData() function. If an error occurs when reading data from the sensor then it is displayed via the displayError() function.
Read more: Quick Arduino Hygrometer with OLED display