Arduino webcam pan tilt control with the KY-023

Hello world! Today i made a Arduino webcam pan tilt control with a old webcam, Dont mind the bad video, i said “OLD” LoL! Its pretty easy to build you need 2 servos a joystick, the schematic, code, and a little creativity. Follow the link for the Schematic Code & Parts List. I simply taped the Servos on top of each other, because i always take my projects apart after my instructables and videos are done.

Arduino webcam pan tilt control

Just wire it up like the schematic & it should work after uploading the code.
Make sure you have the servo.h library installed.

Parts list:
Arduino Uno, I used the robotdyn UNO.
KY-023 JoyStick Module.
2 X Servo motor.
Jumper wires set. MM/FF/MF
Old Webcam or any other camera that you wanna use. Small is better.
Some creativity to mount the servos.


Author: Danny van den Brande, BlueCore Tech.
Hello world! This code is made for pan tilt control with a USB Webcam using servos and a PS2 Joystick..

#include <Servo.h>
Servo CAMservo1;  
Servo CAMservo2; 

const int servo1 = 5;       
const int servo2 = 6;       
const int Jstick1 = 0;        // Left right
const int Jstick2 = 1;        // Up down

int ServValue;          
void setup() {

void loop(){
    ServValue = analogRead(Jstick1);          
    ServValue = map(ServValue, 0, 1023, 0, 180);     
    ServValue = analogRead(Jstick2);           
    ServValue = map(ServValue, 0, 1023, 70, 180);     


void PrintValue(){

    Serial.print (" - "); 
    Serial.println (" Joystick Value");
Danny van den Brande

Programmer, Game Designer, 3D Designer, Web Designer, Graphic Designer. Jup this website looks crappy.. :) But enjoy the projects! Everything you need is here.

Leave a Reply

Your email address will not be published. Required fields are marked *