Introduction: PC Controlled ARDUINO Pan Cam

hello today i m going to show you how to build rotating camera using servo motors and of course arduino
things you'l need:
2 analog servo motor's
arduino
power supply +5v
computer
web cam
optional(video capturing software i m using IP Camera Viewer)

Step 1: Building Camera Stand

I'used casing from a broken camera if you don't have it you can build camera stand from plexi glass.
On picture is an example  

Step 2: Upload Arduino Code

#include <Servo.h>
int incomingByte = 0;
Servo myservo;
Servo myservo1;
Servo myservo2;
Servo myservo3;
Servo myservo4;
Servo myservo5;
Servo myservo6;
Servo myservo7;
double pos=90;
double pos1=90;
double pos2=90;
double pos3=90;
double pos4=90;
double pos5=90;
double pos6=90;
double pos7=90;
int aut=0;
int aut1=0;
int aut2=0;
int aut3=0;


void setup() {
        pinMode(13, OUTPUT);
Serial.begin(9600); 
        myservo.attach(12);
        myservo1.attach(9);
        myservo2.attach(8);
        myservo3.attach(7);
        myservo4.attach(6);
        myservo5.attach(5);
        myservo6.attach(4);
        myservo7.attach(3);
        myservo.write(pos);
        myservo1.write(pos1);
        myservo2.write(pos2);
        myservo3.write(pos3);
        myservo4.write(pos4);
        myservo5.write(pos5);
        myservo6.write(pos6);
        myservo7.write(pos7);    
}

