Close

H₂H³ is happy to hear from you!

A project log for H₂H³ // Smart Twin USB Host Switch & Triple USB Hu

Open-source Twin USB Host Switch x Triple Hub. 4-layer KiCad 9, STM32 C++ firmware & OLED telemetry. Housed in snap-fit MJF Nylon.

stefanstefan 5 hours ago0 Comments

Hey folks, this is my first entry here!

I am glad to be here and excited to hear what you think about H₂H³!



After some pure software-related homebrew projects (like my Home Assistant integrations and extensive web scraping for PDF retrieval to feed my Paperless service), I decided it was time for a hardware project again.

On my desk, two computers share a single keyboard/mouse pair, which I always had to reconnect manually whenever I wanted to switch. I knew there had to be a way to automate this! At first, I thought about a pure hardware-based solution—it couldn't be that difficult, right? Just two "break-before-make" switches and a little hub between hosts and peripherals. But then the feature creep kicked in: It should automatically switch over if a host disconnects, it needed to measure voltage and current (yes, I am an electrical engineer 😉), a display was required, and it had to be as small as possible—maximum USB stick form factor.

I quickly realized a microcontroller was needed to keep everything under control (and to brush up on my firmware skills). I drew up some concepts, dug for components, and chose JLCPCB for prototype manufacturing. Their standard 4-layer PCB design rules guided my layout in KiCad, which worked out beautifully. Quite early on, I decided not to assemble the PCBs myself. Instead, I used JLC's assembly service, combined with parts from DigiKey that I sent to their warehouse for global sourcing.

And then, while waiting for the electronics to arrive from China, I wanted a new challenge: exploring the possibilities of modern 3D printing to design an enclosure. I had never designed a mechanical case before, nor did I have any experience with 3D printing. The learning curve was steep: learning FreeCAD concepts (and learning to love it!), checking JLCPCB’s 3D printing design rules for miniature structures, and researching snap-fit matings because the case had to assemble without any glue or screws!

When the assembled PCBs arrived, I hand-soldered the 5 THT USB connectors and the switch button. Then, I hooked up an STLINK-V3MINIE (which I had never worked with before), installed the STM32 IDE, configured the toolchain with some AI assistance, and flashed the initial bring-up code. I was blown away: within 2 hours, the fresh hardware was running perfectly. Everything that had only existed in my imagination was actually working in practice!

A few days later, the Nylon printed enclosures were delivered. And again: the snap-fits worked perfectly with a satisfying CLICK! The enclosure is an almost perfect fit for the electronics, and even the loose I2C OLED slid right into place like a charm.

I want to share my enthusiasm and all the sources—from the KiCad and FreeCAD designs to the firmware codebase of this fully functioning twin USB switch and triple USB hub.

But to be completely honest: it’s actually a four-peripheral USB hub, because the STM32 is the fourth member on the bus. Doesn't that open up so many cool applications? Just think of the STM32 acting as a native keyboard to macro-control the connected host 😉

What do you think?

Discussions