This is a pan & tilt security camera project based on the ServocIty/Actobotics pan & tilt system. I use the system to monitor my house and the web camera is connected to an pc. This project combines robotics(Servocity) , open software & hardware (Debian, Arduino) and free software (VLC , Contacam it is available only for Windows),
Lets start with the components that we will use.
Step 1: List of Components
These are the components that we will use.
1.A pc.(i used my laptop with Debian 8, if you want to use Windows, you must have xp service pack 2 and above)
2.Actobotics tilt mechanism DDT560. TIlt mechanism
3.Actobotics pan base DDT155. Pan base
4.Hitec HS-625MG Contiuous Servo Hitec continuous servo
5.Hitec HS-5485HB Servo Hitec servo
6.Arduino Leonardo Leonardo
7.A usb camera.
8.A couple of jumper cables.
9.A couple of zip ties or duck tape.
11.A couple of 6-32 Zinc-Plated Alloy Steel Socket Head Cap Screw. Head Cap Screws
Lets continue with the software.
Step 2: List of Software
1.Linux distro or Windows xp service pack 2 and above.
2.Contacam - Video surveillance and Graphics Software (Only for Windows) Contacam
3.Vlc Vlc media player.
4.Arduino IDE. (I used version 1.6.0) Arduino IDE
5.Processing IDE (I used version 3.0.1) Processing ID
6.Tight VNC or VNC or some other remote access software. (Our system will be headless at the end).TightVNC
The project can work either in Linux or WIndows. In case you use:
Linux you will have to install Vlc, Arduino & Process IDE and Tightvnc.
WIndows you will have to install Contacam, Arduino & Process IDE and Tightvnc. You can also use Vlc with windows but Contacam is a very handy and free software.
Proceed now and install all your software to your pc so it can be ready for testing after we deal with the hardware.
Step 3: Assemble the Pan Base
The assembling of the pan base DDT155 is very simple and you can find the steps here Pan base DDP155 assebling instructions.
Inside the base we'll use the HS-625MG Continuous Servo and we will not use the circular plate at the top because we will attach the base to the tilt mechanism later.
Step 4: Assemble the Tilt Mechanism
In this step:
1.We will assemble the tilt mechanism.
2.We will attach the pan base to the tilt mechanism.
First the instructions for the tilt mechanism DDT560 are here Tilt mechanism DDT560 part 1
We will use the standard servo HS-5485HB here.
Second attach the pan base to the tilt mechanism with 4x(6-32) Zinc-Plated Alloy Steel Socket Head Cap Screws and you are ready for the next step.
Step 5: Attach Webcam to the Mechanism.
Remove the plastic cover of the web camera and attached it properly to the tilt mechanism with duck tape or zip ties. Remember that the cable behind the camera should be safe.
Step 6: Servo Cables Extensions
In this step we have to extend our servo cables with simple jumper cables.The longer they are the better.
It is very important when you are working with servos to know what the color of the cables means.In my servos we have:
1.Yellow for signal (Attached to one of the digital/analog pins of the Arduino)
2.Red for power (attached to 5V pin of the Arduino)
3.Black for ground (attached to GND pin of the Arduino)
Step 7: Connect Servos to Arduino
We must now connect the servos to the Arduino.
Continuous servo (pan base):
Yellow cable --> digital pin 10 of the Arduino.
Black cable --> to the breadboard.
Red cable --> to the breadboard.
Standar servo (tilt mechanism):
Yellow cable --> digital pin 9 of the Arduino.
Black cable --> to the breadboard.
Red cable --> to the breadboard.
Both black cables of the servos should be next to each other, also for the red cables. Then take 2 jumper cables and lead them to the pins 5V and GND of the Arduino as the pictures above.
Step 8: Test the Pan Base
At this point we have to speak about the differences between standard servos and continuous servos.
Continuous rotation servos are servos which do not have a limited travel angle, instead they can rotate continuously. They can be thought of as a motor and gearbox with servo input controls. In such servos the input pulse results in a rotational speed, and the typical 1.5 ms center value is the stop position. A smaller value should turn the servo clockwise and a higher one counterclockwise. Wikipedia
That means that the same Arduino code will have differences in standard and continuous servos. For the pan base we used the continuous servo so we will have 2 sketches to control the movement. One for the left and one for the right rotation.Another thing that we must find is the stop point or the servo. You can use this video to Calibrate servo
The code for the servo of the base moves the tilt mechanism left or right for 5 sec and stops for 10 sec. If you want the mechanism to move faster (i dont recommend it) change the first value myservo.write(89). Make a test and change that value to myservo.write(86) to see the differences. The myservo.write(90) is the stop point of the servo.
Upload the code to the Leonardo through the IDE, watch that it is working and go to the next step to test the tilt mechanism code.
Step 9: Test the Tilt Mechanism
In this step first we have to upload the Arduino code to test the up and down movement of the tilt mechanism.
The code is taken from this tutorial Arduino servo motor mouse move and has some changes.
Once the code is uploaded open the Processing program and upload the file from below. When is done play the code and a small window will appear. Start move your mouse and you will see the tilt mechanism moving.
Now that we have all our software and hardware ready we have to connect the web camera to the pc so we can work with the Vlc or Contacam program and finalize our project.
Step 10: Test the Webcam With Software.
Attach your webcam to the pc, open
Vlc --> Media --> Open capture device choose your webcam from video device name and play.
and if you use Windows
Contacam --> Capture and choose your webcam.
You can stream now your webcam inside your home network.In order to see this content outside you have either port forward your pc with the correct port so it would be accessible outside from a web browser(usually port 8080) or connect with Tightvnc.
Step 11: Conclusions - Video Presentation
FInally our project is over. Sevrocity Pan & Tilt system is a good and heavy duty system. Usually u can use this kind of systems for cameras but i am not a photographer.
Some other things that you can do with the project is to attach an Arduino Yun which has wifi on board and stream directly your video (not recommended because it will stretch your arduino to its limits, but can be done). Also you can use a Raspberry Pi, instead of the pc and make portable the whole system. You can also stream with software your webcam to Youtube.