Home office · remote boxes · updated Oct 22, 2026

USB switch wiring

The box that switches the Topping D10s between the MacBook Pro (USB 1) and the PC (USB 2). A USB-C switch board out of its case does the switching; an ESP32-S3 presses its SELECT button through a PC817, reads the selected port from the board's own port LEDs, and shows it on the OLED. The front button switches; held 2 s it turns the screen off. ESP32-S3-N16R8 dev board (U.FL antenna), shown from the component side with the USB-C ports at the top; pin names are the board's printed labels, and positions count down each header from the USB end.

Board

two USB-C ports (unused: the rear USB-B is wired to the header)ESP32-S3N16R8U.FL → antenna pigtailGNDGND rail: OLED, FILN, PC817 2 + 3, J2 GNDleft 1GND19USB-B breakout D−left 320USB-B breakout D+left 42147484503536373839470 Ω → FILN LED +left 1440FILN switch NO (C → GND)left 154142210 kΩ ← port ② LED (PC2) wireleft 18110 kΩ ← port ① LED (PC1) wireleft 19RXTXGNDGNDUSB-B breakout GNDright 15VinUSB-B breakout 5Vright 214OLED DCright 313OLED RESright 412OLED SCL (SPI clock)right 511OLED SDA (SPI data)right 610OLED CSright 7946381817161576541 kΩ → PC817 pin 1right 19RST3V3OLED VCCright 213V3

SELECT through the PC817

A 150 ms pulse on pin 4 lights the PC817's LED; its transistor then shorts SW1's signal pad to the switch board's ground, as pressing SW1 does. It can only pull that line down, never drive it, whatever pin 4 does.

PC817seen from above, the dot by pin 11LED +2LED −4collector3emitter1 kΩS3 4 (right 19)GND railwire on SW1's signal pad (3.3 V side)switch board ground: J2 GND, on the GND rail

Board pins

PinHeaderConnects to
GNDleft 1GND rail: OLED GND, FILN C and −, PC817 pins 2 and 3, J2 GND
19left 3USB-B breakout D−
20left 4USB-B breakout D+
39left 14470 Ω → FILN LED +
40left 15FILN switch NO
2left 1810 kΩ ← port ② LED (PC2) wire, read as analog
1left 1910 kΩ ← port ① LED (PC1) wire, read as analog
GNDright 1USB-B breakout GND
5Vinright 2USB-B breakout 5V
14right 3OLED DC
13right 4OLED RES
12right 5OLED SCL
11right 6OLED SDA
10right 7OLED CS
4right 191 kΩ → PC817 pin 1
3V3right 21OLED VCC

SH1122 OLED

PinConnects to
GNDGND rail
VCC3V3 (right 21)
SCL12 (right 5)
SDA11 (right 6)
RES13 (right 4)
DC14 (right 3)
CS10 (right 7)

FILN button

WireFunctionConnects to
NOSwitch40 (left 15)
CSwitch commonGND rail
+LED470 Ω → 39 (left 14)
−LEDGND rail

Switch board

PointWhat it isConnects to
PC1 LED padLit while port ① is selected10 kΩ → 1 (left 19)
PC2 LED padLit while port ② is selected10 kΩ → 2 (left 18)
SW1 signal padSELECT button (3.3 V side)PC817 pin 4
J2 GNDBoard groundGND rail and PC817 pin 3
J1 (DC5V)PowerUnused: the board runs on the computers' USB power
J8 (C-OUT)The D10sUSB-C to USB-B cable, out through the rear notch

USB-B breakout

PinConnects to
5V5Vin (right 2)
GNDGND (right 1)
D−19 (left 3)
D+20 (left 4)

Resistors

ValueBetween
470 ΩPin 39 (left 14) and the FILN LED +
1 kΩPin 4 (right 19) and PC817 pin 1
10 kΩThe PC1 LED wire and pin 1 (left 19)
10 kΩThe PC2 LED wire and pin 2 (left 18)

The switch board's J2 header shows the selected port only while one input has a computer: with both connected its pins all sit high, so the port is read from the PC1 and PC2 LEDs instead, as analog (a wire on an LED's pad reads about 2.3–3.3 V lit, 0 V unlit). The Mac connects through a USB-C → USB-A adapter and a USB-A to USB-C cable, the PC through a USB-A to USB-C cable; the D10s's cable leaves through a notch in the rear panel's bottom edge, under the antenna. Firmware: esphome/office-usb-switch.yaml; build notes: esphome/docs/office-usb-switch-build.md; panels: hammond-enclosure-panels/1455R1601BK/pla/usb-switch/.