Introduction: Temperature and Humidity LEDs

If you’ve ever wanted a more visual thermometer, this project can help. We’ll be making a set of LEDs that display certain colors based on levels of humidity and temperature.

Step 1: Materials

For this Project You will need:

- 2 RGB LEDs

- DHT11 Temperature and humidity module

- 6 220Ω resistors

-12 breadboard jumpers (wires)

- Arduino UNO R3

- Arduino IDE (for coding)

- DHT Sensor Library (to make your temperature module function)

Step 2: Wiring the Breadboard

Step 3:

You want to set up a proper power supply to each component, so let’s start with the ground and 5 volt connections

Step 4:

Next, let’s set up the temperature sensor. Mine is connected to the 2 pin in the Arduino uno

Step 5:

Finally let’s set up the LEDs. Both have the same wiring and resistor setup. My pins for the LED representing temperature readings are at 3, 5, and 6 while the humidity LED is set at pins 9, 10, and 11

Step 6:

You now have a finished circuit! Let's start working on the code allowing these LEDs to sense temperature.

First, define the pins for your temperature sensor and LEDs according to your pins and include the library for the temperature sensor. To include the library (in our case “DHT” is our needed library), go to the menu bar and select “Sketch> Include Library > Add .ZIP Library” and select the “DHT” ZIP folder from where you downloaded it.

Step 7: Coding

Step 8:

Next, in Void Setup determine the output for both LEDs as well as the serial monitor for your sensor.

Step 9:

In void Loop, write out the function of your serial monitor. This is where you will take temperature and humidity readings from for the loop function later.

Step 10:

Run the Serial monitor by going to the menu bar and selecting “Tools> Serial Monitor”. You should get readings for temperature and humidity. Wait 30 seconds and write down the numbers that appear the most frequently for both temperature and humidity. Now that you have a reading, we can plug in these values for our next segment of code

Step 11:

In order to make our LEDs light up accordingly, we have to write some "else" statements. Take the reading you took for temperature and plug it in to the first set of statements. If the temperature is higher than the value assigned, the light will turn red. Otherwise it will remain blue. The same applies to humidity. If the reading is higher than the value you took, the light turns red. Otherwise it will remain blue.

Step 12: Done!

You now have a your very own temperature and humidity sensing LEDs!