The message format of Pelco-D

freeFree Technical Resource

This content is free to read, suitable for basic learning and search traffic.

The message format of Pelco-D

Product purchase:https://item.taobao.com/item.htm?ft=t&id=900569256900

Message format of Pelco-D (7 bytes)

Imagine you are writing a command letter with7 words, where each word has the following meaning:

Byte orderFunctionPlain explanationExample (hexadecimal)
1Start markerEquivalent to the "urgent!" mark on the envelope, telling the camera: "Attention, a command is coming!"0xFF(Fixed value)
2Recipient addressCamera number (e.g., Camera 1, Camera 2)0x01(Camera 1)
3Action commandControl direction: left, right, up, down0x04(Turn left)
4Auxiliary functionControl zoom (enlarge/reduce), focus (clear/blur), etc.0x20(Enlarge)
5Horizontal speedSpeed of turning left/right (0=not moving, 255=fastest)0x3F(Medium speed)
6Vertical speedUpward/downward speed (as above)0x00(Stationary)
7Verify passwordThe camera will check this password to ensure the command has not been tampered withAutomatic calculation

Let's take a practical example 🌰

Suppose you want to makeCamera 1 turn leftat a medium speed (for example0x3F), the message is as follows:

FF 01 04 00 3F 00 BC
  1. start marker: FF(fixed and unchanged)
  2. address: 01(Camera 1)
  3. direction command: 04(turn left)
  4. auxiliary function: 00(no zoom, no focus adjustment)
  5. horizontal speed: 3F(medium speed)
  6. vertical speed: 00(No change in the top and bottom)
  7. Verify password: BC(Calculated from the first 5 digits)

Key explanation

  1. How is the verification password (check code) calculated?
  • Step 1: Add the 5 digits of address, direction, auxiliary function, horizontal speed, and vertical speed.
    Example:0x01 + 0x04 + 0x00 + 0x3F + 0x00 = 0x44
  • Step 2: Take the complement of this result and add 1 (similar to the negative number in mathematics).
    For example:0x44→ The complement is0xBB→ Add 1 to become0xBC.
  • The final verification code is0xBC.
  1. . Why do we need a verification code?
    It's like the "tamper-proof seal" on a delivery package. After receiving an instruction, the camera will recalculate the verification code. If it doesn't match the one in the message, it indicates that the instruction may have been interfered with during transmission, and the camera will directly ignore it.

Common operation comparison table

ActionInstruction (byte 3)Example
Turn left0x04FF 01 04 00 3F 00
Turn right0x02FF 01 02 00 3F 00
Turn up0x08FF 01 08 00 00 3F
Turn down0x10FF 01 10 00 00 3F
Zoom in0x20(Byte 4)FF 01 00 20 00 00
Zoom out0x40(Byte 4)FF 01 00 40 00 00

In a nutshell

The Pelco-D protocol is like sending a7-word secret commandto the camera, where the first six words tell it "what to do", and the last word is a "security code" to ensure the command is delivered safely!

Related Tags
Put this resource to use in a real project?

Go to the Tool Center for message parsing, CRC verification and device debugging, or submit your requirements for selection and integration advice.

Engineer Membership

Turn this article into actionable debugging resources

After activation, you can use advanced message parsing, resource pack downloads, code examples, engineering cases and priority technical support, suitable for real project delivery.

Unlimited Advanced Tools
Resource & Code Packs
Complete Engineering Case Library
Priority Technical Support

Leave a Reply

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