Coding Up a New Remote Control

I was using Philips Pronto remotes for over a decade. No more. My last one just died.

The Pronto was a really cool device when it first came out. From the beginning it included a fully programmable touch screen graphic interface and could replace a pile of remote controls with programmable automation. This was way before tablets and smart phones. You could build a glitzy interface and set one button to do multiple actions, like turn one the TV, turn on the receiver, switch inputs, turn on the DVD player, dim the lights, etc..

Due to all the competition from tablets, smart phones, and other cheap devices and apps, Philips stopped making the Pronto last year. There are now hundreds of automation options available. I started looking into what to use to replace the old Pronto, and quickly decided to take a totally different route.  I’d just code up my own.

My reasoning for this was that my media use has changed since that first Pronto. In the past I had a closet full of remote controlled equipment: VCR, DVD player, DVR, game machine, HDMI switch, audio receiver with radio antenna. No more. I now use a home theater PC (HTPC) for almost everything. We cut cable TV last year, so this machine acts as our DVR, staying in sleep mode waiting to record broadcast HDTV. We also watch movies and shows from web sites or off Netflix. We use the computer’s blu-ray player for disks. We have all our music, photographs, and home movies on a network drive, and use steaming music services like Pandora. We even listen to our local radio stations through streaming. What this means is I no longer have a closet full of equipment to control using remotes. Turning on the TV and receiver was secondary to controlling the computer.

Since this home theater computer was always waiting in sleep mode, I realized I should just do all the automation in software on the computer instead. It sounded like a fun project.

To start, I needed an IP-to-IR box. This is a small device that connects to your network that can send IR (infrared) commands like a remote control.  This device would allow me to control the TV and receiver from any computer. There are many available. I decided on the wired Global Cache IR2IP. It is well supported by other remote software, which seemed like a good backup in case I ran into an unexpected problem and decided to fallback on existing software.

Next, I needed to code up a simple interface to run macros that would send those IR commands and launch programs on the HTPC. The wireless keyboard I already owned would be the control device in the living room. In many ways, this would give me better integrated control of the computer than I had before since I could code any kind of built-in computer related action I wanted.

I admit that Version 0.1 does not have a very fancy interface. It’s just a simple menu. There’s a virtual red LED that glows when IR commands are sent. That’s it. I was planning on adding the ability to implement a cool graphic interface, but after using this simple interface I realized this was all we really need.

So, here’s how you use it. The remote control software is set to run during the computer’s startup, so it is always running in the background. It automatically hides after an assign number of seconds, so it gets itself out of the way unless you call it up. To turn all the equipment on for media viewing you use the keyboard to first wake up the computer from sleep. Because our PC uses a solid state drive, it wakes in two or three seconds. I added the ability to assign hotkeys to run macros, so one key is set as the system startup and remote launch button. Press this assigned key and a startup macro runs to automatically turn on the TV, set the TV to the correct input for the computer, and display the remote control menu. Because I use a system wide keyhook, no matter what software is running when the key is pressed the remote menu appears so you can make a new selection.

The main menu I created includes the media watching actions we use most often, and new ones can easily be added using a setup menu option under utilities. A Media Center launch is first. We just use Media Center for TV watching, home movies, etc. A NetFlix launch option is the second option. For music we use a Squeezebox server which is running on a NAS (network storage), so the third option is for the Squeezebox Player. I added a sub menu for some web TV shows we watch regularly. A weather web site link is next. If you select Wii, the TV switches to the Wii input and turns off the receiver (simply press the remote start key again to switch back to the HTPC). You can also just launch the web browser. The Power Down All option turns everything off and puts the computer back to sleep.

For those curious about what’s going on in the background, here’s a quick overview about how to setup the data files that  drive everything.

Nothing was hard coded in the interface. It’s all driven by text files stored in a ZIP file. These define menus, IR commands for devices, and action macros.

The first setup step is to define the IR controlled devices with a list of commands, like turning the TV on and off. These commands are sent through a TCP socket to the IP-to-IR device, which translates the command into an IR code that is sent out to the equipment. To create new codes you can use the IP-to-IR box, which has a reader that allows capturing IR codes from remotes, through you can also find many codes on-line using sites like RemoteCentral.

Next you write macros. A Macro is a list of actions to be taken. A “Start” macro runs when the software is first started. Each menu item runs a macro. What’s nice is I can add new macro commands as I need them.

Here’s a simplified list of what you can currently do in macros:

  • Send IR Commands.
  • Launch programs.
  • Run another Macro.
  • Change the menu.
  • Change the computer’s power state. (Includes putting the computer to sleep.)
  • Reposition and size the remote window. (In case of an overlay menu, like with TV setup options.)
  • Play sounds.
  • Show or hide the remote.
  • Display a message.
  • Send a WakeOnLan request to another computer.

Though macros are stored as simple text files, I created a list driven interface to build macros and menus. I did this because I knew I wouldn’t be adding or changing macros often, so this way I wouldn’t need to memorize commands and parameters.

Finally, it’s time to create menus, which are essentially just a list of the available macros you want to execute. You can also create a macro that changes the menu displayed, which is how you create sub-menus. It’s all very easy.

Later I could update it to allow for a fancy graphical interface, and to allow one computer (a tablet or phone for example) to run actions on another computer through TCP. That let me use a tablet (or phone) like an old fashioned remote, but I’m not sure if we need that ability right now. With a seven year old daughter, any tablet or smart phone in the livingroom would quickly be scooped up to play Angry Birds. We’d never be able to change the channel!

For now this does everything we need to replace the old Pronto. What it lacks in glitz it makes up for in pure simple functionality. Plus there’s no longer an expensive proprietary device that can break and make all that setup work obsolete! All you need to use it is a wireless keyboard and a simple IP-to-IR box. I may buy a new keyboard with back-lit keys. If using a wireless keyboard gets old, I can always get a keyboard app for most any tablet or phone.


No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.