Infrared Homing Turret

I'm planning on using an Arduino to create a NERF turret that uses a thermopile sensor to locate, lock onto, and shoot at a living being. However, I'm not sure I really understand how to do this. After researching many hours upon stroke of luck I found this topic:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1183055686

But I'm not sure how that code works or how I can use it to find a body and direct servo motors to lock onto and shoot a nerf gun at it.

Any advice or help would be greatly appreciated. I plan on incorporating this project into an autonomous 4-wheeled roaming robot that I'm also working on. The end result is that I'm hoping to have a roaming turret that will just drive around, avoid obstacles, and lock onto and shoot at things it notices.

Post a link to the sensor that you are using.

You need to get information from the sensor, as you move it around, and find the highest value. That indicates the warmest spot.

I actually was planning on using this: http://www.robotshop.com/devantech-8-pixel-thermal-array-sensor.html?utm_source=google&utm_medium=base&utm_campaign=jos

That's why I said it was lucky to find the thread I linked to - it's the same sensor.

So from your description and what I know about this sensor, it's essentially a 1x8 array of thermal sensing pixels, right? I imagine that means I can easily do horizontal movement for the turrent by simply positioning a servo to turn the gun to the warmest signature. If I wanted to do vertical movement as well, I'd need two of these, correct?

The data you get from that sensor is going to cover an area of 1 by 8 pixels. That's a pretty narrow range. You need, almost, to ignore 7 of the pixels, and rotate through a fairly broad range, probably 360 degrees, to find the warmest spot (which will have moved by then). Vertically, you need to move it through a smaller arc. The heat source is somewhere between straight up and straight down.

If you are just looking for a hot spot (target), as soon as you see the temperature drop off, you are moving past the hot spot, and it is time to stop/reverse direction - in one axis.

That sounds pretty simple. My next question is what to do as far as the servo motor is concerned: Do you happen to know of a good servo that could turn a NERF gun that weighs 7lbs? I saw other people use a sort of belt system to use a smaller servo to do that, but I'm not sure my crafting abilities are good enough to make something like that. I'd rather just had a big wheel servo with a decent range of rotation.

There are very large servos that can hoist sails on sailboats (full size ones). Plan to spend some money, though.

7 lbs? My Ruger P345 has a hell of a lot more stopping power and weighs n where near that much.

PaulS:
There are very large servos that can hoist sails on sailboats (full size ones). Plan to spend some money, though.

7 lbs? My Ruger P345 has a hell of a lot more stopping power and weighs n where near that much.

The OP is likely talking about the Nerf Vulcan; I found one of these at Goodwill over the weekend (spent $3.00 for it); I still need ammo belts and darts, though. The thing uses 6 D-cells for its battery pack. 7 lbs seems about right.

Doesn't look as cool as a Ruger, though... :wink:

Big inexpensive servos. You may want to mount the gun on a plastic lazy susan from walmart to support the weight.

Big inexpensive servos.

I'd argue that point on some of those... $87.75 for the last one on the page?

cr0sh:

PaulS:
There are very large servos that can hoist sails on sailboats (full size ones). Plan to spend some money, though.

7 lbs? My Ruger P345 has a hell of a lot more stopping power and weighs n where near that much.

The OP is likely talking about the Nerf Vulcan; I found one of these at Goodwill over the weekend (spent $3.00 for it); I still need ammo belts and darts, though. The thing uses 6 D-cells for its battery pack. 7 lbs seems about right.

Doesn't look as cool as a Ruger, though... :wink:

Yeah, it's a Vulcan. Sorry, I failed to mention that. XD

As far as the servos, I'm new to servo motors. How do you go about attaching things to them?

I'd argue that point on some of those... $87.75 for the last one on the page?

Just depends on what one is looking for and the price one is willing to pay.

http://www.lynxmotion.com/p-741-i00600-servo.aspx

I've got another question, in regards to the topic. So I now understand how the sensor works after I read this: TPA81 Infra Red Thermal Sensor

However, if I want to use this code:

// prototype code for interfacing Devantech TPA81 thermopile array
// http://www.robot-electronics.co.uk/htm/tpa81tech.htm
//
// Jason Winningham
// 27 june 2007

#include <Wire.h>
#define TPA81ADDR (0xd0>>1)

void setup() 
{ 
  Wire.begin();        // join i2c bus (address optional for master) 
  Serial.begin(9600);  // start serial for output 
  Serial.print("starting TPA81 test\n");
} 
 
void loop() 
{
  byte b;
  int i;
  
  for (i=1; i<=9; i++)
  {
    Wire.beginTransmission(TPA81ADDR);
    Wire.send(i);
    Wire.endTransmission();
    
    Wire.requestFrom(TPA81ADDR, (int) 1);
 
   while(Wire.available() < 1)
   { ; }

    b = Wire.receive(); // receive a byte as character 

    Serial.print(b, DEC);
    Serial.print(" ");
  }
  Serial.println("");
 
  delay(2000); 
}

Which pins do I use on the arduino? Sorry for the dumb question T_T, still kinda new to arduino code.

Edit: Turned out to be analog pins 4 and 5. I ran the code, and it works! Now I just have to modify the code to control a servo based on data from this sensor!