Skip to content

Instantly share code, notes, and snippets.

@ca0abinary
Created August 12, 2022 13:00
Show Gist options
  • Save ca0abinary/ee99d74ace8c5290853af911c2bc335b to your computer and use it in GitHub Desktop.
Save ca0abinary/ee99d74ace8c5290853af911c2bc335b to your computer and use it in GitHub Desktop.
Polycom MPTZ Serial Connection Reverse Engineering Notes

Polycom Eagle Eye Protocol RE

MPTZ-6

Serial connection at 9600 8-E-1

Device issues e0 until initialized with 81 40. Initialization code can be sent at any time.

import serial
s = serial.Serial('/dev/ttyUSB0',9600,parity=serial.PARITY_EVEN)
s.write(b'\x81\x40')            # init (expect a0 93 40 01 10)
s.write(b'\x82\x06\x77')        # get fw info
# these commands just expect an ok response (a0 92 40 00)
s.write(b'\x84\x43\x02\x04\x55')# set zoom 119.5 deg fov
s.write(b'\x8a\x41\x50\x3a\x03\x51\x00\x5a\x7f\x7f\x00') # set position P=97.7 T=21.8

PTZ

84 43 02 09 2b                      # zoom to 119.5 deg fov
8a 41 50 3a 02 0c 00 5a 7f 7f 00    # set position 400 200 64
                                    # API 652 218 1195
                                    # P 65.2 degrees T 21.8 degrees
                                    # Hex to Dec PTZ
                                    # 524 90 127/32639

84 43 02 09 2b                      # zoom to 119.5 deg fov
8a 41 50 3a 03 51 00 5a 7f 7f 00    # set position 600 200 64
                                    # API 977 218 1195
                                    # P 97.7 degrees T 21.8 degrees
                                    # Hex to Dec PTZ
                                    # 849 90 127/32639

8a 41 50 32 03 51 00 6d 7f 7f 00    # set position 600 100 64
                                    # API 977 109 1195
                                    # P 97.7 T 10.9
                                    # 6d = 109

84 43 02 04 55                      # zoom (84 43 02)
                                    # 092b/2347 = 64 / 119.5 deg fov
                                    # 0455/1109 = 32 /  59.7 deg fov
                                    # 022a/554  = 16 /  29.8 deg fov
8a 41 50 32 03 51 00 6d 7f 7f 00    # set position 600 100 32

Breakdown
    Send wake up                    84 43 02 09 2b
    Expect ok                       a0 92 40 00

    Move to                         8a 41 50 3a
    16 bit pan                      degrees * 10 - 128 (97.7 = 977-128 = 849 = 03 51)
    16 bit tilt                     degrees * 10 (10.9 * 10 = 109)
    ???                             7f 7f 00
@ca0abinary
Copy link
Author

Not sure, I've tested on MPTZ-6 and MPTZ-9, but I don't have an MPTZ-10. If you have the ability to test, please let me know if it works. This code is unlikely to damage a camera but be careful about how you hook up to it. The full repository is here if you'd like to contribute back: https://github.com/ca0abinary/Polycom-MPTZ-Protocol

@chaijunkun
Copy link

chaijunkun commented Oct 24, 2024

OK,I bought a breakout adapter for Polycom Eagle Eye IV which can convert HDCI camera interface to HDMI and RS232。Our campany disused a lot of that model's cameras, I plan to transform them into live streaming cameras. If it comes true, that will save much money. I can execute above commands via Raspbarry Pi 4B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment