Skip to content

Directed Perception Pan–Tilt Unit (PTU)

Jgocunha edited this page Apr 1, 2026 · 1 revision

This page describes how to connect and control the Directed Perception PTU-46-17.5 Pan–Tilt Unit on Ubuntu 22.04 using a USB-to-RS232 adapter.

The PTU is used to position the ZED 2i camera over the workspace.


1. Identify the USB Device

Plug in the PTU adapter and check which serial device was created:

dmesg | grep ttyUSB

Example output:

usb 3-2: ch341-uart converter now attached to ttyUSB0

This means the PTU is available at:

/dev/ttyUSB0

If you unplug and replug the adapter, a new /dev/ttyUSBX device should appear.


2. Add Serial Port Permissions

If you do not have permission to access /dev/ttyUSB0:

sudo usermod -a -G dialout $USER

Then log out and log back in.


3. Connect to the PTU

Install screen if needed:

sudo apt install screen

Connect to the PTU:

screen /dev/ttyUSB0 9600

If you cannot see what you type:

Ctrl + A → : → echo

To exit screen:

Ctrl + A → \ → y

4. Testing Communication

After connecting, try typing:

POS

If the PTU responds with:

! Illegal argument

This is actually good — it means the PTU is responding, but the command format is wrong.


5. Correct PTU Commands

The PTU requires axis-specific commands.

Command Description
PP Pan position query
TP Tilt position query
PP593 Move pan to +10°
TP-297 Move tilt to -5°
PS 1000 Set pan speed
TS 1000 Set tilt speed
R Reset / Home

Example commands:

PP
TP
PP593
TP-297

6. Units and Motion

The PTU uses counts, not degrees.

Approximate conversion:

59.3 counts ≈ 1 degree

Examples:

Degrees Counts
10° 593
30° 1780
-5° -297
-10° -593

7. Typical Setup Position

In the experiment, the PTU tilt is typically set with:

TP-800

This positions the camera correctly over the workspace.


8. Serial Communication Notes

Setting Value
Baud rate 9600
Data bits 8
Parity None
Stop bits 1
Mode 8N1

Important notes:

  • Commands are case-sensitive
  • Commands must end with carriage return
  • If you see ! Illegal argument, the command format is incorrect
  • PP and TP without numbers return the current position

Quick Summary

Typical PTU workflow:

dmesg | grep ttyUSB
screen /dev/ttyUSB0 9600
TP-800

The camera should now be positioned correctly.