January 18, 2009

iPhone Home Theater Remote Control Project

Posted at January 18, 2009 11:50 PM in home theater , iPhone , web services .

"Who needs universal remotes or expensive home automation products when you have a computer in your pocket?" This is the question I asked myself a few weeks ago while growing tired of managing the four remotes and mouse and keyboard that control my home theater components. There was a break in my otherwise hectic schedule and I hadn't taken on any cool personal projects in a while, so I thought, why not build something.

In the months prior, I have built a handful of components to control my home theater components, but I have never tied them together. After all, where would I control them from? The iPhone, always being in my pocket or within an arm's reach, is the answer to that question. So, I decided to build a home theater remote control for my iPhone.

I considered writing a native iPhone application, but I don't have an Intel Mac and the investment wasn't worth it. Besides, the HTML support of the iPhone is superb and there are many templates out there for creating very impressive-looking HTML applications for iPhone.

In a few hours, I was able to piece together a nifty-looking web site that displayed my musical library. It took a few more hours to hack together the backend components and expose them through HTTP so the iPhone's browser could make AJAX calls.

Here are all the details:

Components

  • Pioneer PDP-5080 television
  • Emotiva MMC-1 preamp
  • Emotiva XPA-5 amplifier
  • PC running Vista 64
  • Foobar 2000 audio player

Interconnections and Control

  • RS-232 to TV
  • RS-232 to preamp
  • trigger cable between amp and preamp (for amp's power)
  • Foobar plugins running HTTP and socket servers for control
  • TOSLINK audio cable between PC and preamp
  • Apache HTTP server w/ mod_perl

Other Requirements

  • Music library with full MusicBrainz tags (I used Picard)

Features and Capabilities

  • Full control of preamp functionality, including power toggling, input switching, and volume control
  • Basic control of television, including power toggling and input switching (I only using my television as a monitor, so this is all I need)
  • RESTful HTTP APIs to Foobar 2000 to play or enqueue tracks, albums, artists, stop and start playback, pause, change tracks, etc
  • iPhone-optimized website to control everything and view system status
  • Bluetooth signal polling to toggle system power state (powers on when I walk in range and powers off when I leave)

Screenshots

I still have a bit of work to do in the UI department, but here are some screenshots.

Main Screen
Main Source Control
Music Index
Album List
Album Info
Emotiva Control

Future Enhancements

I currently don't have my DVR/cable tuner or DVD player bussed into my PC. Neither offers a remote control method besides IR. I will likely purchase or build an IR transmitter to control these components in the near future. (I may take the easy road and buy a TiVo, which I believe has a sufficient network-level API.)

I have built a few applications to control my home theater using voice and Vista's built-in speech recognizer. However, I don't have a good way of shipping audio from my couch to my PC. My living room layout won't allow a cable to be routed. A Bluetooth microphone is possible, but seems a little awkward. Ideally, the iPhone would record utterances and ship them, but I would need to write a native application for that. Microphone arrays (for optimal noise cancellation and audio pick-up from across the room) would be a possible solution, but I'm not satisfied with any current product.

Regarding Perl

Long-time readers may have noticed I am using Perl instead of PHP for the backend. It took a while after first exposure, but I have warmed up to Perl. Actually, it has usurped PHP as my language of choice for all areas where PHP once held the crown. There are still some parts of PHP I like better, but the language just didn't scale to meet my needs. Specifically, it didn't give me the low-level control and flexibility that Perl offers. And, CPAN puts PEAR to shame.

Trackback

You can ping this entry by using http://blog.case.edu/gps10/mt-tb.cgi/19544 .

Comments

This is very cool.
You are right, universal remote controls can be very expensive. The idea of using your i-phone for a remote is simply fantastic.

Have you thought about putting a little "how to" guide together? I bet there are a lot of techies that would flip over this and gladly pay you for it.

If you want to brainstorm on this idea drop me an email. I am serious. I might have a few ideas for you.

Frank the Atlanta home theater guy

Posted by Frank the home theater guy at January 23, 2009 04:50 PM

Post a comment










Remember personal info?