1U 3-port KVM-over-IP console appliance using PiKVM (Raspberry Pi 4B)
I built a 1U small form-factor KVM console for remotely managing laptops on my home network. This project was powered by PiKVM, an innovative open-source solution.
I got the idea for this project when I first came across PiKVM, a really impressive project created by Maxim Devaev. There is also a similar project I've come across called TinyPilot which seems to borrow tech developed by the contributors to the PiKVM project.
1U 3-port KVM-over-IP appliance using PiKVM (Raspberry Pi 4B)
I have a couple Macbook Pros that I use for work, each of which needs to be able to independently connect to corporate VPNs. Traditionally, I've used a KVM switch like this one which works pretty well for switching between devices and allows you to connect a couple USB peripherals. My main issue with it was the delay between switching certain devices. Sometimes I'd have to wait 5-10 seconds before the device would respond and allow me to begin working with it (particularly with Macbooks using cheap USB-C dongles). Another disadvantage is the lack of the ability to work on two devices at the same time, which is a major benefit of the KVM-over-IP approach.
In my Homelab, I already had a 1U server chassis with 5 Raspberry Pi 4Bs that I had originally planned to run as a Kubernetes cluster. I ended up moving in a different direction with that project, finding that the cost/performance ratio of a Raspberry Pi cluster was really not worth it, but that's a discussion for another time. After reading up on PiKVM, I decided to repurpose the 1U Pi cluster as a KVM appliance, with 2 Pis to handle my 2 Macbook Pros, and an extra one that I could use for any other device I might want to access remotely (for example, I used this to install and configure pfSense on a device in my rack from the comfort of my couch).
- 3x Raspberry Pi 4B 2GB RAM - the 2GB model seems to be more than enough to handle running PiKVM, and I haven't had issues so far
- 3x 64GB Samsung SD card - decently priced SD card - if you don't plan to upload any ISO images through PiKVM, you could use a pretty low-end card here, as there is not much disk io that needs to go on.
- 3x HDMI-in (HDMI to CSI-2) Module - these are pretty pricy at around $34 shipped. I was able to find them on eBay for a couple dollars less, but I would prefer to spend a bit more to buy this from a US seller with free returns in case I get a defective one. Luckily, 3/3 worked in my case. I also ordered spare ribbon cables just in case I broke the ones that come with it (haven not needed them yet).
- 3x FLIRC Case for Raspberry Pi 4 - While this case doesn't leave room for any of the PoE hats I've seen for the RPi 4, it is my favorite one as it looks nice, cools the Pi extremely well (and silently), I always opt to use them even though it forces me to use an external PoE splitter. They also allow access to the GPIO pins while closed (we will use this space to run the HDMI-in cable) and in this application the rubber pads allow it to be quickly attached/detached from the chassis.
Most of the components in this build are powered by PoE - if you don't have a PoE enabled switch, you could use a PoE injector or simply sub in 12v and 5v AC adapters here. The fans would do fine with an adapter rated for 1A, if you are using a 5V AC adapter to power the 3 Pis, I would go with at the least a 5V 4A rated power supply. You could also power the fans off of that supply, but make sure you opt for 5V fans instead of the 12V fans I used.
- Macbooks: Macbook Pro chargers can be pretty bulky, and I wanted a way to cleanly fit 2 of them into the appliance. The stock Apple chargers are thin enough to fit in 1U but take up a lot of space. I landed on this charger. This "RAVPower" one was actually able to reliably charge the Macbooks and fit comfortably in the 1U chassis, allowing me to place the cover on top. To power both of these with 1 AC cord, I used this cord, which splits power from an AC 2-prong plug to 2 "figure-8" female connectors.
- Fans: for the chassis fans I opted for a 12v PoE splitter and a barrel jack to 2 pin fan adapter
- Raspberry Pis: the Raspberry Pi's are each powered by a UCTRONICS 5v PoE splitter - I've had good luck with this particular one, but be vigilant (and patient) with these - as some brands have worse quality control than others, and you might get one that doesn't actually pass data. Test them and be sure to get them replaced if so. I also used 3 of these power splitters so I could power the Pis and use the USB OTG port at the same time. You could skip buying these in two ways: 1) twist/solder the splitter cable yourself 2) power the Pi's using a PoE hat or from the 5v / GND pins - then the USB C port will be freed up for you by default.
- 2x Apple USB-C multiport adapter - I used these relatively pricey dongles because of the issues I've seen with generic adapters either crapping out or causing delays in display being recognized
- 2x USB-A to USB-A cables + 2x USB type A female to USB type C male adapters for connecting dongle to USB-C splitters
- 2x USB type C charger cables to plug the chargers into the dongles
I also got some assorted short cables/couplers to allow me to more neatly organize the cabling without needing to solder/twist wires:
- 3x USB type C right-angle adapters
- 2x USB type C female-female couplers
- 5-pack USB c 6" cables
- 2x Thunderbolt compatible extension cables - these are an important part of the build, as they will allow you to cleanly connect the dongles to your laptops - they need to be "Thunderbolt" compatible and a standard USB-C cable will likely not work.
- 1x iStarUSA 1U server chassis - this is a pretty cheap and versatile 1U short-depth (less than 10") rackmount case. I have seen the price fluctuate between $40-$55 USD on Amazon.
- 2x Noctua 12V 40mmx20mm PWM fans - PWM functionality is not used here and is not necessary - I just have a bunch of these on-hand since I use them in 1U builds.
Please have a look at the imgur gallery to see the progression of the build. I began by using double-sided mounting stickers to stick everything to the chassis, but then upgraded to hot glue, which I found did a much better job of keeping everything secured in place. The hot glue made a huge difference with the fans, helping to limit vibrations and noise.
I made sure to test all components before actually gluing them, and once I was able to verify all the Pis would actually boot up with PiKVM installed on the SD cards, I got to configuring them. The installation is pretty straightforward, just follow the instructions on the PiKVM GitHub repo. It's been about a month since getting it all up and running and I haven't really had any issues - it's basically just been plug and play.
Happy to hear any thoughts, comments, suggestions, etc. or if you've done a related build. Thanks!
Please note that I only link products that I have bought and tested myself, and some of the links above are Amazon affiliate links, which I earn a commission from (at no additional cost to the buyer).