Skip to the content
4 layers63 × 20 mmTwinusb.kicad, the printed circuit board in 3D

H₂H³ | Twin USB Host Switch × Triple USB Hub (with OLED Telemetry)

Size
63 × 20 mm
Copper layers
4
Thickness
1.58 mm
Parts
120
Nets
85
Pads
456
Tracks, vias
1,630, 222
Pours
223
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
23 Jun 2026
Updated
12 Aug 2026

Overview

Twinusb.kicad is an open-source printed circuit board by s-t-e-f-a-n, from the s-t-e-f-a-n/twinusb repository on GitHub. It is a 4-layer board of 63 × 20 mm with 120 parts on 85 nets, routed with 1,630 tracks and 222 vias.

It is built around the STM32G0B1KBU6, GL852G-OHY60 and USBLC6-2P6, with the TPS2553DRVR-1, FSUSB42MUX and TPS2116DRL among its other parts. Its parts include 48 capacitors, 45 resistors, 14 ICs, 7 connectors and 2 diodes. It belongs with the lEDs and displays and interfaces and adapters boards and the STM32 boards of this library.

Main components

12

README

README.md

H₂H³ | Twin USB Host Switch × Triple USB Hub (with OLED Telemetry)

H₂H³ is a compact, STM32 microcontroller-driven USB 2.0 KVM switch and 3-port hub designed to maintain a clean, clutter-free workspace in modern home offices. It enables two computers to seamlessly share a single set of peripherals—like your keyboard, mouse, and flash drives—while delivering live voltage and current telemetry via an integrated OLED display. Paired with the native Rust host daemon, H₂H³ features seamless automatic host switching as your mouse reaches the screen edge, alongside intuitive configuration directly from your system tray.

H₂H³ Presentation

[!NOTE] Project Status & Contribution: This project is actively developed. The core KVM switching, screen-edge mouse transition, telemetry functionality, and host daemon communication are fully functional.

To bring this project to a 100% polished release, contributions from the open-source community are highly welcome! Whether you want to optimize edge-case handling in the C++ firmware, expand the Rust host daemon features, or help refine the documentation—feel free to open an issue or submit a Pull Request. Let's build this together!

  • Smart Break-Before-Make Switching: Advanced, software-controlled VBUS and data line multiplexing ensures safe, glitch-free transitions and isolated power rails between both host PCs.
  • Integrated 3-Port Hub: Built-in Genesys Logic controller expands a single shared USB connection into three downstream ports for your everyday desk peripherals.
  • Modern C++ Firmware: Driven by a powerful STM32G0 architecture running a modular, object-oriented C++ firmware stack with hardware-level overcurrent protection.
  • 🚀 Edge-Triggered Mouse Switching & Native Host Daemon: The onboard STM32 MCU communicates natively with our lightweight Rust host daemon via Custom HID. Move your mouse pointer past the edge of your screen to automatically trigger a host switch—just like a multi-monitor setup across two distinct PCs.
  • 🖥️ User-Friendly System Tray Controls: Effortlessly tweak hotkeys, adjust screen-edge transition sensitivity, or trigger manual host switches directly from an intuitive Windows system tray menu.
  • Live Telemetry Dashboard: A crisp, integrated 64x32 pixel OLED display provides real-time insights by showing live bus voltage and precise current draw per port.
  • Ergonomic & Screw-less Enclosure: Features a clean interface with a discreetly placed rear tactile button to prevent cable snags, all housed in a robust, snap-fit PA12-HP Nylon shell optimized for MJF 3D printing.

🖼️ Jump straight to the Photo Gallery.

🏪 Hardware Available: Skip the assembly line and grab a fully functional H₂H³ on Tindie.

🔭 Background & Philosophy

H₂H³ represents a personal exploration into modern decentralized manufacturing and open-source engineering. It blends professional design principles with modern open-source software, AI-collaborative programming to refine the C++ firmware, and on-demand fabrication. The fact that an individual engineer can now prototype industrial-grade hardware using low-volume far-east manufacturing is nothing short of incredible.

To give back to the community, the full design files—spanning schematics, mechanics, and source code—are public domain under MIT and CERN Open Hardware licenses. It is intended strictly for educational use, and community-driven remixes are highly encouraged.

🛠️ Design Stack & Toolchain

The hardware, enclosure, and software for H₂H³ were designed using the following tools:

  • KiCad 9.0: Schematic entry and PCB design for the 4-layer board.
  • FreeCAD 1.0: 3D modeling of the screw-less, snap-fit two-part enclosure.
  • Firmware Toolchain: Developed in modern modular C++ utilizing STM32CubeMX for hardware abstraction. Out of the box, the repository supports a dual-development workflow—you can build and debug the firmware seamlessly using either Visual Studio Code (via CMake/Ninja) or STM32CubeIDE, depending on your preferred environment.
  • Host Software: A lightweight background daemon written in Rust using Custom HID protocol for cross-platform control (Windows - Linux and MacOS prepared). The screenshot shows the Windows systray configuration app:
