Our TV is controllable over wifi from an android app and this has proved very useful as i’m rarely seen without my phone either in my hand or at least in my pocket. The TV remote (a Harmony One universal) has a habit of hiding down the side of the couch and generally going missing. The number one use for the TV is with the Sky HD satellite box and not being able to control it from the phone was definitely inconvenient (#firstworldproblems) and it’s something i wanted to remedy for quite a while and its something i started looking at a while back.
The plan was to take a bluetooth serial module and connect it to an arduino of some description which blasted the codes via an IR LED. The bluetooth module would take commands from an Android app.
The first thing i did was search the net for a list of the Sky HD commands, i assumed these would be easy to come by but they weren’t! While there was scripts for pronto remotes these cannot be read directly for the codes, i also found codes in raw format (i.e. stated by listing the high and low times of each bit in the commands) which is far from ideal to implement in code – far too time consuming for me!
Using Ken Shirriff’s IR library and a TSOP4838 IR receiver i sat down with my original remote and got the code for each button on the remote. The IR library interpreted them as being in the RC6 format.
Button | HEX |
SKY | C05C80 |
TV GUIDE | C05CCC |
BOX OFFICE | C05C7D |
SERVICES | C05C7E |
INTERACTIVE | C05CF5 |
I (information) | C05CCB |
UP | C05C58 |
DOWN | C05C59 |
LEFT | C05C5A |
RIGHT | C05C5B |
SELECT | C05C5C |
BACK-UP | C05C83 |
HELP | C05C81 |
REWIND | C05C3D |
FORWARD | C05C28 |
PAUSE | C05C24 |
PLAY | C05C3E |
RECORD | C05C40 |
STOP | C05C3F |
RED | C05C6D |
GREEN | C05C6E |
YELLOW | C05C6F |
BLUE | C05C70 |
POWER | C05C0C |
CHUP | C05C20 |
CHDOWN | C05C21 |
0 | C05C00 |
1 | C05C01 |
2 | C05C02 |
3 | C05C03 |
4 | C05C04 |
5 | C05C05 |
6 | C05C06 |
7 | C05C07 |
8 | C05C08 |
9 | C05C09 |
Great, i had the codes and knew we were dealing with a known format, some information on the net suggested it was using IrDA but luckily that was wrong!
I made a quick circuit to repeatedly send the command for ‘Select’ and a test proved successful in controlling the box.
Now knowing that it was possible to control the box via the arduino i set about making the arduino controllable from an android app. The bluetooth module is a very common one found for sale all over the net, i got mine from Deal Extreme.
The module acts as a wireless serial port so all we need to do is send any data to the arduino and have that interpret what it needs to do. The Sky remote has 36 buttons that we need to use (the TV and volume buttons aren’t needed) which fits nicely with sending one byte of data covering a-z and 0-9. As with all my android development so far i used App Inventor, now run by MIT, to make the app.
It has a simple interface which kind of resembles the original remote layout which is fine for this first proof of concept.
App Inventor source is available to download below.
The arduino is code is also very simple, it checks if there is a byte available, if so it does a case switch and calls the relevant function which outputs the RC6 IR code. The arduino will also send a serial message back to say which code has been sent which is useful for testing as this can be read over USB to a connected computer. It is also sent over bluetooth but it isn’t currently monitored.
case 'k': skySELECT(); break;
void skySELECT(){ irsend.sendRC6(0xC05C5C, 24); // SKY HD CODE Serial.println("Sent SELECT"); }
The arduino .pde is available down below, you will need to install the IR remote library before it will compile.
For the first build hardware i’ve used one of my prototyping arduino nano boards. You can drive an LED direct from an arduino but because IR leds can take so much current i connected two in series with a 33Ω resistor for a total current of ~90mA. The only other components are a 1k resistor on the base and a 10k pullup.
I’m happy to say it worked very well, the app is very responsive with no lag or missed keys and the range was around 5 metres. The TSAL6400 LEDs used can easily take double the current i was using if more range was needed.
Arduino Code:
App Inventor Source:
tens o app pronto poderia me disponibilizar
no meu na descodificou.