IR Analyser using LPC2148 Board

This project is about Decoding the NEC and RC-5 IR Protocols which are used in TV remotes and RAW IR remote protocol used in AC remote

Similar projects worth following
We use TV remotes and AC remotes Everyday in our lives. Ever wonder how the TV or AC is able to detect the button you have pressed, and then navigate to the desired channel? This project is about decoding the signals sent by the IR remotes.
To make the IR transmission, the remotes encode the button presses by a set standard called Protocols. The most commonly used TV remote protocol is the NEC and RC-5 (Phillips) protocols and the one used in AC remotes is the RAW protocol.
The NEC and RC-5 protocol use a burst of Pulses and a 'space' to transmit data.Each bit is transmitted using the pulse distance.
Unlike a normal TV remote protocol, where only the information of the button pressed is sent, an AC remote transmits all of the parameters at once.
We use a sensor(TSOP 1838-active low) to capture the transmitted IR signal and then decode it using the LPC 2148 (ARMv7) micro-controller. External interrupts and timers are used to decode the protocol.

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:

AddressComplement of AddressCommandComplement of Command
  1. A 9ms leading pulse burst (16 times the pulse burst length used for a logical data bit)
  2. A 4.5ms space
  3. The 8-bit address for the receiving device
  4. The 8-bit logical inverse of the address
  5. The 8-bit command
  6. The 8-bit logical inverse of the command
  7. 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.

ModeON/OFFFan speedSleep
TemperatureSleepChecksum and other bits

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 bitToggle bit  addressCommand

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 »


The protocols are briefly explained and the procedure to decode them.

Adobe Portable Document Format - 429.80 kB - 11/27/2018 at 08:07



The main code for IR Protocol decoding

C Source File - 7.49 kB - 11/26/2018 at 09:37


  • 1 × LPC 2148 ARMv7 Based microcontroller board
  • 1 × TSOP 1838 IR Receiver
  • 1 × TV remote(NEC Protocol) any TV remote using the NEC protocol
  • 1 × AC remote VOLTAS AC remote
  • 1 × Jumper wires To make connections to the sensor

View all 7 components

View all 3 project logs

  • 1
    Connecting the TSOP 1838 Sensor

    The connections are made as follows :

    TSOP 1838                      LPC2148

    VCC                                 5V pin

    GND                                 Ground pin

    OUT                                 EXT INT-1 PIN(P0.3), EXT INT-2(P0.7)

View all instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates