Tuesday, August 14, 2012

My Own Thermal Camera

Okay, here's a fun project I just finished up. I still have a little bit of testing and minor calibration to do but it's an extremely fun project.
I always wondered what it would be like to have my own Flir IR imaging camera to see where we have hot/cold leaks around the doors and also to see what the heat signature of things look like.
Here's an example I took from Flir's website showing weather stripping issues around a door.


See how awesome that is? The problem is, the cheapest camera, even at closeout, is $1100. That's a lot of money. Maybe if I sold the imaging services to friends, it would eventually pay for itself but then who wants to charge their friends money for helping them out?
Anyway, I was poking around the internet when I saw an article about a DIY project that could do something similar for much less. They pointed me to this website where a few teenagers took a nice sensor and created a thermal camera on the cheap. I was determined to make my own! One problem though, I didn't have time or the money to put down $60 on a sensor so it sat on the backburner for a year or so.
As some of you may know, we bought a house recently and we really like it. However, for whatever reason, our basement is like an oven. It's unfinished and should be in the 65-70 F range for temperature (according to our plumber who just unclogged our stubborn bathroom drain that I tried hard to clear myself). Anyway, last summer and this summer, the basement has been a balmy 75-78 F and because of it, it's hard to keep the rest of the house cool, especially with no central air. We can have fans blowing the cool air from the one a/c unit we have downstairs but even if we can get it to 75 F, the basement is warmer so it's a battle that has frustrated me. Is it the dryer? Dehumidifier? Maybe it's the gas furnace that heats our water? Thinking it might be the furnace, I put insulation around all the hot water pipes, the water tank, and everything I could. However, it's still a balmy 77 as I write this AND IT'S ONLY 74 OUTSIDE!!! ARE YOU KIDDING ME???
Okay, so you can see it's quite frustrating as I can't figure out what's causing our hot basement issue.

Seeing that I was really frustrated, I remembered that I had wanted to make this cheap thermal camera. Over the last year, I had amassed enough parts that all I had to do was buy the sensor so I bit the bullet and finally bought one.
You'll remember in my Tonka Summit post that I used something called ServoBlocks for the pan on my camera. Well, my project was chosen as one of the monthly winners so I won two more sets! As they are incredible to work with to make simple pan/tilt setups, I decided to use what I won for this project! Except for one problem, I only had one servo that would fit so I had to improvise a little.

I present to you my own thermal camera!
Front view
Side view
Back view
Inside
Kind of a rats nest but not that bad

I wanted to keep it small and portable so I could easily transport it with a laptop to take images. Seeing I had several SparkFun boxes, I found one that would fit just right. I took the bulky casing off the webcam and hot glued it into the hole I made for it on the side of the box. I made openings just big enough for the USB connector on the Arduino UNO and for the webcam cable as well as the servo and sensor cables. Oh, I guess I did cut out a hole for the pan servo too. It looks kind of crazy but it works! The documentation from Max's website were great and really helped get everything together.
For those interested in making one, just know you'll need to be able to solder and do a little programming. I had to change some of the servo parameters to make sure it panned from left to right and would tilt from bottom to top. Once I got that working, then it was a matter of making sure all the connections showed up properly in the computer. I still struggle with that part as sometimes it recognizes the camera or Arduino but for whatever reason, it doesn't sometimes.

So, does it work? Well, I'm not exactly sure how accurate it is but it seems to be pretty good. I only have one image from it so far and it's of the wall and front door. Here's the image.
What I'm not quite sure of yet are if the corners of the thermal image correspond to the corners of the webcam image. I have an old laser pointer from a college project that I'll soon mount onto it to see where it's pointing while it scans and I can report back then. As for accuracy of the data points, I don't know yet. You can see where the sun shines through the door is the warmest. The wall at the lower left is cool because the fan is blowing cool air from the a/c in another room into the living room. While the general values look good, I don't know if it's really accurate. My plan is to remove the servo cables, have it point in one spot for the "scan" and put an ice pack in front of it to see if it registers around 32 F. The sensor is supposed to be accurate to about 1 F or so so I would assume it's close but being the engineer that I am, I want to know better and thats probably the best way I can check.
If you want 64x48 resolution as shown above, it takes about 8 minutes for it to scan and make the image. For a 32x24 image, it takes about 2 minutes. Apparently, there's another project in the works by Max that will take the 64x48 images in about 3 seconds and display it on a portable LCD screen so as soon as that is out, I'll look into making that to have an even better camera for analyzing things.
Stay tuned for some interesting shots. Kind of like my "Will it dry" posts on our family blog, I'll be doing some interesting pictures.
Now, to find that heating gremlin in the basement...

