Introduction: Object Tracking - Camera Mount Control

About: Robotics and Automation Engineering student

Hello everyone,

In this Instructable I will show you the progresses made for my Object Tracking Project.
Here you can find the previous Instructable:
and here you can find a youtube playlists with all the videos and code explanations:

So, we are finally able to move from the purely software and coding world to the real wolrd, putting the camera on a mount and moving the mount to follow the object, let's see how!

Step 1: Camera Mount:

This is the camera mount we are going to use. It is not fully compatible with the webcam and the way I fixed the camera to the mount is A LITTLE rudimentary to say the least :D

But it will do for now and in the future I will probably 3d print some kind of adapter or build it completely from scratch.

This kind of mount is often referred to as "pan and tilt mount" since they have 2 motor to control the pan (rotation on the horizontal plane) and tilt (rotation around the y axis or "up-down"), as shown in the picture.

Step 2: Arduino and RC-Servo Motors:

To control the mount we are going to use 2 RC-Servo Motors and an Arduino Uno.

In the picture you can see the connections needed:

Tilt servo: ground -- breadboard ground

VCC -- breadboard VCC

signal -- pin D6

Pan servo: ground -- breadboard ground

VCC -- breadboard VCC

signal -- pin D5

Step 3: Matlab Code:

The Arduino will be entirely controlled with Matlab, using the arduino toolbox from Matlab.

In this section you can find the code:

blueCircleFollow2.m is the "main" function, K_proportional1.m is an auxiliary script called from the other script, it basically contains the proportional controller.

The control approach used is shown in the picture: the reference position we want the object circle to be at is the center of the screen, the proportional controller will act on the servos control signal to get the error, defined as center of image - circle center, to 0.

Step 4: Performances:

Here you can find two videos showing how the algorithm and the controller performed.

In the first, longer, video the code, structure and control strategy are more deeply explained, the second video is an extract of the first one containing only the video of the system tracking the object.

As you can see the algorithm is more than capable to follow the object when it is moved around, but I believe there is room for improvements, introducing more complex controller than just proportional (coff PID coff coff) and a few other ideas.

If you have any questions don't hesitate to ask them in the comments, and if you want to see the next steps subscribe to my youtube channel, I will keep putting everything there!