I recently bought an Xbox One, and one of the neat things it can do is control your whole home theatre by voice command. It uses the Kinect as an IR blaster, and it can turn on and control your AV receiver, TV (or projector in my case), and TV set top box. You can even turn the whole shebang on and off by saying "Xbox On" or "Xbox Turn Off". It lets you change channels with your voice, and even gives you a really nice schedule program grid for watching TV, which is something my OTA STB (on the far left of the photo) doesn't do.
Unfortunately, there's one thing it can't do, which is change the inputs on anything, or control an HDMI switch. As you can see in the previous photo, I've got a Monoprice 4x2 matrix switch handling all my devices. It lets me take any of my inputs and send them to either the projector, or my PC monitor on the other side of the room. Normally I use a Harmony remote to control everything (to help me remember which inputs are which). The Xbox One was actually a fifth input, but that didn't matter, because the Xbox One has an HDMI input that you run your STB through. Anyhow, I really wanted to be able to turn everything on and off with the Xbox voice commands, and I noticed that the HDMI switch has a serial port on it:
It turns out that you can completely control the switch via the serial port, doing anything that the remote can do. Even better, Monoprice publishes (on their website, despite the big "CONFIDENTIAL" label) documentation on the commands you need to send to control the thing:
Serial ports are kind of hard to find on modern PCs, but I had an ARM dev board lying around. It's a PandaBoard, which has the hardware of a high-end smartphone from two or three years ago. My original plan was to stick it inside an empty NES case and use it for emulation, but that didn't pan out (not fast enough, and vsync didn't work), so it's been sitting on a shelf for ages. I thought, this thing has serial ports, and some googling turned up FLIRC, and this thing has USB ports, and even though it's got an ARM chip, you can load Ubuntu Linux onto it instead of Android... It would be crazy expensive to buy this just for this project (the board is a few hundred dollars), but since I already had the thing lying around... I figured why not put it to some use for a change. If I was doing this from scratch, I'd grab a Raspberry Pi to do it at a fraction the cost. Anyhow, here's it all wired up (albeit pulled out from the back of the shelf):
I programmed the FLIRC to send a keystroke whenever it saw the power command for my OTA STB, because the Xbox One would be the only thing that would ever send that command, and it would only send that command when it was turning everything on or off. Then I configured Ubuntu to run a script whenever it saw the keystroke the FLIRC would send, and I wrote some bash scripts:
And what's the result? It all works! The final setup is actually the *first* photo in this post, you can just barely see the PandaBoard and FLIRC hiding at the back of the shelf behind the AV receiver, out of view. I can now say "Xbox On", and the FLIRC will see the Xbox's commands, and cause my HDMI switch to get turned on and switched to the right inputs. It also turns the HDMi switch off when I tell the xbox to shut down, although the scripting on that is a little spotty (it only works about half the time), so I'll need to tweak the script to get that as solid as the power up.
Here's a youtube video of everything getting turned on. I've cut out the lengthy wait for the projector to warm up. Keep in mind that the XBox has absolutely no way to directly control the HDMI switch!