Hello, world! If someone were to ask you what the temperature is today, you would probably be able to tell them by looking at either your phone or a window thermometer. In fact, you would probably do so with no thought regarding how the temperature got on your screen. Thermometers are great and very inexpensive to have around, but how many people in this world can honestly say they have built one from scratch? By following these five steps, you could have a functional digital window thermometer up and running in less than an hour.
Before you begin this project, you should know that some soldering is needed, along with wire trimming and tinning, and a little familiarity with reading datasheets. If none of those is a problem, then you should be ready to get started!
Step 1: Gather Parts
First, take a visit to the Internet or your local electronics store and buy these parts (I already did some price shopping for you):
1. Arduino Uno; $7 from http://www.gearbest.com/development-boards/pp_6297...
2. 16X2 LCD; $3 from http://www.ebay.com/itm/like/121305691745?lpid=82&...
3. TMP36 Sensor; $1.50 from https://www.sparkfun.com/products/10988
4. Solderless breadboard; $2 from http://www.gearbest.com/development-boards/pp_2252...
5. 10k ohm trim potentiometer; $1 from https://www.sparkfun.com/products/9806
6. Various connecting wires and data cables (at least 6 inches long); not worth buying online because they are easily found in old electronics.
7. Soldering Iron and solder; $12 from http://www.amazon.com/60-Watts-Soldering-Iron-list...
8. Scalpel; If you don't have one, just use a knife.
9. The Arduino IDE; free from http://www.arduino.cc/en/Main/Software
10. *OPTIONAL* Cardboard, glue and construction paper for outer shell
Total: $26 for everything. If that still sounds like way too much to be spending on a thermometer, remember: all of these parts can be reused for thousands of separate projects you may want to make in the future.
Step 2: Extend the Sensor's Reach
Now that you have all the parts, it's time to start building. Since the sensor needs to be outside and the Arduino board inside, you will need a way to keep the connection through a window. I have found that old data cables work considerably well for smashing, so that's what we'll use.
1) Cut three wires at least 6 inches in length from your data cable, but make sure you include the red wire; it will make the job of putting it all together much easier.
2) Use your scalpel to separate the wires, and then cut approximately 1/8" of the covering off of both ends (It's important that you don't cut the wires too long, because then they will not insert easily into the breadboard).
3) Tin both ends of the wires, and solder the temperature sensor to one end. The TMP36 is directional, so make sure not to connect it backward or it will heat up and possibly explode. With the flat face of the sensor facing you, solder the pins from left to right to the data cable, red wire first, respectively.
4) Isolate the connections by taping them individually, and then taping them all together. If you're having trouble with the small spaces, use your scalpel to cut thin strips from your electrical tape, and try with those.
Congratulations! You have successfully extended your sensor! Keep it handy, because you will use it in the next step.
Step 3: Connect the LCD and Sensor to the Arduino Board
On to the display! LCDs can seem a little complicated to connect at first, but they are actually fairly easy to understand once you have done it a couple times. For the record, I am using a 14-pin LCD in this instructable, but the connections are all the same except for the missing two pins, which power a backlight; the instructions below are for a 16-pin LCD anyways. You can follow the diagram included in the gallery, or do it picture by picture. Plug all power (5V and GND) lines into the solderless breadboard first, and then connect them to the LCD.
Helpful Tip: When using a lot of wires, color coding is very helpful.
For the LCD Novices:
1) First, follow the 5 volt line on the diagram and connect anything that needs a straight 5 volts. This should only include the 15th and the second LCD pin.
2) Insert the 10k ohm potentiometer into the breadboard so that it is connected to 5V on one side and Ground on the other. It doesn't matter which side is which, so pick one and go with it.
3) Connect the middle pin of the potentiometer to the third pin of the LCD. This will be used to configure the contrast.
4) Pins 1, 5, and 16 of your LCD all go to ground. Make it so.
5) The fourth and sixth LCD pins need to connect to pins 4 and 5 of the Arduino board, respectively.
6) You're done with the hard part! The only thing left to do is connect Arduino pins 6-9 to the LCD pins 11-14, in order from least to greatest (6 goes to 11, 7 goes to 12, etc.).
7) Test the LCD.
Download and run the sketch I included in this step, or simply run one of the example codes included in the Arduino download package.
If it works, you should see "hello world" printed on the screen. If your screen is too dark or to faded, adjust the potentiometer until the words look alright.
It's time to return to that TMP36 apparatus from step 2! Connecting it is simple: the red wire goes to 5V, middle wire to pin A0 on the Arduino, and the last one goes to ground. That's it!
Step 4: Upload the Code
The hardware has now been completely assembled, but there is still one vital part missing from all this... the code. I attached the sketch for downloading, but the picture above is a snapshot of it. Feel free to modify, copy, or borrow any elements of my sketch for your personal use.
Make sure to test the code and work out kinks after you've uploaded the sketch, too. Debugging sucks, but it's too important a step to leave out.
Step 5: Installation
There it is: a completely assembled digital thermometer. It works alright, but what ever happened to reading the outside temperature? Well, that's where the long data cable comes in. Open the window of your choice and place the sensor on the other side, along with about half of the wire. Close the window, but make sure that there is enough wire to keep the sensor from being pinched by the window. When the window is closed, the top of the sensor should be about an inch above the frame.
The purpose of this instructable is to build the guts of a thermometer display. If you want to be done, stop here, plug the Arduino into a power source and enjoy an accurate temperature reading. As you can see above, I used some tacky-tack and an empty peanut container to jimmy-rig my display for easier reading. If, perchance, this isn't to your taste, you could make a beautiful shell out of cardboard to make it look snazzy. Now you know how to create a raw digital thermometer; go and make it yours. Don't forget to vote if you like what you see!