pan and tilt arduino

Observations from an outlier

pan and tilt arduino

arduino_pantilt-1293916

arduino_pantilt-1293916

testing pan and tilt from servo city

here is an arduino sketch (below) to control a pan and tilt system from your keyboard. I chose high torque servos hoping they would be a bit smoother and less “buzzy” when tracking into new positions. with the lightweight gopro camera there is still some jittering, but nothing that can’t be removed with a good video editing tool. servo city claims this rig can manage one pound cameras with modest range servos.

#include  Servo panServo; Servo tiltServo; const int maxPan = 220; const int minPan = 10; const int maxTilt = 130; const int minTilt = 45; int pan = 100; int tilt = 100; void setup() { panServo.attach(8); tiltServo.attach(9); panServo.write(pan); tiltServo.write(tilt); Serial.begin(115200); Serial.println("READY"); } void loop() { if(Serial.available() > 0){ int input = Serial.read(); if(input == 'a'){ if((pan + 5) < maxPan) pan += 5; } if(input == 'd'){ if((pan - 5) > minPan) pan -= 5; } if(input == 's'){ if((tilt + 5 ) < maxTilt) tilt += 5; } if(input == 'w'){ if((tilt - 5 ) > minTilt) tilt -= 5; } if(input == 'p'){ for(int i = minPan ; i < maxPan ; i++) { panServo.write(i); delay(35); } for(int i = maxPan ; i > minPan ; i--) { panServo.write(i); delay(35); } } if(input == 'o'){ // turn off motors panServo.detach(); tiltServo.detach(); } panServo.write(pan); tiltServo.write(tilt); Serial.println("pan: " + (String)pan + " tilt: " + (String)tilt); } }