[pmf], like most of us, I’m sure, spends most of his days on a computer. He also has a smartphone he keeps at his side, but over the years he’s grown accustomed to typing on a real keyboard. He came up with the idea of making a USB switch that would allow his keyboard to control either his computer or his phone, and hit upon a really neat way of doing it. He’s using a BeagleBone Black and a Teensy to switch his keyboard between his computer and his phone with just a press of a button.
This homebrew smart KVM uses a BeagleBone Black for most of the heavy lifting. A keyboard and mouse is connected to the USB host port of the BeagleBone, and the main computer is connected to the device port. The BeagleBone is set up to pass through the USB keyboard and mouse to the computer with the help of what Linux calls a ‘gadget’ driver. This required an update to the Linux 4.0 kernel.
With the BeagleBone capable of being a USB pass through device, the next challenge was sending keypresses to another USB device. For this, a Teensy 2.0 was connected to the UART of the BeagleBone. According to [pmf], this is one of the few examples of the Teensy serving as a composite USB device – sending both keyboard and mouse info.
There are a few neat features for [pmf]’s build: the keyboard and mouse don’t disconnect when switching, and thanks to a slight modification of the USB OTG adapter, this will also charge a phone as well as allow for the use of a keyboard. Because the BeagleBone Black has more than one UART this build can also switch keyboards and mice between more than two computers. For those of us who invest heavily in keyboards, it’s a godsend.
Now it’s not uncommon to have a desktop and a laptop at a battlestation with tablets waiting in the wings. Add in a few Raspis, consoles, and various cheap computers, and it’s pretty easy to have an enormous number of machines and monitors on a desk. Traditionally, a KVM switch would be the solution to this, sharing a keyboard, mouse, and monitor with many different boxes, but this is an ugly solution. [frankstripod] has a device that fixes that with some interesting software and a few USB hacks.
[frankstripod] is in love with a program called Synergy this program combines the keyboard, mouse, and display of several computers over a network so you’ll only ever have to use one keyboard and mouse; it’s as simple as dragging your mouse from one computer to the other. There are a few limitations, though: keyboards don’t work until the OS has loaded (no BIOS access, then), it doesn’t work if the network is down, and setup can be complicated. This project aims to replace the ‘server’ part of a Synergy setup with a small, networkable KVM.
Right now the plan is to use a small embedded board running Linux to read a USB keyboard and switch the output between several computers. A few scripts detect the mouse moving from one screen to another, and a microcontroller switches USB output between each computer. If it sounds weird, you’re right, but it does work: [frank]’s 2014 Hackaday Prize project was a mouse that worked with two computers at once.
When [beerninja] wanted to swap his USB keyboard from one game console to another without mucking about with wires, he asked the Hack A Day forums for some help. [Meseta] (AKA [UAirLtd]) came to the rescue and built [beerninja] a remote-controlled USB switch.
After opening up a no-name USB switch, [Meseta] discovered that the switching is done with simple relays and switches. A hugely overpowered Forebrain ARM dev board was used to pull each switch low for a few hundred milliseconds to switch the output USB port.
For the infrared remote control, [Meseta] dug into Lady Ada’s IR sensor tutorial and decoded buttons 1 through 4 on a Sky TV remote. Each button from one to four corresponds to the buttons on the USB sharing switch. The ‘0’ button was also decoded as a convenience to put the Forebrain into its reprogramming mode. After drilling a small hole for the IR receiver, the finished project was stuffed back into the original steel enclosure.
Check out the video of the switch in action after the break.
Continue reading “Remote-controlled USB Switch”