loading
Welcome to my first instructable! 

Here you'll find all the information on how to build an automatic thermal imager using off-the-shelf parts. This project can help you identify static areas that need insulation from cold weather or find hotspots that needs shielding. While you won't get live pictures or see ghosts in a dark room, you will be able to detect slow heat changes on surfaces. 

After this project is done for little $, you can scan a wall or windows to identify areas of improvement. 

My ambition to create this project is from nasty New England weather and home energy efficiency. I have some bad windows and walls that need identifying for improvements and I didn't want to spend $$$ on a tool or to rent one. The thermal image I was looking for doesn't need to be live or fast, but it does need to provide an image of the surface to identify areas that are cold. 
While running around with a single point IR might be enough, I wanted to see a map of the surface to see the extent and spread of the cold area. 






Step 1: Materials Needed

Software:
Arduino programing/flashing tools
Processing programming tools (http://processing.org/ )

Here's what I used to make it:
*Arduino Duemilanove
*Wire for pin connections
*ZyTemp IR module (Harbor Freight Cen-tech for $9 on sale) (http://www.zytemp.com/products/tn205.asp)
*2x Servo
*coat hanger wire
*small amount of wood
*broken HDD
*18 gauge steel wire

Tools:
*soldering iron + solder
*screw driver
*drill
*saw

Step 2: Hardware Setup - Electronics

First you need to get the hardware all set up. I used an old IDE connector and stripped out the pins for an easy connector, but anything will work fine. My only reason was to make it quickly removal and neat. 

Pictures describe best, but here's a text breakdown:

pin 9/10 are servo Pan/tilt connections
pin 2 is IR clock
pin 12 is IR data

Servo connection:
wire servo 1 white (pwm pos.) wire to pin 9, red to 5V and black to ground
wire servo 2 white wire to pin 10, red to 5V and black to ground

IR module (http://www.metrisinst.com/item_management/assets/files/TN9_UserManual_009.pdf):
wire IR data (pin D on module) to pin 12
wire IR clock (pin C on module) to pin 2
wire IR power (pin V on module) to diode from 3.3V supply
wire IR ground (pin G on module) to ground
(laser pointer versions -- solder a wire from V to the laser pos wire to have that on when measuring)
Remove the battery from the module!

Now you'r electronics are all set up and ready to be placed somewhere. 

Step 3: Hardware Setup - Mechanical

Making a pan/tilt platform is a bit more of a complicated step. You can search online for many types/ideas but most of them are directly linked on the servo. I wanted one that didn't put much stress on the servo internals so I built a custom one. 

Tilt platform: 
I used 2 blocks that are about 1"x1" for the pivot points which are nailed to a thin piece of MDF.
The pivot mechanism is a coat hanger wire that was bent into position. It looks like a 'U' with wings... see second image. The U part is where the sensor is banded onto it and keeps the sensor aligned while moving. The link to the servo on this rod looks like an L shape that has a arm connecting the link and servo together, I used a light weight steel rod that's strong enough for pushing but can be bent to align the 90deg mark.

Pan platform:
The platform of this is a busted HDD, if you don't have these you can probably get away with a flat piece of wood as the base and put a pin as the center point. Make a hole in the tilt platform for the pin to fit in so that it can swivel around it. 

With the HDD, I used an 18 gauge equivalent drill bit on my drill press to make a small hole in the aluminum spindle. Don't drill too deep or you may lock up the rotor! Use the 18 gauge wire and make a small 90 deg bend, fit it in the hole and connect up to the pan servo, make sure it doesn't slip out easily (use a Z-shaped bend on the servo). 

If you're using the HDD as the platform, make sure to bolt it to the tilt platform or the servo torque will knock it off. I re-used some of the HDD screws for that and cardboard for washers. If you made a simple pivot platform you probably skipped the HDD drilling part. I would suggest making a hole (same size as the wire) near the pivot point on the tilt platform as your pan control arm connection. 

Step 4: Software - Arduino Portion

OK! Now that you're all done with the hardware, let's move onto the software. 

The Arduino is used as an interface in this project. It allows the servos and IR sensor to communicate easily with the computer using simple commands. 

While this is a "simple" operation, there are some critical areas that need to be addressed. One of those issues that I ran into a lot was communication syncs. Basically by the time the microprocessor was ready to read the command, the computer has not completed sending it. A simple solution to this is to assign a "command ready" character. I chose a semi-colon as my terminator. 
To make sure that the commands are in a serial aspect that will halt the computer from trying to read a temperature while the IR sensor was in motion, I need a response method. A solution that, common for communications, is called ACKs, or acknowledgement. Let's say we execute "p120;" (pan to 120deg), we want the computer to wait for the microprocessor to say "AP120;" (ack pan 120). Once the ACK is received the program can continue to fetch a temperature or the next set of commands. 

Another complicated part is reading the IR data from the serial port on the sensor. In order to read the data we must do something called "bit-bang". This involves setting up an interrupt on the clock falling edge to read the bit on the data line. Each "burst" of data that comes in contains a header and some data that needs to be decoded.
Reading the pdf for the ZyTemp module (http://www.metrisinst.com/item_management/assets/files/TN9_UserManual_009.pdf ) on page 13 you can see the data sequence for each of the bursts of data. Instead of spending some time on this, I decided to do a quick search and found someone else already wrote this for the arduino (they did a precise hotplate temperature controller). The source is documented in the code for reference and credit for the ideas. 

All in all the Arduino code, when compiled, takes 7982 bytes of space.

Commands to know (all commands must end with a ';':
p<n>;  #pan to <n> deg
t<n>;   #tilt to <n> deg
r; #read the IR sensor object
a; #read the IR sensor ambient temp

use these to adjust protection zones (doesn't allow a pan/tilt command to work if out of bounds - some servos will chew them selfs up if they try to go beyond a max)
u<n>; #set upper servo boundary (protection) default is 145 deg
l<n>; # set lower servo boundary (protection) default is 35 deg

Step 5: Software - Computer Portion

Now that you have flashed the arduino, let's look at the PC portion of the software. 

To achieve a simple and quick program I used Processing. It's Java based and can run on many platforms so compatibility is high. The program will use parameters in the setup() to define an area to scan. Each measurement is plotted on a simple grid and color coded relative to all other cells, meaning red = hot and blue = cold (relative of course!). 

There's just a few tweaks to the program that most people will need to do:

1. Define the bondary to be scanned (see previous step for default boundary limits for protection, don't issue something beyond that or th program will "hang"). I would suggest in the Arduino dev tool use the serial console and type in some of the boundaries you want to scan. If you have the laser pointer on it's easy to see where it will scan. Use the commands from the last step for this stage. 
1a. Once you find the boundaries, modify the pan_min,pan_max,tilt_min and tilt_max variables in the setup() to match. 
2. Set up how many steps you want to measure (as seen in the line "size(size*20,size*20); //colls, rows". This is somewhat open to interpretation... while you can do a 100x100 grid, it would take forever to scan. If you read the ZyTemp info, you'll know it scans at a 1.4Hz rate.. the program is set to read at 1.2Hz (t prevent errors, etc) so that's 1.2 measurements every second. Any faster an you'll get a blur in the "image" as the sensor doesn't update that fast. 

Here's some examples: 
You want to measure a wall that's wide, set the range for the pan high then the tilt. Set the grid to something relative to that area, say 25,15. This will make the image wider and shorter in height. If the cell size is too big you can reduce it by changing "int size=50;" to something like 40. You might get text overlaps for each cell so be careful about that. 

The resulting image you'll get in the gui can be copied to a editor (gimp/photoshop...) and overlapped with a real image


Step 6: Thoughts

Some improvements i would like to make at some point:

Make a nice gui to define the range limits (sliders instead of manual work)
PDF export, or something similar, to dump the image of the scan


<p>Great project! I've been playing with 5 degree FOV melexis sensor, i've got quite nice resolution from that. http://www.fpv.lt/lang/en/2013/03/diy-thermal-camera/</p>
Thank you, this was really handy. Got my temp gun running with it in no time, excited to test it against the Melexis MLX90614ESF-BAA I have set up and see how they compare at the same emissivity value and then changing the Melexis one. Working on a liquid cooling pump for an electic bike motor, but after that I definitely want to try building your thermal scanner.
This is awesome! You could probably increase the sensitivity and accuracy of the IR scanner with an optical lens - I was just going to experiment with that myself. <br>
Bad weather in New England ???!!!???<br> <br> I live in UK - England !<br> <br> Terrible weather all the time too lol !!!<br> <br> I really need to make this !<br> <br> I have my pan/tilt mech all set up and got an IR thermo module, and i have two questions: (if your still around to answer that'll be sooooooo-appreciated !)<br> <br> Basically i'm freezing my AS*-Off sitting in my bed, have to wear a woolly hat AND JUMPER when i go to sleep because there is a MAJOR draft in my bedroom and i really need this setup so that i can find out where to start sealing places from the cold !<br> <br> basically do you have advice on the following;<br> <br> 1. Did you get around to making a GUI for this to make it easier to use the software on a computer?<br> <br> 2. i have 2 IR thermometers, from:<br> <br> <a href="http://www.ebay.co.uk/itm/LCD-Thermometer-Non-Contact-IR-Laser-Point-Infrared-Digital-Thermometer-Temp-Gun-/251153943817?pt=UK_BOI_Electrical_Test_Measurement_Equipment_ET&hash=item3a79f10d09" rel="nofollow">http://www.ebay.co.uk/itm/LCD-Thermometer-Non-Contact-IR-Laser-Point-Infrared-Digital-Thermometer-Temp-Gun-/251153943817?pt=UK_BOI_Electrical_Test_Measurement_Equipment_ET&amp;hash=item3a79f10d09</a><br> <br> They dont have any manufacturer brand on them, just in case i cant find a datasheet for the module inside this thermo gun, what would you suggest to finding out what the pins are ?<br> <br> many thanks in advance for any help !<br>
I never did get around to making a full-on GUI or any improvements beyond the processing tool. It's just a few variables that need to be adjusted to suit a custom setup. <br> <br>I'm unfamiliar with those IR guns, the best bet would be to crack it open and see. If you can find 4 pins/pads then you can possibly hook up to the serial interface but without specs you may not know what's really going on. If not, you could leverage the housing/lens and take measurements directly. You should be able to at least find a data sheet on the actual IRthermal module and use the analog pins to make the measurement. <br> <br>Here's a helper to what you should be looking for if no serial data can be found: <br>https://www.sparkfun.com/products/9570 <br>**I found this not long ago, and if I knew it existed I would use this instead since it's much faster.
OMG DUDE !!! <br> <br>Your Legendary !! <br> <br>Thanks so very very much for the awesome advice, im going to take all of it and act immediately lol ! <br> <br>Really highly appreciate your help on this and the amount of work youve already done with this project of yours, im only still learning with the arduino and electronics so your extra info is a really great help for me ! <br> <br>Shame you havent had the time for a GUI yet, i only wish i knew how to do that lol ! <br> <br>Thanks so very much once again ! <br> <br>kindest regards, <br> <br>offtherails2010 ;-)
This concept is <strong>better than fantastic!</strong><br> May I have the honor of first post?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :)<br> <br> DIY-Guy
This is freaking cool

About This Instructable

35,626views

39favorites

License:

More by Dave_G:Brother QL-570 any paper hack Build an Arduino based thermal scanner 
Add instructable to: