Use Serial Communication Technology to crack the pelco-D cloud platform Control Protocol

Source: Internet
Author: User

Use Serial Communication Technology to crack pelco-dCloud Platform Control Protocol

Author: 1.1 drops of beer http://beer.cnblogs.com/

Hardware:

4.2 Smart Ball camera with cloud platform function

Ball host function:

Supports full horizontal rotation of 360 degrees, 90 degrees tilt and 2.5 times zoom. It supports 0-0xf6 preset bits, built-in decoding chip, and pelco-d Protocol to control cloud platform movements.

Solution:

1. split the cloud platform and follow the instructions of the spherical cloud platform device to pull the code switch inside the cloud platform. The device's logical address, the baud rate of serial communication, and the control protocol type (Protocol D or Protocol P) and so on.

2. Connect to the PC, program serial communication on the PC, and send the cloud platform control protocol command to control the cloud platform movement.

Development Environment andProgramming Language:

Vs2005 environment, C # language, WINXP platform.

In fact, the above mentioned platforms do not matter, because the core of the cloud platform control is to send commands, the main technology used is the serial communication technology, no matter what platform is used, you only need to send the corresponding protocol commands to the cloud platform device.

Problems:

The control protocol pelco-D of cloud platform is described in detail on the Internet. Generally, the Chinese introduction only controls the orientation of the cloud platform. For details about the pelco-d Protocol, please download the English version of the document online. This Protocol is described in detail in this document. However, it does not mean that your cloud platform supports so many powerful functions. Therefore, when controlling your device, it is best to first understand what features it supports. For example, you can also query the current position and status of the cloud platform in the D protocol.ProgramReturns a numeric value, but the general cloud platform does not have this function. In theory, the D protocol can also adjust the aperture, but obviously many cloud platforms do not have an aperture regulator on the hardware, so everything goes wrong.

The d Protocol has many sub-versions. Different cloud platform manufacturers will derive different d Protocol subclasses based on their product features. For example, when I purchased the cloud platform for development, I found that although the standard protocol can achieve simple azimuth control, but it cannot achieve the lens scaling of the cloud platform. When I suspected that the camera scaling hardware of the device was faulty, I asked the seller, and the seller said: "The device was tested before delivery, and the pelco_d_tdtc protocol was used to support scaling ". I sent the protocol of his test software to me. At this time, I realized that there are so many sub-classes in the d Protocol. At the same time, I was dizzy and did not know how to be good, because there is no such information on hand, the Reference Manual of cloud platform only has a simple page, and it is difficult to find ideas in it.

Find the pelco_d_tdtc protocol on the Internet, and fewer search results are obtained. Finally, I was bored. I downloaded a cloud platform-controlled host computer software from the Internet (for example, cloud platform-controlled host computer software of Shenzhen tomorrow industry ). Then we connected the cloud platform device and conducted a control experiment on the PC. We found that we could control the zoom of the cloud platform lens. This proves that the hardware of the cloud platform is normal, probably because its protocol command is incorrect. However, it would be too difficult to find a breakthrough from the English version of the d Protocol Specification, so I would like to find a solution to the problem from the software.

Solution:

Connect the two machines with a serial line, then one end uses the cloud platform to control the upper computer software to send commands, and the other end uses the Serial Line Debugging assistant to receive and display the commands.

Communication between two machines can be either a PC or a single-chip microcomputer. However, this requires additional devices for developers. Here, I think of a simple method to implement self-reception on the same machine.

1. Prepare a USB to RS232 adapter. Because my PC has only one serial port, you need to add another serial port. If your machine has multiple serial ports, skip this step.

2. Create a serial port connection line with both ends of the parent port. Generally, the serial port of a PC is a public port. to connect two public ports to each other, You must create a connection line. This type of finished cable is available on the market. If you can buy it, skip this step. (The "Public Header" serial port is like the left, and the "master" serial port is like the right)

The RS232 pin is defined as follows. It can communicate with only three wires: rxd, txd, And Gnd, which are receive, send, and ground wires.

The serial connection lines of self-made dual-mother ports are as follows: numbers such as, 2, 3, and 5 respectively for 3, 2, and 5

Note: The R and T on one side are connected to the T and R on the other end respectively. Because RS232 is a half-duplex communication, you must pay attention to the staggered connection during self-control, because you are working on a connection line instead of an extension line.

3. After completing the above two lines, connect the two serial ports (for example, COM1 and com3 on my machine) and start sending and receiving between two different serial ports on the same machine.

4. Enable "cloud platform Control Host Computer Software" and "Serial Port debugging assistant" on the PC, set the port numbers to COM1 and com3 respectively, and then set other settings on the serial port. After performing operations on the "cloud platform Control Host Computer Software", you can see the corresponding cloud platform control d protocol commands in the "Serial Port debugging assistant.

D mentioned in the experimentProtocol cloud platform control command:

Azimuth control:

Command

Control characters

Upper

FF 01 00 04 30 00 35

FF 01 00 00 00 01

Lower

FF 01 00 10 00 30 41

FF 01 00 00 00 01

Left

FF 01 00 04 30 00 35

FF 01 00 00 00 01

Right

FF 01 00 02 30 00 33

FF 01 00 00 00 01

Upper left

FF 01 00 0C 30 30 6d

FF 01 00 00 00 01

Bottom left

FF 01 00 14 30 30 75

FF 01 00 00 00 01

Upper right

FF 01 00 0a 30 30 6b

FF 01 00 00 00 01

Bottom right

FF 01 00 12 30 30 73

FF 01 00 00 00 01

Automatic

FF 01 00 07 00 63 6b

FF 01 00 00 00 01

Stop

FF 01 00 00 00 01

Scaling control:

Zoom wide

FF 01 00 40 00 00 41

FF 01 00 00 00 01

Zoom tele

FF 01 00 20 00 00 21

FF 01 00 00 00 01

Focus far

FF 01 00 80 00 00 81

FF 01 00 00 00 01

Focus near

FF 01 01 00 00 00 02

FF 01 00 00 00 01

Set preset points

Take preset point 1 as an example:

Set

FF 01 00 03 00 01 05

Goto

FF 01 00 07 00 01 09

Clear

FF 01 00 05 00 01 07

Zero

FF 01 00 07 00 22 2a

Take preset point 2 as an example:

set

FF 01 00 03 00 02 06

goto

FF 01 00 07 00 02 0a

clear

FF 01 00 05 00 02 08

zero

FF 01 00 07 00 22 2a

Flip (rotate 180)

FF 01 00 07 00 21 29

FF 01 00 00 00 01

Patern start

FF 01 00 1f 00 00 20

FF 01 00 00 00 01

Pattern stop

FF 01 00 21 00 00 22

FF 01 00 00 00 01

Runpattern

FF 01 00 23 00 00 24

FF 01 00 00 00 01

 

Note: There are many other advanced functions available on the "cloud platform Control Host Computer Software" interface, but my cloud platform only supports the above functions on the hardware, so I will not list more command results. I can use this method to extract any command you want.

Some of the above basic commands may also be obtained by checking the original English documents of the d protocol, but at that time, I encountered some minor problems during theoretical authentication, so it is a bit clever to solve your own problems for the time being. In the future, I will make a theoretical summary.

If you still have time, summarize the cloud platform control software you have written.

------------------------------------------------------------------

Author: 1.1 drops of beer

Email/Gtalk: dreamzsm@gmail.com

From: http://www.cnblogs.com/beer

Notes:You are welcome to paste it, but please add a link on the page to indicate the source

Time: 2010-12-8

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.