Introduction: Arduino LED Thermometer

This is my first project using an Arduino Uno as well as posting it on Instructables. I will do my best to make this instructable as clear and and to the point as possible.

I wanted to take a household object and add a temperature and LED sensor that would change the brightness of the LEDs as the temperature in the room changes.

To start here is a list of supplies I used:

Clear LEDs(x6) Link1:mouser.com(price per LED $0.24) Link2:amazon.com(Price for pack of 25 LEDs $5.50)

1K OHM Resistor(x6) Link1:amazon.com If you plan on doing other projects involving circuit boards I would suggest just purchasing a resistor and capacitor book from adafruit.com

Blank circuit board for final product Link:amazon.com

Solid Core Wire Link:amazon.com Its a good idea to use different colors for the Ground Wire (negative and commonly marked by black wire) and the Positive Wire (marked with red wire).

9v battery Can be found in most stores Target, Walmart and Radioshack but here is a link if you would rather order them. Link:amazon.com and also a case for the battery(optional) Link:amazon.com

Breadboard(optional) Link:adafruit.com A breadboard is used for testing a circuit without the need for soldering.

Soldering Iron and solder Link:amazon.com Short Tutorial on soldering:Soldering

Glass Jar Link:hobbylobby.com

Spray Paint Link:lowes.com Used to frost over the glass jar

Now for the more important components.

Multimeter Link:amazon.com Very useful tool, used for lots of different task a few being; testing to make sure your connection is getting power, can read the value of resistors and read the voltage left in a 9v battery and much more.

Arduino Uno Link:Arduino (link also up top) Cable amazon.comfor Arduino Link:

DHT22 Temperature/Humidity Sensor Link:adafruit.com I choose not to implement humidity in this project however you can have the LEDs change as the humidity changes the same way as they do for the temperature, which will be explained in the code later on. Adafruit also sells a wired sensor with a resistor built in. I originally used that sensor but ran into overheating issues.

Step 1: Set-up DHT22 Sensor

If you went with the wired sensor you can skip this step.

If you didn't then you will need to solder the resistor that came with the DHT22 from adafruit. As it states on their site you will need to bridge the Positive wire and the Data wire together using the resistor. For more info visit their site here. While there you will also need to download the library for the sensor that way your Arduino will recognize the sensor in the code, there will be a link to the library on the code step.

Step 2: Time to Code

You will first need to download the library for the sensor so the Arduino knows how to read it, you can find that here as well as the data sheet which gives you more information about the DHT22 sensor. Make sure to follow the directions carefully on how to install the library, it can be a bit tricky if you are new to Arduino.

The LEDs are connected to the 3,5,6,9,10 and 11 pins because those pins are Pulse Width Modulation, or PWM pins. which simply means they can handle fading or flickering of LEDs.

I used the sample test code and simply added LED pins and an if/else value to change the brightness of the LEDs.

For example: if(float f = dht.readTemperature(true) >80)

{Serial.println("LED is On"); analogWrite(ledPin, 255); } else { analogWrite(ledPin,64);

So basically all that line is saying is 1. take a reading from the sensor 2. if the temp is over 80* then print LED is on 3. when LED is on analogWrite the ledPin to 255 which is max brightness 4. if temp is not 80* then it drops down to 64 brightness. Here is a link to a helpful guide for Arduino coding.

You can set the temperature to whatever you would like as long as it is in the range of the DHT 22 sensor. Here is a quick overview of what the sensors range is.

If you run into any issue with the sensor make sure you including the library you just downloaded. It needs to be the first thing in your code along with any other libraries you choose to add. It should look like this: #include "DHT.h"

You can name the Library whatever you want but try to keep it simple that way its easy to remember and if its simple it will be less likely to cause errors in your code.

After you verify the code and have no errors click upload, the lights will flash for a second as the board restarts. The Arduino stores the last uploaded code so once you are happy with our code you can unplug your board so you can begin connecting the circuit board to your Arduino. You will need a 9v battery with the barrel plug to power your board inside the jar.

Step 3: Breadboard

Time to test the code using the breadboard. Make sure you use the same color LEDs in the picture above I did not and ran into a few issues.

The other image shows the difference in using all the same LEDs, I know that is the wired sensor but all the wires go to the same ports that was before I burnt it out.

You will want to make sure that you match the negative leg of the LEDs to the negative row on the breadboard. The negative leg (cathode) of the LED is the leg of the flat piece inside the LED. For help on polarities of LEDs click here. The other leg of the LED, positive (anode), will need to be on the same row as the resistor and were the wire connects to the board.

Step 4: Soldering to Your Board.

Make sure that the polarities on the LEDs are matched up the correct. If they get switched then they will not light up and you will have to desolder them and turn them around. If you are not sure use your multimeter. Here is a quick video showing the multimeter. After you solder all the components into place you need to connect all the ground (negative) pins of the LEDs together as well as solder the negative wire for the sensor on the same row. The sensors positive (red) wire and the yellow data need to be solder on the board where there is room for another red and yellow wire to be soldered. You can just plug the red and yellow wire directly into the Arduino if you would like. Or you can add two more wires that way the sensor is soldered to the circuit board and the other wire connect to the sensor wires on the board and also to the Arduino. Make sure you DO NOT solder the positive and negative pins to of the LEDs together otherwise the circuit will not work. I left an extra hole on the board between the two legs just to be safe.

Step 5: Connecting to the Arduino

Now just connect all of your data pins from your positive side of the LEDs, the side with your resistors, to their respective pins in the code, as well as the data pin for the sensor. Make sure you connect the ground wire to the ground pin on the Arduino and the red positive wire to the 5v pin on the board.

Connect your battery and test it out. Here is what mine looks like. I just blow lightly on the sensor to change the temperature quickly.

I also added a thin piece of cardboard behind the Arduino so the solder points from the board don't short anything out. I just took some scrap wire and poked holes through the cardboard where the holes on the Arduino are and made a twisty tie to hold everything together.

Step 6: Painting the Jar

Basic step just put some paper down and start spraying. Takes only a few minutes to dry. I added 3 coats just to make it harder to see into the jar. I only painted the outside.

Step 7:

Update: I ended up having to change the where the sensor went. With it being inside the jar and the glass being an insulator the sensor did not pick up the change in temp.