UPDATE 8/27/12
So I finally figured out the problem with the sensor. Apparently, you don't want to change the filter settings using the EEPROM code given at www.cheap-thermocam.tk. Leave those stock and only change the max/min temperature settings and you should be good to go. It sounds like Melexis changed something in their sensor processor and that fixed it.
Here are a couple of pictures for you that I have taken.
The dryer while it was on

The furnace, which I think is the culprit

Saturday, August 11, 2012

My Review of The Manga Guide to Linear Algebra

Moved to here

Tuesday, July 24, 2012

My Review of Safe C++

Moved to here

Saturday, June 23, 2012

My Review of Make: School's Out Summer Fun Guide

Moved to here

Thursday, June 14, 2012

My Review of Make: Technology on Your Time Volume 30

Moved to here

My Review of Android Cookbook

Moved to here

Monday, June 4, 2012

Tonka Summit Build

This has been a long time coming but I'm finally getting around to putting the Tonka body on a Traxxas Summit so I can do some scale FPV with it. I'll be posting the details of how to build one and trying to put dimensions to it as well to make it easier for anyone interested. I know that was a barrier to me starting because I wanted it to be exact. Be prepared for a LONG post!
To start off, you'll need to buy a 1970's style Tonka Jeep from e-Bay. Good condition ones are pricey. The more affordable ones typically have rust. If you're lucky/unlucky, you can find an unwanted pink one for cheap like I did. I started the build on a pink one, then bought a black one as a spare, and started a build for another person so the pictures will be from all three trucks as I have pictures from each at various points that illustrate the build quite well.
Once you get the truck, you'll need to drill some holes into the front end and back end. After the holes are drilled, you need to square the holes out with a square file so they match the body posts of the Summit. This is done so you can quickly and easily change the body out if needed. The Summit posts are made of excellent plastic that just doesn't break so they are perfect for the job.
If you have a Dremel, they have a nice bit that can speed up the process. I finally figured that out the third time around. Until then, I used a square file and it was the most work of the whole build. It took time but make sure the holes are just big enough for the posts to fit through. You don't want any play in there.
When you drill the holes and square the holes out, make sure it's the first thing you do and keep everything else on the truck intact as it helps keep everything from warping. The pictures from the pink truck show the work done after I had taken the top off and cut out the undercarriage. Don't do that as the plastic inner shell won't quite be in place and you could have alignment issues later on.

Close up of the rear holes with measurements

 More measurements of the holes at the back

 Dimensions for the holes up front

Top view of stock body posts with cuts made to make it easier to install

Only the rear body posts need to be shortened. You can make them longer if you want the body a little higher on the truck. You might hold off on cutting until you get it on the truck.

Another view of the holes drilled on the back in relation to the Tonka

The hole location at the front

Once the holes are squared out, you'll need to get the hood of the truck off. This was the hardest part for me. There are holes at the front truck where you can see a small tab. You have to straighten that out however you can. I tried with pliers and that worked out but was a lot of work. You'll have to do what you can to get it straight enough so the hood comes out. It hinges up like a normal vehicle hood when you finally get it open.
Have fun!

Once you get the holes drilled and squared out (arguably the most annoying part), you need to cut out the undercarriage. I used a $20 high-speed cut-off wheel from Harbor Freight for the job. Be sure to remove the top of the truck and the inner, plastic liner before you make the cut. Once you make the cut, the bottom will still be connected on the sides. You don't need to cut the sides. The six tabs on the side can be lifted up. Then you'll need to drill out the two rivets and then the bottom will drop right out.

Here's what the frame looks like after cutting it out. Be sure to keep the piece that falls off on the back. You'll need it to keep the rear bottom stiff.

It was awesome using the cut-off wheel. Just be sure to wear eye protection, ear protection, and long sleeves.

Once the cuts are done, flip the truck over, install the plastic interior, and put the body posts in. Be sure to put the top back on so it holds everything together. You'll need it in this state so you can do a test fit after the next step.

This was taken after the fact. As you can see, the hole in the interior has already been cut out as we'll see how to do next.

If you don't have a Dremel, you can just have the truck on top of the motor and gearbox of the Summit but you're going to have a very high center of gravity and it won't look very good. Find a way to get a hold of a tool to do this part.
In the pictures below, I put the tape measure up to the holes after making the cuts. Just use that as a guide, draw your lines, and then do the cuts. There is one change I would make but I'll make a note of it in the photo caption. Some pictures won't have a caption as there's not much to say.


Here, you don't have to square it out as this is the opening for the motor. You can actually have the cut go along the motor so you don't have a larger opening than you need but I found it's a nice place to have all the servo wiring come up through the body.

Looking from the back towards the front


