Design and research — Electronics
The USB connections and the hub
ExplanationHow the Pico and the three cameras reach the Orange Pi through one powered hub, and how the software finds each of them.
AI-generated first draft. Written from the Pico firmware, the control program and the board's KiCad files, not from an actual build. The part names, pins and numbers are read from those files and have not been checked against a built machine.
Everything the Orange Pi talks to over USB goes through one powered hub. The Orange Pi has a single cable to the hub, and the Pico and the three cameras plug into the hub. This page describes that tree and how the software finds each device on it. What else the Orange Pi is connected to is on What is connected to the Orange Pi, and what the Pico is connected to is on What is connected to the Pico. Which cable goes in which socket is on Connecting the components.
The USB tree
- Orange Pi: the blue
UP USB3.0port goes to the hub. It is the only thing on the Orange Pi's USB. - The hub: a Waveshare USB3.2-Gen1-HUB-4U, four USB-A ports, powered from the machine's 24 V supply. It sits on the roof of the Orange Pi housing.
- On the hub: the Pico control board (micro-USB cable), the 4K IMX415 camera for classification, and the two OV9732 720p cameras, for detecting pieces in the C-channels and on the carousel drop plate. That is all four ports.
- Spare: the Orange Pi's other two USB ports (one USB 2.0 Type-A under the blue one, and one on the board's edge) carry nothing in the machine.
The IMX415 is a USB 3.0 camera and the OV9732 modules are USB 2.0. The two cables between the Pico, the hub and the Orange Pi, and the three camera leads, are labelled USB2 to USB6 at both ends, so you can tell them apart once they are routed.
- Every cable and its two ends: Connecting the components
- The hub and the camera cards in the catalog:
parts-calculator/catalog/parts.json(usb-hub-powered-24v,cam-imx415,cam-ov9732) - The Orange Pi's ports: Orange Pi 5
Why the hub has its own power
The hub runs from the machine's 24 V supply (its input takes 7 to 36 V), not from the Orange Pi. A hub that takes its power from the Orange Pi can let the devices on it pull the board's voltage too low when they draw a lot of current (a brownout). This shows up as a severe system crash, not as a clean USB disconnect. So the hub in the design is always a powered one, and the model matters: the Waveshare hub is the one that takes 24 V directly.
The cables between the Pico, the hub and the Orange Pi must carry data. A charge-only micro-USB cable powers the Pico and never shows it to the software.
- Powered-hub rule: Orange Pi 5
- Where the hub's 24 V lead goes: Connecting the components
How the software finds the Pico
The Pico is found by its USB ID (a number every USB device reports about itself). The control program lists the computer's serial ports and keeps only those whose vendor and product ID are 2e8a:000a, which is the Pico running the machine's firmware. On Linux it shows up as a /dev/ttyACM device.
It then opens the port at 576000 baud (the speed of the connection), exclusively, so that no second program (the UI's flasher, a probe) can talk over the control program. Each control board is asked who it is. The answer, including the names of the stepper motors it reports, selects the board profile, the stored settings for that kind of board. The search is repeated up to 8 times, 0.75 seconds apart, so a Pico that is still starting does not make the start-up fail.
A Pico that has never been flashed (loaded with the machine's firmware) is empty, so it appears as an RPI-RP2 storage drive instead of a serial port. The software cannot find it until the firmware is on it. This is normal on a new build.
Opening the port needs permission. The software ships with a udev rule (a Linux rule that sets who may use a device) for Raspberry Pi devices, vendor 2e8a. It gives the plugdev group, and the logged-in desktop user, access. The Linux installer installs it.
- The serial port, exclusive open and enumeration by USB ID:
hardware/bus.py - Discovery, retries and board profiles:
machine_platform/control_board.py - Flashing, including the blank-board drive:
hardware/firmware_flash.py - The udev rule:
software/systemd/99-sorter-pico.rules - What the Pico says over the cable: How the electronics talk to each other
How the software finds the cameras
The cameras are plain UVC video devices (the standard kind that needs no special driver), and the software finds them differently from the Pico: by their video device number, not by a USB ID. On Linux the control program lists the video devices numbered 0 to 15 and keeps those that offer capture formats (the picture sizes and types a camera can send). Asking for the formats does not open a stream, so a camera that is already streaming still shows up in the list.
Each camera has a role: C-channel 2, C-channel 3, and the carousel and classification cameras. The role is tied to a device number in the machine's configuration, and you choose which camera is which in the UI (Settings → Cameras). Nothing in the code looks at a camera's USB ID or at which hub port it is in.
If a camera stops delivering pictures, or is unplugged, the software closes it, waits, and tries to open it again. The wait grows from a quarter of a second up to five seconds. The control program reports each camera as online, reconnecting, offline or unassigned.
- Listing and assigning cameras:
server/routers/cameras.py - Capture, reopening and the backoff:
vision/camera.py, and the device wrappervision/camera_device.py - The
[cameras]keys: machine.toml reference - Choosing cameras and checking the picture: Camera calibration
Why USB cameras
- USB instead of a ribbon-cable camera. Cameras with a ribbon cable to the board (CSI) were called annoying in November 2025, and a USB cable is easier to route along the machine.
- Camera modules, not webcams. The advice in November 2025 was to use camera modules, because they have serial numbers, so the software does not depend on which USB port a camera is plugged into. On Linux that serial number gives each camera a stable device name.
- 720p on C2 and C3, 4K on C4. After tests in April 2026 a 720p camera was judged not enough for classification, so C2 and C3 kept the 720p cameras and the classification channel got a better one. It was also noted that all three channels on 720p cameras would get some way, with the classification quality varying (April 2026).
Bandwidth
The camera code is written on the assumption that the three cameras share one USB 2.0 bus on the Orange Pi. Uncompressed video (YUYV) at any real resolution would fill that bus on its own. So the default capture mode is MJPEG, which compresses each picture, at the camera's own resolution: 4K on the 4K camera and 720p on the others. The same reasoning is why the configuration reference recommends forcing MJPG on Linux with several cameras.
- The default mode and why:
vision/camera_modes.py - Per-camera capture settings: machine.toml reference
When something does not appear
- No Pico found: the machine is not powered, the Pico's cable is not in the hub, the cable is charge-only, or the Pico has never been flashed.
- Permission denied on the Pico (Linux installs): the user is not in the
plugdevgroup, or has not logged out and in again since the installer added it. - Occasional "MCU bus transient error" lines in the log: a message to the Pico was briefly damaged on the way. The control program tries each command up to 3 times, and a line followed by nothing else means the command got through.
- A camera is missing from the list: the list only shows video devices that offer capture formats, so check its cable and the hub, then assign the role again in Settings → Cameras.
- Steps for each case: Troubleshooting and First setup
- Flashing a blank board: Flashing the control board