I have three computers at my desk for photography, my PC Gaming, and my work as a Software Engineer. I like to use the same display(s), keyboard, mouse, and even webcam with all of them at my desk. This means that I need to be able to quickly switch some USB devices and the video signal between the three computers rapidly. This is traditionally solved by using a device between your keyboard, video signals such as HDMI or Display port, and a Mouse that typically tries to determine whether you want to switch the currently displayed computer and to which one is connected.
I am used to having dual displays, which means that a KVM that supports the latest video signal technologies costs money and typically has subpar compatibility with all of the features or forces intelligent features at all times.
I don’t want a device trying to make decisions and relaying those to my computer. These decisions are like whether or not I can use my QMK keyboard. Does the Mouse being moved near the corner of a display indicate you want that magically positioned computer to be selected as the displayed computer, or even more simply that, The KVM can only handle 4k60? So it prevents 4k120 from being allowed through it.
I recently stumbled across a mac app called Better Display Pro, which was fantastic. One of the menus had the option to change the monitor’s input source. This level of control over a video signal led me to realize I could programmatically control the input signal if the device connected to the display could detect the intent of where I want the signal to be set.
I set it up, and it worked using a couple of cheap apps for macOS, but this left me realizing. It is dependent on the apps running on 2/3 of computers. There wasn’t a readily available adaptation I could use quickly on my windows PC. This made me realize that if I ever connected a 4th computer, I wouldn’t be able to switch between all of them if that computer was not a Mac running the software.
I did some quick googling, and one of the top libraries for communicating with the display is DDCUtil, and it had instructions for setting it up on a Raspberry Pi 4, 3 B+, and two even. These computers are microcomputers that can run a basic Linux Operating system at slower performance, but they only cost about $40. I had my Raspberry Pi 4 across the room doing nothing, so I thought I would move it to my desk and create a simple web server script that allows it to send the correct video signal selection commands via a LAN webhook or URL that devices on my local network can request.
I wanted to control it with Homekit, and the Native home kit allows for basic webhook requests thanks to the not-so-recent Shortcuts addition.
That said, I wanted to avoid using expensive components, and the flic two buttons are fantastic, and I have plenty of them. I wanted to have something more affordable to control the KVM. Let’s solve the USB devices before settling on the Human Interface Device to switch the selected displayed computer.
I ordered a four-computer USB 3.0 hub with an IR remote with dedicated buttons for each input. That was an easy find on Amazon.
I then realized I should find an IR transmitter with a Raspberry Pi. I stumbled across an adapter called Flirc, and it was definitely within the price range I was looking for looking up forum posts; it should be able to transmit IR signals to the USB hub.
I used the Flirc mac app to capture the IR codes that the USB hub remote transmitter. Flirc has apps for Windows too, and it was super easy to get the long pattern of IR signals that the Flirc Cli needs to be able to transmit them.
I updated my PHP script to send these patterns out and immediately had a functional KVM Prototype.
I was ready to get a physical button to control the Raspberry Pi directly. I had a Stream Deck in storage and thought that would be perfect. However, I could not get the abandoned Linux GUI that can run it to work on my Raspberry Pi, and I didn’t want to rely on any of the KVM computers to be responsible for sending the signals to the Raspberry Pi to switch inputs.
I found a super cheap 12-key macro pad on amazon that can be configured using a website. The reviews were hit or miss, but the code for the website seemed still actively maintained. So I ordered it and, a few days later, could program it to the Raspberry Pi, and it is working great.
Ironically right after I got this working so well, the leading KVM brand finally got inventory the day after I built this. However, I have been thrilled with how stable using a Raspberry Pi is to control my selected devices, so I decided to wait to buy a traditional KVM until this doesn’t work for me if that ever happens.
Relatively simple to configure:
1. capture IR codes of the USB hub
2. Update the web server configuration to fit your setup.
3. install a web server to run the KVM
4. configure the keyboard shortcuts used for the selections.
No Passthru is needed resulting in zero signal degradation.
Interchangeable parts if they break down.
$20 Power and Video signal cables for Raspberry Pi
Total Cost: $174
My cost of reusing my rPi4: $98