In this series of How To I shall emulate a IR remote control using a Texas Instruments Launchpad MSP-430G2 and few discreet components. The exercise was undertaken by me purely as a self learning exercise.
Before I proceed to the coding basics , I would like to introduce readers to the RC6 protocol and its variant 6-20. The users may ask where is this protocol used, the answer may be in your own house. The IR controller of Tata Sky (DTH service provider in India) and Sky HD in Europe DTH STBs employ the protocol.
Understanding the RC6 Protocol. RC6 protocol is a derivative of the ubiquitous RC5 protocol developed by Philips. The RC5 protocol is extremely simple, at the same time robust and very well documented. RC6 protocol on the other hand is sparsely documented and its implementation varies from one manufacturer to another. That’s extremely surprising considering its impressive pedigree. Before I go ahead, readers may be eager to know how the waveform actually looks. A partial scope-grab of such a transmission is shown below
At a first glance, it appears as a normal set of pulses differing in width and temporal separation. But then why is the pulse area shaded? Zooming in to the waveform (decreasing the time base of the scope) we can observe that each of the pulse actually consists of a set of pulses with period of silence between them. These series of pulses which are switched on and off comprise the carrier of the transmitted signal.
Lets zoom slightly more into the carrier waveform.
From the scope grab it can be inferred that the base of the carrier of the RC6 protocol is a pulse waveform of frequency 36kHz and 25% duty cycle. The carrier in itself doesn’t carry any information inside it. the information is carried in the ‘envelope’ it creates (pulses in the first scope capture).
Since, I am limited by the capture size and the display size of my DSO, I will illustrate it with a series of unique pulse envelopes contained within the transmission. There are 4 types of pulse envelopes (referred to as bits hereinafter) which serve specific purpose, they are the Leader Bit, Mark Bit (One), Space Bit (Zero) and a Toggle Bit.
Leader Bit. The width of the Leader Bit is 3.56ms. It has an ‘On’ Period of 2.68ms and ‘Off’ period of 880us. The Leader Bit is the first bit of the transmission and indicates that transmission has commenced and it enables the receiver to distinguish between two back to back transmissions.
Mark Bit & Space Bit. These bits are the real stuff that carry information and what is of interest to the receiver. The mark bit and the space bit are both 880us wide, however they differ in the way the bit envelope manifests itself. Both the bit envelopes have duty cycle of 50%. The scope grabs are self illustrative
Toggle Bit. The toggle bit is used to indicate that the transmission is repeating. It is used to sense whether the user has kept the same key pressed. The toggle bit as the name suggests toggles between when it has the positive envelope and when it has the negative envelope.
Data Encapsulation. As per material available on the internet, there are 4 bytes (varying bit length) of information contained within individual transmission. They are:-
- Mode Byte (4 bit wide) – It has manufacturer information.
- Address Byte (8bit wide) – It has device information. i.e one manufacturer can have multiple devices using the same protocol.
- S Field Byte (4 bit wide) – I have no information regarding the same.
- Command Byte (8 bit wide) – It contains the command information/code for the receiver to process.
The transmission is packaged as
LEADER BIT +MODE BYTE + TOGGLE BIT + ADDRESS BYTE+S FIELD BYTE+ COMMAND BYTE
If you add the number of bits contained in Address+S Field+Command bytes you get a total of 20 Bytes. This is why it is called as a RC6-6-20 protocol. I am yet to get conclusive information on what the middle 6 in the protocol nomenclature means. I think it has to do something with the mode field. Let me know if you stumble across some info.
In the next part, we will take baby steps into coding basic blocks that would eventually enable us to transmit a full byte… to be contd.