H₂H³ Host Control Daemon in Windows Systray

🛠️ Hardware Specification

H₂H³ Hardware Block Diagram
  • Microcontroller: ARM Cortex-M0+ 32-bit MCU (STM32G0B1KBU6, 64 MHz, 128 KB Flash, 144 KB RAM), integrated as a 4th peripheral on the hub.
  • USB 2.0 Hub Controller: Genesys Logic GL852G.
  • Physical Interface:
    • 2x USB-A Male (Host 1 / Host 2 upstream connections)
    • 3x USB-A Female (Peripheral downstream ports)
  • Telemetry Sensors: Continuous dual-host VBUS voltage sensing (enables auto-detection) and triple-peripheral current monitoring.
  • Switching Architecture: Hybrid automatic/software-controlled VBUS muxer combined with hardware USB data line multiplexers.
  • User Interface: 64x32 pixel OLED screen, 1x rear tactile switch button, and 1x fully programmable RGB LED (color and brightness).
  • Form Factor: Ultra-compact desktop footprint (approx. 60 × 20 × 20 mm).
252426

💻 Software & Firmware Architecture

🦀 Rust Host Daemon

Located in daemon/, this Rust application runs in the background on connected host PCs:

  • Custom HID Communication: Interfaces directly with the STM32 firmware over custom USB HID reports.
  • Screen-Edge Boundary Detection: Tracks cursor movement to trigger host transitions instantly as the mouse reaches configured display boundaries.
  • System Tray Control: Features a user-friendly system tray menu for configuring edge triggers, manual host selection, and daemon startup options.
  • Cross-Platform: Supports Windows and Linux (MAC OS prepared).

⚡ STM32 Firmware

Located in firmware/, built using STM32CubeMX for hardware abstraction and written in C/C++:

  • Fully Modular C++: Application logic is decoupled into distinct C++ modules (App/).
  • Custom HID Transport: Uses a robust Custom HID interface to communicate bidirectionally with the host daemon.
  • Switch Request Admission: Incorporates switch request evaluation logic (evaluateSwitchRequest) to ensure safe transition rules and prevent bus contention during edge triggers or manual button presses.
  • Optimized ADC Sampling: Continuous monitoring of port power states with software-side calibration.
  • Overcurrent Protection: Peripheral current draw of more than 1.5 A triggers a fault state requiring user confirmation.
  • UART Debug Console: Retargeted printf over the STM32 USART2 or USB virtual COM port.
  • Binary Programming: Powering on and holding switch button simultaneously enters the programming mode (STM32CubeProgrammer) which enables programming the ST32 integrated flash without the need for a hardware debugger

📂 Repository Structure

text
twinusb/
├── assets/                  # Public media & documentation images
├── firmware/                # Production-ready STM32G0 C/C++ firmware
│   ├── App/                 # Core Application Logic (C++)
│   │   ├── Inc/             # Application Managers (Hub, Display, Sensors, UI)
│   │   └── Src/             # Implementation source code
│   ├── Core/                # Hardware peripheral initialization (ADC, I2C, GPIO)
│   ├── cmake/               # Toolchain configuration profiles
│   ├── Libs/                # Embedded drivers & hardware abstraction libraries
│   │   └── oled_waveshare/  # Low-level 0.49" 64x32 OLED display driver components
│   ├── Middlewares/         # STMicroelectronics USB Device Library stack
│   ├── Startup/             # Microcontroller boot vector assembly code
│   └── USB_Device/          # USB CDC Class configuration and descriptor maps
├── daemon/                  # Rust host daemon (twinusb-daemon crate)
│   ├── src/                 # Rust source code (HID communication, tray app)
│   └── Cargo.toml           # Rust dependencies & package config
├── hardware/                # Electronics engineering files (KiCad)
│   ├── src/                 # Rust source code (HID communication, tray app)
│   ├── lib_fp/              # Custom PCB footprint libraries (.pretty)
│   └── lib_sch/             # Custom schematic component symbols
└── enclosure/               # Mechanical 3D CAD design (FreeCAD)

⚡ Getting Started & Building the Firmware

Cloning the Repository

bash
git clone https://github.com/s-t-e-f-a-n/twinusb.git
cd twinusb

🦀 Building the Rust Daemon

Prerequisites
  • Rust Toolchain: Install rustup (Cargo).
  • Linux Dependencies: libudev-dev (if compiling natively on Linux).
Build Commands
bash
cd daemon

# Build for development
cargo build

# Run locally
cargo run

