Powered By Blogger

Monday 25 July 2011

How to check that PTZ is working on a DVR/Codec that uses the Pelco D protocol

Sometimes if a PTZ CCTV camera doesn't PTZ (Pan, Tilt & Zoom) then it may not always be the camera that's at fault! It could be the device that controls it whether it be a DVR or a codec. To test this isn't as hard as it seems. You will need the following:
Run Realterm on your laptop and setup the following:
  1. On the Display tab (under Display as) select Hex (space)
  2. Next to this on Data Frames change the Bytes to 7 and click single
  3. Make sure to click Change which will save these settings
  4. Now click on the Port tab and select the Com port you have your 232-485 converter on and select the correct Baud Rate (the cameras we install are usually on 2400 baud).
That's Realterm setup ready. Now connect the RS485 input of your converter to the output of your DVR/Codec (making sure that + goes to + and - to -). When finished if you logon to your DVR/Codec and select the camera who's PTZ output your testing and tell it to move the camera you should see some hexadecimal bytes appearing in Realterm.

If you don't see any data then check your Realterm settings (mainly com port and baud rate) and check your connection. Another even simpler test to see if the RS485 output of your DVR/Codec is working is to put an LED on the output (making sure + goes to the anode (longer leg) of the LED and - goes to the cathode). Make sure the LED is a simple red type and not blue! Blue LEDs require a larger forward voltage to turn them on which RS485 won't provide!!

When you do have Hex on your screen in Realterm you can now see if it's outputting what it should.

The first thing to look at is that each command starts with FF. This is fixed and cannot be changed so if this is wrong you've found your fault. The next byte is the camera number; again if this number is different (i.e. says 2 when you know the camera ID is 1) then again you've found a fault. They are the two main items I check when troubleshooting.



Pelco-D consists of 7 hexadecimal bytes (all byte data used in this page are in Hexadecimal format unless otherwise noted)
Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7
Sync Camera Address Command 1 Command 2 Data 1 Data 2 Checksum
  • Byte 1 (Sync) - the synchronization byte, fixed to FF
  • Byte 2 (Camera Address) - logical address of the camera being controlled (Address 1 is 01)
  • Byte 3 & 4 (Command 1 and 2) are shown below
  • Byte 5 (Data 1) - pan speed, range from 00 (stop) to 3F (high speed) and FF for "turbo" speed (the maximum pan speed that the device can go)
  • Byte 6 (Data 2) - tilt speed, range from 00 (stop) to 3F (maximum speed)
  • Byte 7 (Checksum) - sum of bytes (excluding the synchronization byte), then modulo 100 (Decimal code: 256)
Command 1 and 2 details
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Command 1 Sense Reserved Reserved Auto / Manual Scan Camera On/Off Iris Close Iris Open Focus Near
Command 2 Focus Far Zoom Wide Zoom Tele Tilt Down Tilt Up Pan Left Pan Right Fixed to 0
Example (Command 2):
Pan Left - 0 0 0 0 0 1 0 0, which equals to 04 (both hexadecimal and decimal)
Some other commands
Command Byte 3 Byte 4 Byte 5 Byte 6
Go to Preset 00 07 00 01 to FF
Set Zoom Speed 00 25 00 00 to 33
Set Focus Speed 00 27 00 00 to 33
Alarm Ack. 00 19 00 Alarm no.

Tuesday 19 July 2011

TV with an IP!!!!

10 years ago, I was living with my folks still (took a while to cut the apron strings I know).
My humble PIII computer with it's HUGE 17" CRT monitor connected to the world wide web via a Elsa 56k USB modem (which I thought was cool as it was bus powered and sat on top of my tower looking sweet!!).

So my PC was the only device in the house to have an IP address when connected to the internet (well I did have some other PCs that I setup as servers when I was playing with Novell Netware and Windows NT4 server.

A couple of years later and I finally have my own place!! But still I have a PC in the spare room with a BT (manta ray horrible looking) ADSL modem (512k downloading pleasure) and again my PC is the only thing in the house with an IP address.

Today the following devices in my house have an IP address:
  • My laptop that I'm writing this ramble on
  • My media centre PC that stores all my DVDs
  • My Wii console
  • My router (goes without saying really)
  • My mobile phone (wireless and 3G)
  • My TV!!!!!!!
What on earth next!!! My central heating boiler, my fireplace, me settee!!!! My wife :-)