void loop() {


incomingByte = Serial.read();

if (incomingByte == 66 && pos>10 ) {

          myservo.write(pos-=0.2);        

          }
           if (incomingByte == 65 && pos<180 ) {

          myservo.write(pos+=0.2);


          }
          if (incomingByte == 68 && pos1<180) {
          myservo1.write(pos1+=0.2);


          }
          if (incomingByte == 67 && pos1>10 ) {

          myservo1.write(pos1-=0.2);        

          }
          if (incomingByte == 97) {
            digitalWrite(13,HIGH);}
          if (incomingByte == 98) {
            digitalWrite(13,LOW);} 
          if (incomingByte == 82) {
            aut=1;}
           while(aut == 1) {
                   incomingByte = Serial.read();
                   for(pos1 = 10; pos1 < 180; pos1 += 0.2)  
                    {
                    incomingByte = Serial.read();
                    myservo1.write(pos1);
                  if (incomingByte == 83) {                 
                     aut=0;
                      }
                   delay(15);                       
                    }
                   for(pos1 = 180; pos1>=10; pos1-=0.2)     
                     {
                   incomingByte = Serial.read();                       
                   myservo1.write(pos1);
                   if (incomingByte == 83) {                 
                     aut=0;
                      }
                    delay(15);                       
                   }


            }

           if (incomingByte == 70 && pos2>10 ) {

          myservo2.write(pos2-=0.2);        

          }
           if (incomingByte == 69 && pos2<180 ) {

          myservo2.write(pos2+=0.2);


          }
          if (incomingByte == 72 && pos3<180) {
          myservo3.write(pos3+=0.2);


          }
          if (incomingByte == 71 && pos3>10 ) {

          myservo3.write(pos3-=0.2);        

          }
                    if (incomingByte == 84) {
            aut1=1;}
           while(aut1 == 1) {
                   incomingByte = Serial.read();
                   for(pos3 = 10; pos3 < 180; pos3 += 0.2)  
                    {
                    incomingByte = Serial.read();
                    myservo3.write(pos3);
                  if (incomingByte == 85) {                 
                     aut1=0;
                      }
                   delay(15);                       
                    }
                   for(pos3 = 180; pos3>=10; pos3-=0.2)     
                     {
                   incomingByte = Serial.read();                       
                   myservo3.write(pos3);
                   if (incomingByte == 85) {                 
                     aut1=0;
                      }
                    delay(15);                       
                   }


            }
                if (incomingByte == 74 && pos4>10 ) {

          myservo4.write(pos4-=0.2);        

          }
           if (incomingByte == 73 && pos4<180 ) {

          myservo4.write(pos4+=0.2);


          }
          if (incomingByte == 76 && pos5<180) {
          myservo5.write(pos5+=0.2);


          }
          if (incomingByte == 75 && pos5>10 ) {

          myservo5.write(pos5-=0.2);        

          }
                     if (incomingByte == 86) {
            aut2=1;}
           while(aut2 == 1) {
                   incomingByte = Serial.read();
                   for(pos5 = 10; pos5 < 180; pos5 += 0.2)  
                    {
                    incomingByte = Serial.read();
                    myservo5.write(pos5);
                  if (incomingByte == 87) {                 
                     aut2=0;
                      }
                   delay(15);                       
                    }
                   for(pos5 = 180; pos5>=10; pos5-=0.2)     
                     {
                   incomingByte = Serial.read();                       
                   myservo5.write(pos5);
                   if (incomingByte == 87) {                 
                     aut2=0;
                      }
                    delay(15);                       
                   }


            } 
                if (incomingByte == 78 && pos6>10 ) {

          myservo6.write(pos6-=0.2);        

          }
           if (incomingByte == 77 && pos6<180 ) {

          myservo6.write(pos6+=0.2);


          }
          if (incomingByte == 80 && pos7<180) {
          myservo7.write(pos7+=0.2);


          }
          if (incomingByte == 79 && pos7>10 ) {

          myservo7.write(pos7-=0.2);        

          }
                              if (incomingByte == 88) {
            aut3=1;}
           while(aut3 == 1) {
                   incomingByte = Serial.read();
                   for(pos7 = 10; pos7 < 180; pos7 += 0.2)  
                    {
                    incomingByte = Serial.read();
                    myservo7.write(pos7);
                  if (incomingByte == 89) {                 
                     aut3=0;
                      }
                   delay(15);                       
                    }
                   for(pos7 = 180; pos7>=10; pos7-=0.2)     
                     {
                   incomingByte = Serial.read();                       
                   myservo7.write(pos7);
                   if (incomingByte == 89) {                 
                     aut3=0;
                      }
                    delay(15);                       
                   }
          }
                    if (incomingByte == 99) {
            aut3=1;}
           while(aut3 == 1) {
                   incomingByte = Serial.read();
                   for(pos7 = 10; pos7 < 180; pos7 += 0.2)  
                    {
                    incomingByte = Serial.read();
                    myservo1.write(pos7);
                    myservo3.write(pos7);
                    myservo5.write(pos7);
                    myservo7.write(pos7);

                  if (incomingByte == 100) {                 
                     aut3=0;
                      }
                   delay(15);                       
                    }
                   for(pos7 = 180; pos7>=10; pos7-=0.2)     
                     {
                   incomingByte = Serial.read();                       
                    myservo1.write(pos7);
                    myservo3.write(pos7);
                    myservo5.write(pos7);
                    myservo7.write(pos7);
                   if (incomingByte == 100) {                 
                     aut3=0;
                      }
                    delay(15);                       
                   } 


            }

}

Step 3: Specifications and Wirinig

x vertic pins for servos
pin9
pin7
pin5
pin3
y vertic
pin12
pin8
pin6
pin4

camera1
pin9(x)
pin12(y)
camera2
pin7(x)
pin8(y)
camera3
pin5(x)
pin6(y)
camera4
pin4(x)
pin3(y)
analog servo motors have 3 pins yellow(white)-red-black;or older ones orange-red-brown
yellow;white;orange=data pin
red=+4.8v
brown;black=ground
pin13 ir light 

Step 4: Using Software

first you need to connect arduino to pc then extract zip file and run sketch_controls2.exe located in folder sketch_controls2\application.windows32 when the program open's you'l need to choose instance camera
1 ,2,3 or 4 you can then control camera, if you want to change the instance just click on number you would like to control.
Auto function rotates camera automaticlly .When you press off next to auto button the camera will stop rotating when servo completes the cycle at 10. there is also button auto all ,to automaticlly rotate all camera's ,to stop press "off all" next to auto all.I also added
on and off switch for ir lightning on pin13.