Skip to main content
The lerobot-find-port command helps you identify the USB serial port associated with your robot’s motor bus by detecting which port disappears when you disconnect the device.

Command

Location: src/lerobot/scripts/lerobot_find_port.py

Overview

This interactive script:
  • Lists all available serial ports
  • Prompts you to disconnect your robot’s USB cable
  • Detects which port disappeared
  • Reports the port name for use in configuration

How It Works

The script uses a simple detection method:
  1. Scan: Lists all serial ports before disconnection
  2. Wait: Prompts you to unplug the USB cable
  3. Compare: Lists ports again and finds the difference
  4. Report: Shows the port that disappeared (your robot’s port)

Usage Example

Interactive session:

Platform-Specific Behavior

Linux/macOS

Lists all /dev/tty* devices:
  • /dev/ttyUSB0, /dev/ttyUSB1 (USB serial adapters)
  • /dev/ttyACM0, /dev/ttyACM1 (USB CDC devices)
  • /dev/tty.usbserial-*, /dev/tty.usbmodem-* (macOS)

Windows

Lists COM ports:
  • COM1, COM3, COM4, etc.

Using the Port in Configuration

Once you’ve identified the port, use it in your robot configuration:

Recording

Calibration

Setup Motors

Multiple Devices

If you have multiple robot devices (e.g., leader and follower arms):
  1. Find the first device:
  2. Reconnect first device
  3. Connect second device
  4. Find the second device:

Troubleshooting

No Port Difference Detected

Error message:
Solutions:
  • Ensure you actually unplugged the USB cable
  • Wait a moment after unplugging before pressing Enter
  • Try a different USB cable
  • Check device is powered on when plugged in
  • On Linux, ensure you have permission to access serial ports

Multiple Ports Disappeared

Error message:
Solutions:
  • Only one device should be connected initially
  • Disconnect other USB serial devices
  • Run the script with fewer devices connected

Permission Denied (Linux)

If you can’t see ports due to permissions:

Port Names Change on Reboot (Linux)

Port assignments like /dev/ttyUSB0 can change. For stable port names:
  1. Find device serial number:
  2. Create udev rule in /etc/udev/rules.d/99-robot.rules:
  3. Reload udev rules:
  4. Use stable name:

Alternative Methods

Manual Port Listing (Linux)

Using dmesg (Linux)

Device Manager (Windows)

  1. Open Device Manager
  2. Expand “Ports (COM & LPT)”
  3. Unplug device and watch which port disappears
  4. Plug back in to confirm

Programmatic Usage

See Also