Jump to content

- - - - -

USB remote control receiver for PowerDVD

2: Adsense

I enjoy watching films and mainly do so sitting at my desktop PC. This has taught me that cheap office chairs are not the most comfortable things to sit on for extended periods of time, especially when the next room contains a comfortable bean bag and a good place to stick a screen. A gap between the two rooms allows me to pass cables from one to the other, and after purchasing a 10m DVI-D cable and a USB extension lead on eBay I had both picture and sound sorted out (I use a USB sound "card"). This left me with one final problem: how to control the PC through a wall.

One possibility would be to extend the lead on my keyboard, but its media buttons light up (bothersome in a darkened room) and some of the keyboard shortcuts in PowerDVD (such as Ctrl+P for the popup menu when watching Blu-ray discs) are tricky to hit in the dark. Given my fondness for infra-red remote controls building a remote control receiver would seem like both an interesting and useful way to spend a weekend.

USB remote control receiver prototype using an ATmega168

Rather than build something that relied on some Windows software to translate received remote control signals into keystrokes I decided to use the free V-USB library to construct something that showed up in Windows as a standard USB keyboard. One of the sample V-USB projects is a USB keyboard, which made getting started much easier! The above photograph shows the initial prototype, based around an ATmega168. The tall three-legged component sticking up out of the board is a TSOP2438, which is an infra-red receiver and demodulator. This is tuned to the 38kHz carrier employed by most remote controls and outputs a logic low or logic high depending on the presence or absence of such a signal. The ATmega168 is programmed to time the incoming signal and passes this timing information to a collection of routines that attempt to decode it. I have currently two decoders, one for the NEC protocol and another for SIRCS — information about some common protocols can be found on this website.

