Monday, June 28, 2010

RC-5 Protocol (InfraRed)

We have all used InfraRed based remotes to control various appliances around our house. All these remote work by transmitting data in form of flashes of infrared light - and wherever one needs to transmit data, there is always a protocol involved. The RC-5 protocol from Philips has been used in TVs, VCRs and other appliances since the past three decades. It was developed by Philips but was adopted by many other manufacturers.
Now days RC-5 has been superseded by RC-6 and various other protocols from various other manufacturers. These newer protocols have better features and are more flexible. San Bergmans's KnowledgeBase on Consumer IR is a nice place to lookup information (protocol specs, circuits, embedded code) on any of the old or new IR based protocols.

Here is how a RC-5 TV remote control transmitter unit looks like:





And here is a InfraRed receiver/demodulator:



A RC-5 codeword is 14 bit long. The first two are the start bits, then comes the toggle bit and finally the 5 bits of address and 6 bits of command code. The bits are manchester encoded and use a carrier frequency of 36kHz. By carrier frequency we aren't referring to the frequency of the infrared light used (which is around 300 TeraHertz) but the frequency at which the LED is flashed on and off. What all this means is that if we want to transmit a logic zero, we flash an infrared LED 32 times at 36kHz (which takes 889 microseconds) and then keep it completely off for a time equivalent to 32 cycles at 36kHz (ie 889 microseconds). For logic one, we reverse the order (details here).

At the transmitter side, we use a transistor to control the blinking of the LED and at the receiver , a decoder, demodulates the received infrared light into pulses (which are still manchester encoded, although inverted). A common decoder used in receivers is TSOP1736.

Here is a screen shot of a 14-bit RC-5 codeword as demodulated by the InfraRed Receiver. The signal has been saptured using a sound card.



And here are a few (progressively zoomed in) screenshots of waveforms captured on a PC based Oscilloscope. The signal on channel 1 is captured on the base of the transistor controlling the IR LED on the transmitter unit. The singal on channel 2 is captured at the output of the decoder on the receiving unit. Note the obvious delay between the transmitted signal and the decoded signal. You can count the number of pulses in the transmitted half bit is exactly 32 (compare it with waveforms on the wikipedia article).






The RC-5 decoder and remote control are present on the UNI-51-SDK, UNI-51-SDKmkII and UNI-PIC-SDK. These are development kits available from UC Micro Systems. You can acquire these kits if you want to experiment with RC-5 protocol and develop application around it (like remotely switching on/off appliances)

Addendum: Here is a photo of assorted infrared devices:


The ones in the center and top right are IrDA transceivers and the rest are InfraRed Demodulators (used for RC-5 decoding)

0 comments:

Post a Comment