Security Camera Hack

**I had posted a youtube video and didn't give any useful information in the video, and I HATE it when people do that, so I am putting this page up quick to help explain what is going on in the video and how to do it yourself. I will put up more pictures and wiring diagrams as I get it done.**

The goal of this is to hack a Hitachi VK series security camera (PTZ) and make it work on an Arduino. Removing the dependence on the VERY expensive proprietary hard ward from security vendors. While I have no doubt that this is a BAD idea for business, for the individual that stumbled across a security camera, This is gold!

A friend of mine contacted me to let me know his company was purging all there Bosch security PTZ cameras and that I could have the lot. SWEET!!!! When I tore one down, I noticed it had a Hitachi security camera and that the serial protocol seemed to be the same as several other security cameras I had worked with in the past (including Panasonic and one other model I don't recall off the top of my head) but all were in vivotek or Bosch security cameras.


This camera is very common and easy to find on ebay or at your local government auction sites.

The guts of this camera look something like this:

**I have attached all the docs I found helpful at the bottom of this page, I will add a list of cameras this works on as time goes on**

On the back of this camera it has a slip ring that breaks out the ribbon cable to wires on the bottom, this also includes the stepper motor leads and usually the end stop for the Y axis (Tilt). In my case, 5 minutes with a multi meter and I was able to tone out each wire. If you cant do this step, perhaps this project isn't for you.

Joystick: (2 joysticks, one pan one tilt)

https://solarbotics.com/product/29114/

I love this joystick, Clicking the joystick results in analog value of 1023 and movement ranges from 200 to about 600 in ether direction.

I used some products from Solarbotics.com to interface these parts with:

Arduino Mega: https://solarbotics.com/product/50452/

I use the mega for everything, it has so many pins its awesome, but really an UNO would be fine.

Stepper motor driver:

In the demo code, I used a old out of date motor driver shield, but I will be swapping to the BigEasy because its a great driver:

https://solarbotics.com/product/50866/

The Motor driver shield keeps over heating because the motors are capable of drawing up to 2.5 amp and the shield is meant for a max of 1.5 amp at peak. So I am using a power supply with current limiting to prevent it from exploding :P

Here is a video showing it run, I did this video to make it easier for a friend who is helping me solve a speed issue to understand.

https://youtu.be/dBtoHGaoaxw

This is supposedly the pin out of the connector on the Hitachi, turns out for some reason pin 1 to pin 9 are reverse. Otherwise its correct.

Here is the sample code so far, KEEP IN MIND! this does not use the optical home on the bottom of the camera (Pan) or the limit switch in the head (tilt). it just uses the joysticks to control movement.

;#######################START#########################
#include <AFMotor.h>
//JOYSTICK NOTES:
//A4 - 519 - 0    PAN RIGHT
//A4 - 519 - 1024 PAN LEFT
//A5 - 506 - 0    TILT UP
//A5 - 506 - 1024 TILT DOWN
//A2 - 755 - 530  ZOOM OUT
//A2 - 500 - 265  ZOOM IN
//A2 - 530 - 500  ZOOM NUTRAL
//The serial settings for Hitachi VK series (verified with Hitachi VK-S914)
//Serial1.begin(4800, SERIAL_8E1)
// motor port #2 (M3 and M4)
// motor port #1 (M1 and M2)
// 612 is the number of steps for a 1.7o stepper
// 200 is the number of steps for a 1.8o stepper
// 48 is the number of steps for a 7.5o stepper (never heard of one, but it was in the sample code)
AF_Stepper motorX(612, 1);
AF_Stepper motorY(612, 2);
int maxX = 40; //Max PAN LEFT RIGHT (X) speed
int maxY = 10; //Max TITLT UP DOWN (Y) speed
int varY = analogRead(A5);
int varX = analogRead(A4);
int varZ = analogRead(A2);
int varMap = 0;
int lastAct = 0;
void setup() {
  Serial.begin(9600);
  Serial.println("Camera Controller - Test Code");
  Serial1.begin(4800, SERIAL_8E1); //The serial settings for Hitachi VK series (verified with Hitachi VK-S914)
}
void loop() {
  varY = analogRead(A5); //Tilt
  varX = analogRead(A4); //Pan
  varZ = analogRead(A2); //Zoom
  if(varZ > 530 && varZ < 760) { //ZOOM OUT
    Serial1.println(":WFCBB9B"); //Command to start zoom out
    lastAct = 1;
  }
  if(varZ < 500 && varZ > 260) { //ZOOM IN
    Serial1.println(":WFCBB99"); //command to start zoom in
    lastAct = 1;
  }
  if(varZ < 530 && varZ > 500) { //STOP ZOOM
    if(lastAct == 1) {
      lastAct = 0; //used to prevent excesive serial writes because it slows the camera
      Serial1.println(":WFCBBFE"); //command to Stop zoom in
      Serial1.println(":WFCBBFE"); //command to Stop zoom out
    }
  }
 
  if(varY > 510) { //DOWN
    varMap = map(varY, 510, 1024, 1, maxY);
    motorY.setSpeed(varMap);  
    motorY.step(1, FORWARD, SINGLE);
  }
  if(varY < 490) { //UP
    varMap = map(varY, 0, 510, maxY, 1);
    motorY.setSpeed(varMap);   
    motorY.step(1, BACKWARD, SINGLE);
  }
  if(varX > 550) { //RIGHT
    varMap = map(varX, 550, 1024, 1, maxX);
    motorX.setSpeed(varMap);  
    motorX.step(1, FORWARD, SINGLE);
  }
  if(varX < 500) { //Left
    varMap = map(varX, 0, 550, maxX, 1);
    motorX.setSpeed(varMap);  // 10 rpm  
    motorX.step(1, BACKWARD, SINGLE);
  }
}
;########################END##########################