Advertisement
assembled pan tilt bracket

Arduino Pan & Tilt Bracket

arduino pan tilt bracket project

Inspired by the Pan/Tilt bracket from SparkFun (sparkfun.com/products/10335), recently I built my first prototype of an Arduino-based Pan/Tilt Bracket for mounting my security/web camera. Although the mechanical construction is not completed yet, I have an irresistble temptation to share my idea with interested hobbyists, right now. Here is the sneak preview of my “babe” Pan/Tilt Bracket project. Admittedly, Arduino would made things very comfortable, thanks to the servo library and built-in serial communication facility.

assembled pan tilt bracket

(assembled pan tilt bracket)

The pan/tilt bracket consists of two brackets and all the hardware you need to attach them to make a pan/tilt system with the help of two little servos. You can use the assembled bracket to mount your camera and move it in x-y (pan-tilt) directions.

For mounting the security/web camera, detach the camera part from its base and then screw it on to the top of the pan/tilt bracket. However,this will depend on your specific camera model. Some cameras have screw-on bases and thus make this task pretty easy.

Parts List

  • Arduino Uno (1)
  • Pan/Tilt Bracket (1)
  • Small Servo (2)
  • 2-Axis Joystick (1)
  • Prototyping Board (1)
  • Prototyping Hardware Accessories (as required)

Hardware Setup

The hardware setup is straight forward. If you want to keep things modular, try to use appropriate male/female headers and jumper wires for connecting the joystick and servos to the Arduino board. A detailed wiring diagram is shown below as a quick reference for the hardware setup program.

wiring diagram

(wiring diagram)

Remember to attach the TILT-Servo to SV-TILT connector, and PAN-Servo to SV-PAN connector. Header H1 should be linked to the Arduino board with correct pin connections (D10 – 4, D9 – 3, A1 – 2, A0 – 1). Author used Tower Pro SG90 micro servo motors, and a generic 2-axis thumb joystick for this project. The article includes author’s preferred PCB layout idea (and its Gerber Files).

Since power rail connections are not linked to the header H, you are free to use +5V from the Arduino board itself, or +5V from an external power supply, though treating the GND rail as common 0V rail. The blank header (H) in the proposed pcb artwork lets the bonding very flexile.

pcb layout idea-gerber view

(pcb layout idea-gerber view)

Arduino Code

#include <Servo.h>
Servo panServo; // Create a servo object for the pan (horizontal) servo
Servo tiltServo; // Create a servo object for the tilt (vertical) servo
int panPin = 0; // Analog input for the joystick horizontal axis
int tiltPin = 1; // Analog input for the joystick vertical axis
int panVal; // Value read from the horizontal axis
int tiltVal; // Value read from the vertical axis

void setup()
{
   panServo.attach(9); // Use pin 9 PWM output for horizontal servo
   tiltServo.attach(10); // Use pin 10 PWM output for vertical servo
}

void loop()
{
   panVal = analogRead(panPin); // Read joystick horizontal position
   panVal = map(panVal, 0, 1023, 0, 179); // Scale down analog reading
   panServo.write(panVal); // Move servo to desired position
   tiltVal = analogRead(tiltPin); // Read joystick vertical position
   tiltVal = map(tiltVal, 0, 1023, 0, 179); // Scale down analog reading
   tiltServo.write(tiltVal); // Move servo to desired position
   delay(15); // Give the servos enough time to stabilize
}
initial testing of the concept

(initial testing of the concept)

Once you have successfully uploaded the simple code to your Arduino, you should be able to control your pan/tilt bracket via the joystick. Enjoy!

Note
Pan/Tilt Bracket – eBay India http://www.ebay.in/itm/111784515875

One Comments

Join the conversation!

Error! Please fill all fields.