Build An Arduino Based Thermal Scanner

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Home Sign Up!

Browse Community Submit


All Art Craft Food Games Green Home Kids Life Music Offbeat Outdoors Pets Photo Ride Science Tech

Build an Arduino based thermal scanner


by Dave_G on February 13, 2011 Table of Contents Build an Arduino based thermal scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Intro: Build an Arduino based thermal scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 1: Materials needed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 2: Hardware setup - Electronics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 3: Hardware setup - mechanical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 4: Software - Arduino portion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 5: Software - Computer portion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 6: Thoughts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 2 2 4 5 5 6 6 7 7

http://www.instructables.com/id/Build-an-Arduino-based-thermal-scanner/

Intro: Build an Arduino based thermal scanner


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.

Image Notes 1. Chimney area - it's colder than the walls by 10F

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

http://www.instructables.com/id/Build-an-Arduino-based-thermal-scanner/

(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.

Image Notes 1. 3.3V 2. did no pass through to Arduino board 3. Other side of diode to the IR module 4. IR module Ground 5. 5V supply for servo 6. RJ45 connector from a DSL filter (included both ends of the plug)

Image Notes 1. Ground 2. 5V from power connecto 3. 5V to servo 4. Ground to Servo 5. PWM pin 9 6. PWM pin 10 7. IR data 8. IR Clk - bring over to pin 2

Image Notes

http://www.instructables.com/id/Build-an-Arduino-based-thermal-scanner/

Image Notes 1. This row, i pulled pin above the connector for the servos to connect to 2. this row connects to the arduino - make sure to sever connections on pcb if you do the same

1. Computer connection 2. Power connection (3v to IR module -- use diode to drop 3.3V to an acceptable range) (5V to servo) 3. Servo connections Wire the servo white wires to pins 9/10 and the red to 5V and black to bround 4. No external power required, USB can supply all 5. Interrupt IR clock pin (2)

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.

Image Notes 1. Tilt servo 2. Pan Servo 3. HDD with motor still attached 4. Tirpod 5. Measure button is pressed with this elastic 6. L shaped link to servo, when pulled it pans down and when pushed it pans up. 7. small brackets to keep the coat hanger wire in place 8. CD spacer not necessary but can add stability

Image Notes 1. U shaped mount to hold IR sensor 2. IR lense 3. Laser pointer port 4. Sensor button always pressed

http://www.instructables.com/id/Build-an-Arduino-based-thermal-scanner/

Image Notes 1. RJ45 connector to easily attach sensor 2. Bolted platform right to the HDD spindle 3. Another pin to keep the tilt rod in place 4. Left over HDD parts holding cardboard as a platform for arduino

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

File Downloads

http://www.instructables.com/id/Build-an-Arduino-based-thermal-scanner/

thermal_intrface.zip (2 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'thermal_intrface.zip']

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

Image Notes 1. Screen shot of the plot 2. X grid position marker 3. y grid position marker

Image Notes 1. Chimney area - it's colder than the walls by 10F

File Downloads

thermal_scan.zip (2 KB)

http://www.instructables.com/id/Build-an-Arduino-based-thermal-scanner/

[NOTE: When saving, if you see .tmp as the file ext, rename it to 'thermal_scan.zip']

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

Related Instructables

How to Fake Smart Thermal + Thermal Arduino by Imaging Video gamesh_ by yokozuna

How to Make LEDs Flash to The Music with an RRRRRRRRRRBBA, a $3 Arduino by Arduino by Hyrulian jackzylkin

Power Arduino with a cellphone by zimirken

Arduino + WiFi, Music Responsive LED Light Fixture by neltnerb

http://www.instructables.com/id/Build-an-Arduino-based-thermal-scanner/

You might also like