# Build optimized release binary
cargo build --release

For Windows cross-compilation from Linux:

bash
cargo build --target x86_64-pc-windows-gnu --release

⚡ Building the STM32 Firmware

This project supports a dual-development workflow. You can build the firmware using either VS Code (via CMake) or the official STM32CubeIDE. Choose the workflow that best fits your environment. You do not need to use STM32CubeMX to build the project from scratch.


Method A: Building with VS Code (Recommended)

This method uses CMake and Ninja/Make. It requires a local ARM GCC toolchain installed on your system.

Prerequisites

Ensure you have the following installed and available in your system's PATH:

VS Code Setup & Build Steps
  1. Open Project: Open the firmware directory in VS Code.
  2. Select Compiler Kit: Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P), search for CMake: Select a Kit, and select your installed arm-none-eabi compiler.
  3. Select Build Variant: Choose either Debug or Release from the CMake status bar at the bottom.
  4. Configure Project: Run CMake: Configure from the Command Palette. This will clean-room generate your local build/ directory with the correct absolute paths for your machine.
  5. Compile: Click Build in the status bar or press F7.

Method B: Building with STM32CubeIDE

STM32CubeIDE is an all-in-one Eclipse-based IDE that includes its own compiler toolchain and internal build system out of the box.

STM32CubeIDE Setup & Build Steps
  1. Import Project:
  • Open STM32CubeIDE.
  • Go to File ➔ Open Projects from Filesystem...
  • Select Directory ➔ Choose twinusb folder and click Select Folder.
  • Click Finish.
  1. Index Project: Wait a few moments for the IDE to finish indexing the source files.

  2. Compile: Click the Hammer icon (Build) in the top toolbar, or press Ctrl+B (Cmd+B on macOS).


⚠️ Crucial Note on Code Generation (C++ Integration)

The core application logic of this project is written in modern C++ and lives inside the App/ directory (App/Src and App/Inc), keeping it cleanly decoupled from the autogenerated ST HAL layer.

If you decide to open the twinusb.stm32.ioc file to modify pinouts or peripherals via STM32CubeMX and click "Generate Code", the tools will reset the project workspace to ST's default pure-C template.

If your IDE loses track of the C++ files after code generation, fix it manually:

  • In STM32CubeIDE: Right-click the project ➔ Properties ➔ C/C++ General ➔ Paths and Symbols.

  • Under Includes, re-add the App/Inc directory.

  • Under Source Location, re-add the App/Src directory.

  • In VS Code: Simply run CMake: Delete Cache and Reconfigure from the Command Palette to force CMake to re-scan the file structure.


🏭 Sourcing the Hardware

PCB & Assembly

The schematics and PCB layout are located in the /hardware folder, designed in KiCad and optimized for automated assembly (PCBA) via services like JLCPCB.

Enclosure

Print the shell components located in the /enclosure folder. Nylon (SLS/MJF technique) is highly recommended for that professional, textured matte finish and mechanical durability.


📸 Photo Gallery

   
212223
111213
141516
171819
123
456
8910

⚖️ License

This project is licensed under different Open Source licenses depending on the component:

  • 💻 Software & Firmware (Daemon & MCU): Licensed under the MIT License (Permissive, commercial-friendly software license)
  • 🔌 Hardware (PCB & Schematics): Licensed under the CERN-OHL-W v2 (CERN Open Hardware Licence - Weak Copyleft)
  • 📦 Enclosure (Mechanical CAD): Licensed under the CERN-OHL-W v2 (CERN Open Hardware Licence - Weak Copyleft)

All components are copyrighted © 2026 by s-t-e-f-a-n who developed them with ❤️

Parts

