In this project I will show you how to create a portable Arduino temperature indicator. The point of this project is to teach you basic Arduino skills and how to write relatively complex code in the Arduino IDE language.
So what is an Arduino?
An Arduino is a small, cheap and portable micro controller that allows anyone to make interactive, useful and amazing products very easily.
How do they work?
Take the Arduino Uno for example, It uses a chip in the middle of the board called an ATmega 328 that has the ROM, RAM and memory all in one. Then the rest of the board 'ports out' the pins and allows you to connect Input and Output devices such as an LED or a push button.
What is the purpose of this project?
This project can be used as a simple temperature display that for every 5 degree increase another LED lights up as I will show you or it could be changed and modified into a more complex project than could become a smart thermostat by using an xbee and another arduino wired into your boiler. Or even better it could be used as a networked device in a home automation system. I may do another Instructable on this.
Why should I follow your tutorial?
Ever since I was very young I have been fascinated by electronics and how electronic devices work, I spent hours coming up with my own projects and couldn't really find any good tutorials out there for beginners so I decided I would make some to help others who are like me.
What you will need for this project:
An Arduino Uno (Can be bought here)
6x Red LED's (Can be bought here)
6x 330 or 220 ohm resistors (pick 220 ohm if you want the LED's to be bright, or the 330 ohm resistors if you want the LED's to be dimmer)(Can be bought here)
A TMP36 Temperature sensor (Can be bought here)
A 9v battery to barrel cable (Can be bought here)
A 9v battery (from any local shop)
An enclosure for the project (I made my own wooden container)
Step 1: Preparing to Build the Circuit
Firstly you need to connect all of the components to the Arduino, To do this you can use a breadboard (image above) which allows you to connect everything together without soldering anything to test that all of your components work and the circuit is correct, or go straight to soldering everything together. But for this tutorial I will show you both steps. Feel free to skip ahead to the third step if you wish.
Step 2: Writing the Code
Now I have showed you what you need and how to get started I need to show you how to write the code for the project so we can test out our circuits in the next steps. Firstly download the attached file. Now make sure you have the Arduino IDE installed on your computer, if not you can download it from the official site here. Now launch the file and have a look around, an Arduino IDE program is set out very simply. At the top you declare all of the pins and their set names, then you have the 'void setup' that has all of the starting scripts and set values such as getting data from a button and then setting it as a variable. The last section is the 'void loop', this is the main repeating part of the script, for our code this checks the value from the TMP36 and then turns on a set number of LED's based on the temperature. Now just plug in your Arduino and follow the guide on the arduino.cc website on how to get setup. Finally hit the compile and upload button at the top of the program and wait for it to upload! Now you can build the circuit.
Step 3: Making the Breadboard Circuit
Firstly grab all of the components, an Arduino Uno and a breadboard. Now simply follow the schematics above to complete the circuit. I would write out the instructions but it would be less accurate and it is far clearer to use an image. Just a couple of tips:
Connect the longer end of each LED to the power (red) rail and the shorter end to the ground (blue or black) rail.
Make sure the TMP36 is the right way round (top of the flat side is the power pin)
And lastly make sure you connect the LED's in the right order otherwise the temperature gauge will mean nothing!
Now you hopefully have a complete circuit and you are now ready to write the code and upload it!
Step 4: Transferring Your Breadboard Circuit Into a Permanent Circuit
In the last step you made a prototype circuit on a breadboard but now before we can finalize the project and put it in a box we need to solder all of the components together on a sheet of perf board. Firstly take your breadboard and get a sheet of perf board (pictured above). Firstly look at the rows on the perf board, it is the exact same layout as your breadboard. Now pull out all of the wires from the breadboard so only the components are left, now place the two pieces next to each other and slowly start pulling out and placing each component in to the perf board. Just to point out you may want to connect wires to the TMP36 sensor and connect it directly to the Arduino rather than just soldering it to the board as it may not give you enoughjm . Once you have finished this flip the board making sure no components fall out and start to solder in every pin to the other correct component, Finally solder from the positive pins on each LED to connect to the arduino and the pins on the TMP36 sensor 5V, Ground and the middle data pin. Now connect the positive wires from the leds to the Arduino's correct pins and the TMP36 data pin to A0. You may want to run the code again just to test that the circuit still works. Thats it, now you are ready to make a case for it
Step 5: Put It All in a Box
Now you have a fully working circuit soldered to a sheet of perf board and now you need to make a case for it all. To do this I am making my own wooden box but if you want you can also use a plastic container such as these from Maplins, RadioShack, Amazon or generally any local hobby shop. I am not going to show you how to make a box as that would be a whole differant tutorial but I am assuming if you are making your own over buying one you know what you are doing. All you need to do is drill six holes in the top of the box and then hot glue the LED's in. You may also want to add a switch to turn the circuit on and off, this can be accomplished by cutting the black wire of the battery adapter and soldering each end to a switch and then drilling and hot glueing it in.
Step 6: You've Done It!
That is it, you have done it! Please post pictures of your completed projects below and I cant wait for your comments. Please feel free to ask me any questions about this Instructable and I hope your Arduino portable temperature display works well. But if you have any problems have a look at my troubleshooting page or ask me in the comments below.
Step 7: Troubleshooting
If your Arduino portable temperature display doesn't work then these few tips should solve it:
1: Check all of the connections are correct, it is very easy to simply cross two wires or solder two things the wrong way round. Look at the schematics on step three to check.
2: Re download the code and re upload it to the Arduino, sometimes it doesn't always upload correctly or the file downloads wrongly.
3: Check all of your parts are not faulty, you did this by making the breadboard circuit in step three but one of those components may of broken during the soldering process. This can be checked by using a multimeter or simply swapping out parts and testing.
4: Is your arduino working, have you checked it isn't your Arduino. Check your Arduino is working by disconnecting your built circuit and connect an LED to the ground and pin 13, then upload the blink example in the Arduino IDE software.
5: If none of these have worked please comment below and I will try my best to help.