The program is written in embedded C using Keiluvision 4.
NEC Protocol :
NEC IR protocol encodes the keys using a 32bit frame format as shown below.
Each bit is transmitted using the pulse distance as shown:
Logical '0': A 562.5µs pulse burst followed by a 562.5µs space, with a total transmit time of 1.125ms
Logical '1': A 562.5µs pulse burst followed by a 1.6875ms space, with a total transmit time of 2.25ms
When a key is pressed on the remote controller, the message transmitted consists of the following, in order:
Address | Complement of Address | Command | Complement of Command |
LSB-MSB(0-7) | LSB-MSB(8-15) | LSB-MSB(16-23) | LSB-MSB(24-31) |
- A 9ms leading pulse burst (16 times the pulse burst length used for a logical data bit)
- A 4.5ms space
- The 8-bit address for the receiving device
- The 8-bit logical inverse of the address
- The 8-bit command
- The 8-bit logical inverse of the command
- A final 562.5µs pulse burst to signify the end of message transmission.
Steps to Decode the NEC Protocol :
By using an external interrupt, we measure Time gap between two negative transitions.
If it is 13.5ms it is considered as start of frame.
If it is 2.25ms it is considered as logic 1
If it is 1.125ms it is considered as logic 0
AC Remote Protocol (VOLTAS) :
The AC remote transmits all of its parameters whenever a key is pressed. The Logic values and widths are same as NEC protocol. The frame is 67 Bits in size. Each message sent starts with a start condition (similar to NEC protocol).The message also contains 8 bits at the end representing a checksum. Note that the data transmitted is MSB to LSB but the codes are in binary reversed order.
The decoding steps are similar to that of NEC protocol.
Mode | ON/OFF | Fan speed | Sleep |
LSB-MSB(1-3) | 4 | LSB-MSB(5-6) | 8 |
Temperature | Sleep | Checksum and other bits | |
LSB-MSB(9-13) | 12 | LSB-MSB(13-67) |
RC-5 Protocol :
The RC5 code uses the bi phase modulation technique which means that every bit consists of 2 parts .A bit is always a high/low or a low/high transition. Logic zero is transmitted as a burst(train of pulses) followed by a space. Logic One is transmitted as a space followed by a burst. Hence by detecting a Low to High transition, it is decoded as a logic 0. And a High to low transition is decoded as a logic 1.
It uses a 14 bit frame as follows:
The bits are transmitted from MSB to LSB. each high and low levels are of equal length =[1.728ms/2]=0.864ms.
AGC control bit | Toggle bit | address | Command |
1-2 | 3 | 4-8 | 9-14 |
Steps to Decode the RC-5 Protocol
1. When a first pulse is detected that is when a button is pressed on the remote control a train of pulses are detected by the receiver, for the very first bit detected that is at the start of the AGC bit the receiver output goes to zero.
2. We could observe the direction of the changing at the middle of the bit that is 0.5 bit(1st agc bit) + 2bits(2nd agc bit + check bit) +5 bits ( address bits) +0.25bit (to ensure that we are correctly now present at the command bit) =7.75 bits =13.392ms. (+or - 0.1ms is ok).
3. as each bit is of two states(a high & a low) It means that the second half of the bit is actually the same meaning of the bit to be transmitted, If you want to measure the correct logic level directly from the Receiver Output, you should measure at the first half of the bit and need not to measure the whole bit length of 1.728ms.
4. Now starts your command bits with 0.25 of the bit already skipped in step2.
5. Hence now we are exactly at the middle of the “half bit” (our first command bit) .
6. We can...
Read more »