120
QtyValueFootprintReferences
24100nCapacitor_SMD:C_0402_1005MetricC2, C11, C14, C17, C19, C22, C24, C27, C31, C32, C33, C34, C35, C36, C37, C38 +8
11100kResistor_SMD:R_0402_1005MetricR12, R14, R15, R20, R29, R30, R34, R35, R38, R39, R40
1010kResistor_SMD:R_0402_1005MetricR2, R3, R4, R5, R10, R11, R33, R36, R37, R41
610nCapacitor_SMD:C_0402_1005MetricC3, C4, C5, C6, C44, C46
610uCapacitor_SMD:C_0603_1608MetricC7, C8, C18, C23, C28, C48
54n7Capacitor_SMD:C_0603_1608MetricC1, C13, C15, C20, C25
5USBLC6-2P6Package_TO_SOT_SMD:SOT-666U4, U6, U8, U10, U14
41kResistor_SMD:R_0402_1005MetricR9, R13, R16, R17
4470RResistor_SMD:R_0402_1005MetricR8, R27, R28, R31
44k7Resistor_SMD:R_0402_1005MetricR42, R43, R44, R45
3100u 6V3 Tantal PolymerCapacitor_Tantalum_SMD:CP_EIA-3216-18_Kemet-AC16, C21, C26
339m, 1%, 100ppm/KResistor_SMD:R_0603_1608MetricR24, R25, R26
3INA180B2, 50V/VPackage_TO_SOT_SMD:SOT-23-5U5, U7, U9
3USB A, Vertical, Receptable_twinusb:USB_A_Vertical_AMPHENOL_UE27AE54100J4, J5, J6
210k_DNPResistor_SMD:R_0402_1005MetricR18, R19
216k9Resistor_SMD:R_0402_1005MetricR21, R22
21MResistor_SMD:R_0402_1005MetricR1, R23
21uCapacitor_SMD:C_0402_1005MetricC10, C12
222pCapacitor_SMD:C_0402_1005MetricC29, C30
2240RResistor_SMD:R_0402_1005MetricR6, R7
2TPS2553DRVR-1_twinusb:WSON-6-1EP_2x2mm_P0.65mm_EP1x1.6mm_ThermalViasU1, U2
2USB A, Horizontal, Plug_twinusb:USB_A_Horizontal_THTJ1, J7
110u, 60 mAInductor_SMD:L_0603_1608MetricL1
112MCrystal:Crystal_SMD_3225-4Pin_3.2x2.5mmY1
11x4, 0.8mm, Vertical, Receptable_twinusb:JST_SUR_BM04B-SURS-TF_1x04-1MP_P0.80mm_VerticalJ2
11x6, 0.8mm, Vertical, Receptable_twinusb:JST_SUR_BM06B-SURS-TF_1x06-1MP_P0.80mm_VerticalJ3
1680RResistor_SMD:R_0402_1005MetricR32
1BAT54LP_twinusb:Diodes_DFN1006-2D2
1DMN62D0LFB_twinusb:DFN1006-3Q1
1FSUSB42MUXPackage_SO:MSOP-10_3x3mm_P0.5mmU12
1GL852G-OHY60_twinusb:QFN-28-1EP_5x5mm_P0.5mm_EP3.75x3.75mm_ThermalViasU11
1LED_ARBG_twinusb:LED_RGB_Kingbright_APHF1608LSEEQBDZGKCD1
1STM32G0B1KBUx_twinusb:QFN-32-1EP_5x5mm_P0.5mm_EP3.45x3.45mm_ThermalViasU13
1SW_Push_Shielded_twinusb:SW_Tactile_SPST_Angled_PTS645Vx58-2LFSSW1
1TPS2116DRLPackage_TO_SOT_SMD:SOT-583-8U3

Similar boards

  • 4 layers431.5 × 125.5 mmClavier, the printed circuit board in 3D

    Clavier

    lsartory/Clavier

    An FPGA-based mechanical keyboard with an integrated USB hub and communication interfaces

    344 parts212
  • 2 layers30 × 33.2 mmPsvsd, the printed circuit board in 3D

    Psvsd

    Murwnas/psvsd-2040

    An expiremental PSVSD adapter based on the RP2040 chip

    40 partsGPL-3.0
  • 2 layersShell shock pcb, the printed circuit board in 3D

    Shell shock pcb

    yislennierm/ShellShock

    This is the main repo for the mister shell shock console

    30 parts
  • 4 layers40 × 68 mmKit Brainboard, the printed circuit board in 3D

    Kit Brainboard

    4ms/mp153-brainboard-pcb

    PCB for STM32MP153 brainboard

    248 parts
  • 2 layers66 × 57 mmAurora, the printed circuit board in 3D

    Aurora

    LOGDrakon/Aurora

    70 parts
  • 4 layersMinistepper, the printed circuit board in 3D

    Ministepper

    theatrus/tsumikoro

    What if you made lots of spheres roll around?

    62 parts1
  • 6 layers88.4 × 17.3 mmMain header before change, the printed circuit board in 3D

    Main header before change

    hmcneill46/house-rules-led-recreation

    Software attempt at recreating Rose Finn-Kelcey's House Rules

    49 parts

Questions

How big is the Twinusb.kicad PCB?

It measures 63 × 20 mm and has 4 copper layers, 1.58 mm thick.

What parts does the Twinusb.kicad use?

120 parts, built around the STM32G0B1KBU6, GL852G-OHY60, USBLC6-2P6 and TPS2553DRVR-1. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Twinusb.kicad KiCad files?

From the s-t-e-f-a-n/twinusb repository on GitHub, at the commit this page was made from: the board is hardware/twinusb.kicad.kicad_pcb and its schematic hardware/documentation.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Twinusb.kicad design in my own project?

Its repository states no licence, so its author keeps all rights: ask s-t-e-f-a-n before reusing the design.