This is the only place where I need to make a recommendation to change the cut. If you look at the picture where I said to put everything back together after you cut out the bottom, you can see where the opening extends much further down than this picture shows. Initially, I thought this opening was good enough but after installing it, I found the interior plastic say on top of the gearbox housing and kept the body from getting lower than it could go. Just cut it to the line and you'll be good to go.

Once the cut it done, you can do a test fit to see how well it lines up. If it's resting on a part of the motor area, just make the modifications you need to get it how you like.

 What it looks like sitting on top of the Summit

Now for the steering wheel. You'll need to remove the steering wheel from the dashboard. I did it by holding onto one end with a pair of pliers and a vice.

 The awesome vice my dad got my for Christmas. It was so useful for this project.

 Once you have it in the vice, drill out the rivet in the center of the steering wheel so you can remove it

 I used a 3/16" hex bolt to as the steering shaft

To connect the steering wheel to a servo, I bought a servo shaft coupler from ServoCity. I used a Hitec HS-81 servo that I had lying around and installed the shaft coupler on the spline. Since I was using a 3/16" bolt (as it was just the right size for the steering wheel), I made sure to buy the 3/16" shaft adapter. It's a really tight fit but that's a good thing.
To get the servo to actually turn the steering wheel instead of having the wheel spin freely on the bolt, you'll need to either epoxy the wheel to the bolt or find another way to get the wheel connected to the bolt. I have done it three ways and epoxy is the easiest.
The pictures here show the first method I tried but I would recommend epoxy as it's the easiest. Basically, I opened up the hole in the dashboard to be the exact same size as a small washer. Using enough washers stacked on top of each other to be just a hair thicker than the dashboard is the right number to use. I believe for me, it was three. Then you need a large washer that you see in the picture. Finally, a nylon lock nut was used to tighten it all down. With this method, you're able to tighten the whole shaft assembly together onto the steering wheel so when you move the bolt, the wheel also moves with it. It's overly complicated but I didn't want to glue it in place. However, after doing it multiple times, it's just easiest to epoxy and not really necessary to go through the extra work. It's not like it's going to break anyway.
Once you get that done, then you'll need to anchor the servo to the dash. I did it with a piece of metal and double sided tape. A picture is worth a thousand words so I'll save myself three thousand.

Make sure you cut a notch in the metal if the shaft adapter looks like it will hit

The other side

You can see how it all goes together. The shaft adapter from ServoCity is the key.

Once you have this part done, then put it all back together. Now you have your basic truck, ready to go.

For added realism, you need a driver. I snagged a brand new GI Joe with kung fu grip on e-Bay for a quarter of the price of what they have typically gone for. If you find one for under $30, jump on it as they are hard to come by. If you're a collector, then go for a cheap one without the joints that move. You're going to have to remove the head anyway as the GoPro will take the place of his head as you'll see later on. Once you get him in the driver's seat, I hot glued his left hand to the steering wheel so he would "drive" the truck. Be sure to get a Y-cable so you can connect the steering wheel servo to the actual truck servo so they move in sync.

Joe will be the trusted driver of this truck

Joe all ready to go

Now for the part I was dreading. Making the pan/tilt for the camera to give the appearance of Joe moving his head as he drove around. The pan is easy to do. The tilt, I hadn't seen a good way to do without purchasing an expensive pan/tilt system or having to do a lot of custom work. I opted for the latter as I don't have the money to buy one.
The easiest way to do it would be to just glue your tilt system onto the top of the pan servo horn but then you end up with a lot of play in the system if you have more than a tiny security camera on it. My solution to that was a set of ServoBlocks from ServoCity.
I have to deviate a little here and give it up to ServoCity. They have a system in place where you can get a discount if you "plug" ServoCity on a blog, on Facebook, or on Twitter. I needed to get a couple of things for this build and gave a plug in a previous blog post. I thought whatever discount I get would be useful for when I could eventually buy the shaft adapter and ServoBlcoks.
Anyway, they also have a separate promotion going where you can win two sets of ServoBlocks if your project using ServoBlocks is selected as the best one for the month. I had no intention of entering since I didn't have a set but seeing that I could use a set, I just mentioned that in my post. Well, they were very generous and sent me a set to complete this project! I had everything I needed to get this done! It was a wonderful gift as my hobby budget has basically shrunk to nothing this year. $10/mo. doesn't get you anywhere so I have been selling off things I don't use or need to fund this project. I just wanted to say THANK YOU to ServoCity for their generosity!
The ServoBlocks are, in my opinion, the best option for a pan system on this truck and you'll see why. I am doing a build for another person and he got the SPT200 pan/tilt from ServoCity and although it's a wonderful setup, I found it's just a little too big for this truck. It would be great for a lot of other projects but for a confined space, the ServoBlocks really fit the bill.
They go together really well and work with standard size Hitec or Futaba servos. I had a spare Futaba S3004 from a while ago so I used that with the ServoBlocks with shaft hub. Again, a picture is better than an explanation for the rest of the pan/tilt setup so read the captions.

