I don't subscribe to cable and get most of my video content from Netflix, Hulu and YouTube which is consumed through an Apple TV or Chromecast. This means I can mostly control my TV from my phone, which is always by my side. Unfortunately, changing the input, volume or powering on my TV means I have to use the provided remote. This is a massive pain because I'm constantly losing the device. I end up tearing my living room apart to often find it left in the bathroom or some other random location. After the umpteenth time I decided I was going to do something about it. The solution I came up with was a simple iOS application paired with an Internet connected micro-controller.
- Spark Core
- IR Led Kit
- Breadboard and various hookup wires
- iOS device
- Basic Television (mine is an Insignia)
The signal between a remote control handset and the device it controls consists of pulses of infrared light. The Spark Core, wired up with an IR led, simply mimics these pulses to control the television. Thanks to the wireless capabilities of the Spark Core, commands can easily be sent from any Internet connected device, in my case an iPhone.
Different manufacturers of infrared remote controls use different protocols to transmit the infrared commands. Thankfully, most televisions protocols and codes have been mapped by the Linux Infrared Remote Control project.
Although, my Insignia television had the protocol and basic functions mapped, it was missing several key commands. A little light reading on the protocol (NEC) enabled me to write the following script.
Essentially the script determines which hex codes are missing from an NEC mapping. Instructing the Spark Core to execute a given infrared command and watching the TV's response allowed me to complete the mapping.
The code is available on GitHub here. I'm not an iOS developer so I thought it would be fun to learn Swift as well. Apologies in advanced for any poor practices. Also a special thanks to Gaspard van Koningsveld as I made use of his Spark Core IR Library.
Both my bedroom and living room televisions are from the same manufacture and consequently use the same protocol and commands. I have built in the functionality to switch between Spark Cores. It would also be useful to switch between remote protocols and codes. Finally, I plan on using this project as an excuse to get a 3d printer. This will enable me to create an eye pleasing enclosure.