# USB Port Expansion

**Goal:** Multiple USB ports for cyberdeck peripherals

---

## Native Ports (Orange Pi 3B)

| Port | Type | Speed | Location |
|------|------|-------|----------|
| USB 3.0 ×2 | Type-A | 5 Gbps | Board edge |
| USB 2.0 ×2 | Type-A | 480 Mbps | Board edge |
| USB-C | Power only (5V input) | — | Power input |

**Total native USB:** 4 ports (2× USB 3.0, 2× USB 2.0)

Still may benefit from a hub depending on peripheral count, but the OPi3B's 2× USB 3.0 natively doubles the bandwidth available vs the OPi5.

---

## USB Hub Solution

### Why Powered Hub

| Hub Type | Power Source | Issues |
|----------|--------------|--------|
| Bus-powered | Draws from OPi5 | Voltage drops, instability |
| **Self-powered** | External 5V supply | **Stable, reliable** |

**Orange Pi 5 USB power budget:** ~900mA total across all ports.

**Device power draw:**

| Device | Draw |
|--------|------|
| USB SSD | 500-1000mA |
| WiFi dongle | 200-500mA |
| Keyboard | 50-100mA |
| Mouse | 50-100mA |
| Webcam | 250-500mA |

**Conclusion:** Bus-powered hub will cause brownouts. Use powered hub.

---

## Hub Options

### Consumer-Grade

| Model | Ports | Power | Cost |
|-------|-------|-------|------|
| Sabrent 7-Port USB 3.0 | 4× 3.0 + 3× 2.0 | Barrel jack | $20-25 |
| Anker 7-Port USB 3.0 | 7× 3.0 | Barrel jack | $25-30 |
| Anker 4-Port USB 3.0 | 4× 3.0 | Barrel jack | $15-20 |

### Industrial

| Model | Ports | Power | Cost |
|-------|-------|-------|------|
| USB Hub PCB (GL850G) | 4× 2.0 | External 5V | $8-12 |
| Industrial USB 3.0 Hub | 4-7× 3.0 | External 5V | $15-30 |

### Recommendation

**Sabrent 7-Port USB 3.0 Powered Hub**

- 4× USB 3.0 + 3× USB 2.0
- External 5V barrel jack
- Vertical orientation (compact)
- ~$20-25

---

## Connection Diagram

```
                    ┌─────────────────┐
                    │  Orange Pi 3B   │
                    │                 │
                    │  USB 3.0 ───────┼─────┐
                    │  USB 3.0 ───────┼──┐  │
                    │  USB 2.0 ───────┼──┼──┤
                    │  USB 2.0 ───────┼──┼──┤
                    │                 │  │  │
                    └─────────────────┘  │  │
                                         │  │
                    ┌────────────────────┘  │
                    │                       │
                    ▼                       │
         ┌─────────────────────┐           │
         │  Powered USB Hub    │           │
         │  (7-port)           │           │
         │                     │           │
         │  [Uplink] ◀────────┘           │
         │                     │           │
         │  [1] [2] [3] [4]    │           │
         │  [5] [6] [7]        │           │
         │                     │           │
         │  ┌─────────┐        │           │
         │  │ 5V DC   │◄───────┼───────────┼── external power
         │  └─────────┘        │           │
         └─────────────────────┘           │
                    │                      │
                    ▼                      │
         ┌─────────────────────┐           │
         │  Peripherals        │           │
         │  • SSD enclosure    │           │
         │  • Keyboard         │           │
         │  • Mouse            │           │
         │  • Misc USB         │           │
         └─────────────────────┘           │
                                           │
         Native ports still available:    │
         • 2× USB 3.0 (if not used for uplink) ◄┘
         • 2× USB 2.0 (keyboard, mouse) ◄─┘
```

---

## Port Allocation

### After Hub

