Proton BASIC Compiler - Sky Digibox Remote and Open Keyboard Decoder

  • PicŪ Basic

  • Sky Digibox Remote and Open Keyboard Decoder

    By: Stephen Muchow

    This program performs a decode of the BSkyB 'Open' keyboard and BSkyB Remote Control Handsets. I use a PICŪ 16F877 chip running at 4MHz in the Proton Mk2 development board.( SkyKeyboard.bas ). Here is a second version developed for the Proton_IR development board ( SkyIRDEV.BAS )
    I worked out the delay times using a 20 MHz Oscilloscope and also by using Timer1 to measure the pulse widths. The delay times for a Sky Remote Control Handset appear to be a bit longer.
    I measured the average 1/2 bit times as:
    • 410 microseconds for the Keyboard.
    • 420 microseconds for the Remote Control Handset
    The pulses do not appear to have a 50:50 duty cycle and I have found that the initial delay I used could vary from 1880 microseconds to as much as 2100 microseconds with reliable results. However, the half bit delay time only worked when set to 410 microseconds for the keyboard and 420 microseconds for the remote control handset.
    NB: When using the keyboard or remote - beware of pressing the "TV/Sat" button as this changes the keyboard protocol from sky digibox to tv and I have not programmed this yet so I ignore the TV codes.
    The program outputs to the Serial Terminal at 9600 baud. It gives the source (K=Keyboard or R=Remote) and decimal value of the command received. e.g. <K 101> means Keyboard Command 101 and <R 0> means Remote Control Handset Command 0.It also flashes the LEDs with the Command Value.
    The structure of the command codes is as follows:
    Quiescent ..1111110 Signal High - Wait until pin goes low.
    Preamble 00000 Wait 5 x 410us = 2050us, effectively skipping over the preamble.
    Header or Device ID 0011 0101 0110 1100 $35 6C.
    Unused by BSkyB 1010 1010 1010 1010 1010 1010 $AA AA AA Manchester Encoding, %10 = 0 and %01 = 1, i.e. all Zeroes.
    Command Value 1010 1010 1010 1010 $AA AA Manchester Encoding $AAAA = %00000000 e.g. Key 0 on Remote.
    Quiescent 11111111.......... Signal High - approximately 120 milliseconds between each command.
    So the Coded Command consumes 7 bytes (56 bits following preamble) which we will read and store in the 7 byte
    buffer area before Parsing.
    Try it. Not the most efficient but it works. Now I'm going to write the tramsmitter. My objective is then to combine this with an RF transmitter/receiver pair and build a remote control for the Sky Digibox accessible from anywhere in the house.
    Any other suggestions for its use would be most welcome.
    November 2003