The choice of these two protocols is down to the remote controls I have around me. The one that offered me the most useful buttons was the PlayStation 2 DVD remote control (SIRCS), though this is missing some useful controls, such as volume and the red, green, yellow and blue buttons. To remedy this I went and bought a cheap universal remote control from Clas Ohlson. After hunting through several of the modes I settled on the Clas Ohlson DVD one (0815) as most of the buttons work in this mode (the only unshifted one that doesn't is the record button, and I can live without it). In this mode the remote control uses the NEC protocol.

USB remote control receiver prototype using an ATtiny84

To turn the receiver into something more conveniently sized I decided to switch from the 28-pin ATmega168 to the 14-pin ATtiny84, shown in the above photograph. The compiled program was already small enough to fit into the reduced memory, and the only modification I had to make was to amend two timing routines to share the same timer peripheral as the ATtiny84 only has two timers, not the three I'd been using on the ATmega168.

I also opted to add a switch to the design. One problem with supporting both Blu-ray and DVD is that the way you navigate menus is quite different between the two; Blu-ray discs use a simple popup menu (Ctrl+P) which appears on top of the film, whereas DVDs seem to offer a number of different menu commands — the two most common ones being "Title menu" (no shortcut) and "Root menu" (J). PowerDVD also lets you choose from a list of DVD menus in a context menu with one shortcut (L). I set the button on the receiver to switch between "Blu-ray" and "DVD" modes; in Blu-ray mode, the menu button sends Ctrl+P and in DVD mode the menu button sends L.

USB remote control receiver assembled on stripboard

I bought an enclosure that is, in retrospect, a little too small. The above photograph shows the receiver assembled on stripboard with a fairly cramped layout. Fortunately there was sufficient room to include pin headers on the board, which will allow me to plug in a programmer to modify the software should I need to in the future. The LED on the front serves as simple user feedback — it flashes whenever it receives a valid command and sends a keystroke back to the PC. When the mode is toggled between Blu-ray and DVD menus it flashes to indicate the new mode — a long flash followed by a single short one for Blu-ray, a long flash followed by two short ones for DVD.

USB remote control receiver circuit in its enclosure

Overall, I'm quite happy with the way it turned out. It works well enough for my needs, though as those needs only extend as far as PowerDVD and a particular remote control it's rather basic and much more could be done with the hardware. I have uploaded the source code and a schematic for the project to my website as it currently stands for those who are interested.

Finished USB remote control receiver

Jun 07 2010 12:13 PM
You are the hero of my childhood electronic dreams. My dabbling in this stuff ended with simple "Fun, build 100 radios & flashing LED projects" kits in my youth. Your posts are always an inspiration. [smile]
Jun 08 2010 12:04 AM
Thank you! I also had those kits in my youth and whilst they sparked an interest in electronics most of the time I was simply following the construction instructions without really understanding how anything worked (or, on more than one occasion why it wasn't working). I fortunately went to a school that had an excellent electronics department that introduced me to the joys of digital electronics and microcontrollers. It's quite surprising what you can do with a cheap microcontroller and a handful of external components, with most of the hard work being done in software!

Have you considered picking up electronics again? The Arduino seems popular as an easy-to-use all in one package. After leaving school I resumed my interest in electronics with PICAXE microcontrollers, which are cheap and easy to use (programmed in a BASIC dialect) though require more equipment to get started (breadboard, wire, power supply etc).
Jun 08 2010 11:24 AM
Very nice work.

Strangely I built something almost identical this weekend, except mine is only at the plugboard and experimental stage, and I used a PIC24FJ64GB002 instead.

My motivation was that I suddenly thought "I wonder if I could play World of Warcraft with my TV remote control", so I immediately had to go and build something so I could. But it receives Infra red commands and implements the USB HID keyboard interface.

Stupid video here -
Jun 08 2010 12:57 PM
Thanks for the comments. [smile] Strange that we probably thought of similar projects at around the same time — good work with your version! It seems to do the trick from the video. I gather you mainly use PICs from your other YouTube videos — do you have any recommendations for UK suppliers? I've had to resort to Farnell for mine, which isn't ideal thanks to the £20 minimum order.
Jun 08 2010 03:54 PM
Yeah, I too was pretty much just following the instructions, although I did make an effort to try and learn about the utility of the basic components. I also did some electronics at uni, but again, it was very basic.

To be honest, I pretty much have my hands full with work, fatherhood and my current interests, but I might look to pick some of this stuff up in the future. Can you recommend any good sources for learning?
Jun 08 2010 07:59 PM
I've used rapidonline.com and farnell for my pics. I'm afraid I've not found anywhere better (and rapidonline don't have the PIC24's with USB that I've been using). I bought a couple of PIC18F2550 from someone on ebay but they weren't particularly cheap to buy that way.

The minimum order hasn't been a pain for me yet because I've needed to buy quite a lot of stuff as I only recently got back into electronics and I've had to buy a lot of tools and general components too but I do need to order more and was thinking about that cost too.

I thought that next time I order I'll simply order a selection of PICs. A few low end 8 bit ones, and a few PIC24s and I probably want both pin-through-hole for testing, and SOIC ones for making actual boards. It's a little investment but it's nice to have a few on hand for when they are needed. I also though I could perhaps buy extra to reach the next price break and see if I could sell the excess ones on ebay at a small profit. Not enough profit to make it worth the effort of selling them perhaps, but it would let me boost the order enough to reach the minimum amount, and perhaps the price break if I ordered 10 of some. I don't know how easy it is to sell PICs on ebay though. I see quite a few for sale so I assume there is some market for individual ones there. I'd probably buy them there if anyone was selling the ones I wanted.

I bought a few different PICs to start with to try out, but now I see no reason to buy anything other than the PIC24s now for anything other than the very smallest projects. They just seem better, faster and cheaper too than anything other than the very smallest 8 bit pics.
Jun 08 2010 08:00 PM
I also want to say that I like your "blog". Both the writing and also the photography and video. The quality of both puts me to shame and I'll have to try to do better now :)
Jun 08 2010 11:46 PM
Original post by LachlanL
To be honest, I pretty much have my hands full with work, fatherhood and my current interests, but I might look to pick some of this stuff up in the future. Can you recommend any good sources for learning?
I can't really think of any, sorry (I haven't found a good general electronics forum yet for that matter). I'm quite fond of my A Level textbook, Electronics Explained by M. W. Brimicombe, which covers a wide variety of topics. It's likely to be quite expensive, though, being a textbook.

Original post by jbb
I've used rapidonline.com and farnell for my pics.
I use Bitsbox for a lot of my parts (no minimum order and a fixed £1.50 postage fee). They have quite a solid selection of AVR microcontrollers, but the PICs they have on offer are not especially powerful (this is why I've tended to use AVRs over PICs thus far). I have turned to eBay for a few components (radio components and displays seem to be pretty easy to get hold of that way) though as you probably found out it's difficult to find the more powerful PICs there. It also doesn't help that the nicer microcontrollers are harder to find in hobbyist-friendly DIP!

Original post by jbb
I also want to say that I like your "blog". Both the writing and also the photography and video. The quality of both puts me to shame and I'll have to try to do better now :)
Thank you! I enjoyed watching the videos on your YouTube channel. [smile] Do you have a blog?
Jun 09 2010 01:27 AM
I started a blog a few months ago but as with most of these things I immediately forgot to update it much and it's only got a few posts. I shall write up what I've been doing recently soon. it's on http://this.domain.name/

Note: GameDev.net moderates comments.