| Port |Location | Purpose | Speed |
|------|----------|---------|-------|
| Hub Port 1 | Hub | USB SSD | 5 Gbps |
| Hub Port 2 | Hub | Data transfer | 5 Gbps |
| Hub Port 3 | Hub | Data transfer | 5 Gbps |
| Hub Port 4 | Hub | Data transfer | 5 Gbps |
| Hub Port 5 | Hub | Misc peripheral | 480 Mbps |
| Hub Port 6 | Hub | Misc peripheral | 480 Mbps |
| Hub Port 7 | Hub | Misc peripheral | 480 Mbps |
| Native USB 3.0 | OPi3B | Keyboard | 5 Gbps |
| Native USB 3.0 | OPi3B | Mouse | 5 Gbps |
| Native USB 2.0 | OPi3B | BT dongle or spare | 480 Mbps |
| Native USB 2.0 | OPi3B | Spare | 480 Mbps |

**Total available:** 11 ports (7 from hub + 4 native)

### Estimated Usage for Cyberdeck

- 1× USB SSD (data storage)
- 1× Keyboard (native USB 3.0 or 2.0)
- 1× Mouse (native USB 3.0 or 2.0)
- 4× Expansion ports (hub)

---

## Panel-Mount Options

For a permanent cyberdeck build, mount USB ports on the case face.

### Method 1: Panel-Mount Cables

Pre-made cables with panel-mount USB-A connectors:

- [Panel mount USB-A extension](https://www.amazon.com/s?k=panel+mount+usb+extension) (~$10-15 for 4-pack)
- [Panel mount USB-C](https://www.amazon.com/s?k=panel+mount+usb+c) (~$10-15 for 2-pack)

**Setup:**
1. Mount connectors in case face
2. Run cables inside to hub
3. Secure hub internally

### Method 2: Industrial Hub PCB

Bare hub PCB designed for integration:

- Mount PCB inside case
- Wire panel connectors directly to PCB
- Cleaner internal layout

**Parts:**
- USB hub PCB (GL850G or similar): $8-15
- Panel-mount USB connectors: $10-15
- Meanwell 5V 3A PSU: $8

**Total:** ~$25-35

---

## Power Considerations

### Hub Power Requirements

| Specification | Value |
|---------------|-------|
| Input voltage | 5V DC |
| Current | 2-4A (depending on devices) |
| Connector | Barrel jack (usually) |

### Powering the Hub

| Method | Notes |
|--------|-------|
| Wall adapter (included) | Simple, separate power brick |
| 5V from cyberdeck PSU | Integrated, requires 5V rail |
| USB-C PD | Requires USB-C hub with PD pass-through |

### Power Budget

| Component | Draw |
|-----------|------|
| Orange Pi 3B (8GB) | 3-5W |
| USB hub (self-powered) | 1-2W |
| USB SSD | 2-4W |
| Peripherals | 1-2W |
| **Total** | **7-13W** |

For portable build: 10,000-20,000 mAh battery pack with PD output.

---

## GPIO Alternative

**USB hubs do not require GPIO.**

GPIO (26-pin header) is for:
- Serial console (TX/RX)
- I2C devices (sensors, displays)
- SPI devices (LCD, flash)
- PWM (fan speed, servos)
- Digital I/O (buttons, LEDs)

If you want internal hub without USB cable:
- Use GPIO for power only (5V/GND)
- Still need USB data connection

---

## Cost Summary

| Item | Cost |
|------|------|
| Powered USB 3.0 hub (7-port) | $15-25 |
| Panel-mount cables (optional) | $10-20 |
| **Total** | **$15-45** |

---

## Recommended First Iteration

1. Buy Sabrent 7-port powered hub ($20)
2. Plug into Orange Pi 3B USB 3.0 port
3. Use external power adapter
4. Done — no custom wiring needed, and with 2x native USB 3.0, you have options for direct connections

**When you're ready for permanent build:**
- Removehub from plastic case
- Mount PCB inside cyberdeck
- Wire panel-mount connectors
- Power from internal 5V rail