Thursday, December 1, 2011

Control PC through TV Remote Control

Recently I attached a LCD screen to my PC to watch Movies.

While watching movies I came across the fact that I was only able to adjust Volume, Color, Contrast, etc. TV features only.

Whenever I had to play/pause the movie or control media player I had to go towards the PC keybord / mouse. I found it very irritating. Then I thought why not use the Teensy (I had got some days ago) to code something using Infra Red Receiver. So I went to my favorite electronics shop and inquired for Infra Red components. I got one IR LED and one IR Receiver (TSOP1738)
TSOP1738 Manual Here

IR Reciver Pinout:

Surprising to me this Receiver was very cheap (converted to US$ 0.40$), when I checked some circuit ideas online only this IR receiver + Teensy was needed in the circuit.

The Teensy Pinout for Arduino is as shown bellow

The circuit is so simple. Just connected GND to GND Pin of Teensy and Vs to +5v pin of Teensy.
Pardon me for such rough circuit diagram but , I didnt thought I should waste more time in circuit diagram of so simple circuit. If any one has some doubts drop me a comment and I would provide answer to queries.

Rough Circuit Diagram

After that there I used a sample program that comes with IR Library with little but modification to blink built in LED on the Teensy Bord. This Infrared dump program can be find HERE
Then I pressed buttons of Remote and Noted down the Code received by IR Circuit.

Then I wrote a new program that can control the Media Player Classic which I use to watch movies. I coded shortcut keys used by Media Player Classic in my program and executed them when received the particular code of the Remote Key.

Then I remember reading somewhere that Teensy can also move mouse. So I went ahead and mapped the Remote Directional keys to mouse. I used Mouse.move(x,y) function and mapped 4 movements of mouse to the four directional keys found on my Remote.

So the is TV remote used to control Media Player Classic and also Mouse Movement on PC.

My Code can downloaded HERE

Photo of my Circuit looks like bellow

1 comment:

anil said...

awesome sirji...
one small video of your PC-TV Remote control would be appreciated