Side view of the ServoBlocks. There is no play at all with this installed.

Head on view

Front view of the pan/tilt

I have to do a little explanation here instead of just putting captions as there are details that shouldn't be left out. This picture above is the front view of the pan/tilt. The ServoBlocks for the pan servo was the easy part. You actually have to do some work for the tilt mechanism. It's not entirely necessary and you can have fun just with the pan servo. If you don't want to go through the work, then skip this section. If you want to be able to look up, then read on.
What I had to do was take a long piece of aluminum (1/8" x 3/4" x 4') and cut it to the right length to fit around a $3 Radio Shack project box. Be sure you leave enough so there is space for the box to tilt down if you want to look down some. I didn't and you'll see the modification I had to make to make it fit a little later.
When you get the aluminum cut to the proper length, you'll need to drill 5 holes in the aluminum. Two are used to mount the bracket to the ServoBlocks hub. The hub is already threaded for 6-32 screws so make the hole about that size and make sure they line up with the hub. Once you have that done, it'll mount onto the pan system pretty easily.
You'll also need two holes on opposing sides for the project box to mount it so it can rotate without resistance. Finally, you need a hole to put the pushrod in so you can tilt the box with a servo.

ITEM OF NOTE: The pictures show the servo on the left side of the box (if you were looking at it from behind). You should mount the servo on the OTHER side. I found out the hard way after putting it all together. The servo got in the way of the side of the truck so it couldn't pan right all the way.

ITEM OF NOTE 2: You'll see another inconsistency in the pictures because I had to flip the pan mount around. Initially, I had it just like the first few pictures. When it came time to mount it, I had no place to set the pan servo on without making something so I took the tilt bracket off, rotated it 180 degrees, and then put it back on so I could use the existing interior to mount the servo. Be sure to look at the latter pictures to see what I mean.

Side view of spacer opposite of tilt hardware. Remember, this is before I had to move the tilt servo so the servo and hardware should actually be on this side.

Shows how the tilt hardware connects. Be sure to flip it to the other side!

Shows the back side and where the servo originally was. Make sure it's moved to the right.

This is a hard one. If you mount the box too low, then it hits the screws that keep the bracket connected to the pan servo. If you mount it too high, then it hits the top of the truck. I unintentionally mounted it too low and decided to Dremel away to let the box clear the screws. Pick your poison, that is unless you get the roll bar version of the truck, then you can mount it without any issue.

This shows how the tilt hardware is installed. Remember to put it on the other side. The cutout at the top is so you can use a cable to get A/V out from a GoPro HD Hero 2. If you have an original HD Hero, you need to have that cutout on the bottom AND make sure you have enough space there for the cable to go in between the box and bracket. If you don't use a GoPro, you don't need either! It's just for video out if you intend to do FPV with it.

This is with the pan/tilt installed. If it looks a little off, it's because the GoPro's lens isn't centered on the camera but is offset to the left and the position puts the lens right around where Joe's head would be. Remember, the servo should be moved to the right.

With this installation using ServoBlocks, it fits perfectly so the bracket clears the top of the seat without any modifications to the seat.

Here's what it looks like with it installed behind Joe

After that, then you just need to install your camera, install a Barbie as a passenger, and then make the connections for all the servos with your receiver. You'll need at least a six channel transmitter for this beast using Y-cables on your servos.
Using my Futaba 9C, I used two Y-cables to connect the steering servos and the steering wheel servo together and put it on channel one. That's the aileron channel. Then the ESC connection goes to channel 2, which is normally elevator. You need the stick to come back to neutral and will need to re-calibrate your ESC to your radio. Next, the tilt servo goes to channel 3 and the pan to channel 4. Those correspond to the left stick on the radio. Pan will return to neutral when you let go but the tilt will stay where you leave it. Finally, the shift servo goes to channel 5 and the locking differential servos are connected through a Y-cable to channel 6.
Now for some shots.

Jungle Summit
(it's actually just in long weeds in the back yard)

Out in the open

Completely posed on a stump but it just looks cool

Another staged but nice look

Climbing the mound of weeds

Hanging in a clearing

Pretty cool huh? I think so. The next step is to install a wireless video transmitter so I can drive as though I'm in the truck and I'll be set. I may update the blog with that but until then, enjoy this video! It's the first video before I borrowed a Barbie to have as a passenger. The pan is pretty shaky but that's mainly due to the fact that I'm running 7 servos off the stock BEC and need add a separate BEC so it can be powered properly.