Overview

This project uses a DHT11 temperature and humidity sensor and an LDR to measure humidity, temperature and light levels and display the values on an LCD.

You can set this up in your home to measure temperature, humidity and light.

Details

A DHT11 temperature and humidity sensor and an LDR are used to measure temperature, humidity and light respectively. The values are sent to the Arduino which then displays them on the LCD.

 

Components You’ll need

Here are the components you’ll need for this project

  • Arduino Uno
  • LDR
  • DHT11 Temperature and humidity sensor
  • LCD with I2C backpack (I2C backpack not required)
  • Solderless Breadboard
  • 10k potentiometer
  • A number of male to male jumpers

If you live in Ghana, you can get these components from Invent Electronics. If you live elsewhere, look for an electronics or hobby store near you.

 

Schematic 

Here is a breadboard circuit of the project designed in Fritzing.

We are going to be using the LCD in the I2C mode with the I2C backpack connected. You will have to install the LDC I2C library if you haven’t done so already or if  you don’t know how to do that, check out this I2C LCD backpack tutorial that I wrote before proceeding.

NOTE: If your DHT11 sensor comes on a breakout board with only 3 pins, connect the 1st pin to VCC, the middle pin to your Arduino digital input and the last pin to ground and ignore the 1k resistor as shown in the Fritzing circuit.

If your LDR also comes on a breakout board with 3 pins, you won’t need the potentiometer shown on the Fritzing diagram. Just connect the pins to the appropriate Arduino pins as indicated on the breakout board.

   

Arduino Code

In order to use the DHT11 temperature and humidity sensor with an Arduino, you will have to download and install a DHT11 library. In this tutorial, I use Adafruit’s DHT library. Download the DHT11 Arduino library from Adafruit and the Adafruit Sensor library and extract it into your Arduino libraries folder.  Check out this Sparkfun tutorial on how to install an Arduino library if you don’t know how to do so already.

Here is the code for the project

Here’s how the final project looks like. If all goes well, you should have something like this.

 

So, that’s it!

I hope you enjoyed this tutorial. Please leave a comment. The feedback gives me a lot of motivation to do more tutorials.