So I finally got the little passthrough box working that I'd been putting off for months. It sits between my trackball and my work laptop, and lets me flip the same mouse over to my home machine without unplugging anything. That meant I needed a chip with two USB ports, and after a lot of digging I landed on the RP2040, the one in the Pi Pico. The trick is that it only has one proper USB controller, but you can bit-bang a second port on a spare pin using its programmable IO blocks. There's a library called PIO-USB that does all the heavy lifting. I soldered a second Pico's USB connector onto some spare pins as the downstream port and honestly it just worked. Low speed and full speed devices both fine, no dropped inputs so far. Only real gotcha was power. The downstream port needs proper 5V and my first attempt back-fed it weirdly through the host, so I added a diode setup and now both machines can be plugged in at once without fighting each other. Total parts cost was about fifteen bucks and one evening of soldering. If anyone else needs a cheap two-port USB setup, this route is very doable.
Finished my two-port USB gadget over the weekend
Oct 26, 2026
Last reply: 1 day ago
3 Replies
I did something similar for swapping a keyboard between my desktop and a test bench PC, but I went a different way than PIO tricks. I bought one of those tiny inline hub boards built around the FE1.1s chip for about three dollars, cut the cable, and wired it so each upstream side runs to its own plug. Whichever machine powers up first wins the port and the other one just sees nothing. Crude but it has run for over a year without a single hiccup. Your diode fix matches what I had to do as well. Before I added mine, the bench PC would stay half awake from phantom power through the hub and the keyboard LEDs would glow all night. One Schottky on each 5V line sorted it out. If I ever need real throughput on both sides, like a flash drive instead of a mouse, I might try your RP2040 route, because the hub chip maxes out at full speed on everything behind it.
I hit the same two-computer problem with a scanner and a label printer last year, and after pricing out parts and reading through a couple of firmware repos I realized I was solving a problem a ten dollar box allready solves. I picked up one of those push-button USB switch boxes, the kind with a big physical toggle, and it has been rock solid for months. No code, no soldering, no worrying about wich machine boots first. You press the button, the devices show up on the other computer a few seconds later, done. The honest downside is the switching. With the passthrough approach you described, and with the rewired hub trick above, both machines can stay connected. My box acutally disconnects one side entirely, so the scanner has to re-enumerate every time I flip it, and Windows sometimes complains. For a printer or scanner that is fine. For a mouse I can see why you would not want that lag.
So my take is it depends on the device. For anything where a two second reconnect is annoying, building the thing yourself makes sense. For slow peripherals I would still just buy the box, expecially if the project is a one evening job rather than something you wanted to tinker with anyway. Mine has survived being yanked off the desk twice, which is more than I can say for my solder joints.
My setup is a little different though, I'm trying to get two specific sensors talking to one main computer and they both need thier own separate USB connection. I'm totally new to this kind of hardware stuff and I'm just nervous about messing up the power delivery between the devices. The RP2040 method sounds really clever, but I don't think I'm comfortable messing with the low level controller programming right now.
I was wondering if using a dedicated USB switch that just toggles the connection might be easier for a non programmer? I keep reading about how the switch solutions are just firmware based, which seems way less risky than trying to bitbang it myself. Does anyone know if there are any off the shelf hardware solutions that are designed for industrial sensor input instead of consumer gear?
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required