Introduction: Arduino Remote Controlled Camera Mount – Ir Object Tracking Shield

Features:

Remotely turn your camera left and right.

Use it as an object (beacon) tracking camera mount or selfie stick.

Runs on a 5 volt usb power bank

Can be used with most tv remote controllers

The design and coding is kept as simple as possible with the maximum result.

What to expect from this tutorial

I'll quickly go over the parts list, put the simple board together and upload the code to the arduino.

Later in the instructable I'll explain a bit more how the sensor works and how to tweek the code.

Step 1: The Camera Shield in Action

Step 2: Parts List

Arduino, Servo motor, Camera mount, 2 x ir receivers, 1 straw, shrinking socks, Electrical wire, Solder board, Connecting pins

Step 3: Preparing the Shield

We cut our Solder board to a size that fits properely on the arduino. I used 15 x 20 holes.

We solder the connecting pins to the shield. I used more connectors than needed but this is to properly mount the shield to the arduino.


Step 4: The Tracking Sensor

We cut 2 pieces of straw about 10 mm long and 30 mm.

Push the straw over the sensors and the shrinking sock over the straws and shrink them at the end.

Cut the sock halfway open and cut an angle at the end.

Connect a wire to the positives and another wire to the negatives op the ir receiver. And connect a wire to each out pin.

Then glue the backs of the receivers together.

Step 5: The Board

Glue the servo motor to the shield and solder the 3 wires anywhere on the shield.

The yellow wire is the signal and will be connected to pin 11.

The middle wire is positive and will be connected to the 5V pin.

The brown wire is ground and needs to be connected to the ground pin.

The positives of the sensor go to 5 v pin.

The negatives to ground.

And the 2 signal wires go to pin A3 and pin A5.

Step 6: Glue the Camera Mount and Sensor

Hot glue the camera mount to the servo mount.

Hot glue the sensor to the camera mount. Make sure it is glued at an angle of 90 degree.

Next we will upload the code into our arduino.

Step 7: The Code

#include

int Position = 90;

int stepDeg = 20;

int smoothness = 10;

int countL = 0;

int countR = 0;

int servoPin = 11;

//Create servo object

Servo trackerServo;

void setup(){

//attach the servo to our object

trackerServo.attach(servoPin);

trackerServo.write(Position);

}

void loop(){

//read ir beam

for(int i=0;i<=1;i++){

int sensorValueLeft = analogRead(A5);

int sensorValueRight = analogRead(A3);

if(sensorValueLeft == 0){

countL++;

}

if(sensorValueRight == 0){

countR++;

}

}//end for

//check left and rotate

if(countL > 1 && countR == 0){

for(int x = 0; x <=stepDeg; x++){

Position--;

trackerServo.write(Position);

delay(smoothness);

}

}

//check right and rotate

if(countR > 1 && countL == 0){

for(int x = 0; x <=stepDeg; x++){

Position++;

trackerServo.write(Position);

delay(smoothness);

}

}

countL = 0;

countR = 0;

}

Step 8: More About the Sensor

The tracking sensor consists of 2 ir receivers separated from each other. So when they both receive ir light, their position is pointed to the object. If only one ir receiver receives ir light, it means that the servo needs to turn left or right in order to get ir light on both.

Ir beams can be very strong and reflect to many objects. There for we use black material to create the sensors and make there shape so that they only receive ir beams at a certain angle.

Step 9: Adjusting the Code

Adjust int stepDeg to increase or decrease the degree of each step.

Int smoothness is best kept at 10. The lower the faster the servo turn but the more unstable it gets.

Step 10: Final Note

Thanks for taking your time going through this tutorial.

Did you like it, Please click the favorite button.

More info and updated can be found at the website:

http://tomtomheylen.com/categories/DIY/Arduino_ir_object_tracking_camera_shield.php

Any questions or comments below.

Comments

author
fabitencourt (author)2015-10-01

Very interesting project, I think I'm going to make one of these. Very well explained too.

author
tomheylen (author)fabitencourt2015-10-01

Nice. Let me know if you need any help.

About This Instructable

3,399views

47favorites

License:

Bio: I like to make stuff in my free time. Especially programming, cooking, electronics etc. Lately I'm making tutorials about stuff I made the last ... More »
More by tomheylen:Long range, 1.8km,  Arduino to Arduino wireless communication with the HC-12.How to connect a FT232RL programmer to the Arduino ATMEGA328 for uploading sketches$2 Arduino. The ATMEGA328 as a stand-alone. Easy, cheap and very small. A complete guide.
Add instructable to: