Arduino ir object tracking camera shield


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 on I'll explain a bit more how the sensor works and how to tweek the code.

Parts list

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

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.

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.

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.

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.

The arduino code


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




void loop(){

//read ir beam

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

int sensorValueLeft = analogRead(A5);

int sensorValueRight = analogRead(A3);

if(sensorValueLeft == 0){



if(sensorValueRight == 0){



}//end for

//check left and rotate

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

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






//check right and rotate

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

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






countL = 0;

countR = 0;


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.

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.