DIY Remote Control IR Receiver / Decoder
by GreenPAK™ in Circuits > Electronics
7 Views, 0 Favorites, 0 Comments
DIY Remote Control IR Receiver / Decoder
This design is a configurable remote control infrared receiver and decoder. It also performs address and command comparison, and provides a matching true indicator. It is designed compliant with the NEC protocol, and can be configured for any 8-bit address and remote control command. The NEC protocol uses “pulse distance” encoding of the bits. Each pulse is a 560µs long pulse burst with 38kHz carrier (about 21 periods). A logic "1" takes 2.25ms to transmit, while a logic "0" is only half of that, being 1.125ms. The typical carrier duty-cycle is 1/4 or 1/3 for optimum range and power considerations. Figure 1 shows a typical pulse train of the NEC protocol. LSB is transmitted first. A message is started by a 9ms AGC burst, which is used to set the gain of some IR receivers that might require it. This AGC burst is then followed by a 4.5ms space, which is then followed by the Address and Command.
Address and Command are transmitted twice. The second time all bits are inverted and can be used for verification of the received message (redundancy).
The total transmission time is constant because every bit is repeated with its inverted length. The range of addresses and commands can be extended to 16bits each by not using the inverted values (Extended protocol). A command is transmitted only once, even when the key on the remote control remains pressed. Every 110ms a repeat code is transmitted for as long as the key remains pressed. This repeat code is simply a 9ms AGC pulse followed by a 2.25ms space and a 560µs burst. More information on the protocol is available at: http://techdocs.altium.com/display/ADRR/NEC+Infrar...
In this design implementation we convert a serial input data stream to parallel, and then compare the values against stored addresses and commands. To convert input data from serial to parallel we need to first extract the clock signal, enable signal conversion, and then the data.
Below we described steps needed to understand how to program the remote control IR receiver / decoder. However, if you just want to get the result of programming, download GreenPAK Designer software to view the already completed GreenPAK design file. Plug the GreenPAK Development Kit to your computer and hit the program to create the system.
IR Receiver Circuit Design
As can be seen in Figure 3, to prepare data for conversion one DFF, two 3-bit LUT, two 2-bit LUTs, three CNT/DLYs, one P DLY, RC OSC, POR, three PINs were used.
Data start is detected by using components connected in the following sequence: 2-bit LUT1 and CNT1/DLY1 detect 9ms from signal sequence, while 2-bit LUT2 and CNT2/DLY2/FSM0 detect an additional 4.5ms from signal sequence.
Clock signal (CLOCK_OUT) is generated by: 3-bit LUT0, CNT3/DLY3/FSM1 and 3-bit LUT3 (uniting the result of start sequence: 9ms and 4.5ms) followed by P DLY (a small filter block to avoid glitches). Enable signal (nCSB_OUT) is generated by the components that detect start signal and DFF4. As can be seen in Figure 4, the complete IR receiver requires additional components such as: one SPI, three DCMP/PWMs, two DFFs, two 3-bit LUTs, DFF, Pipe delay, and a TSOP4838 (PIN diode/preamp, demodulator module.
The input data stream is converted from serial to parallel by using SPI block, and the output values are compared with predetermined (configurable) stored values using DCMP0, DCMP1, and DCMP2. DCMP0 and DCMP2 perform address comparison and the combination of 3-bit LUT1 and DFF5 stores the address comparison result. DCMP1 performs command comparison and the combination of 3-bit LUT2 and Pipe delay stores the command comparison result.
IR Receiver Circuit Analysis
When this device is turned on the OUT (PIN 7) in Figure 4 is set LOW, IR_IN (PIN 12) – HIGH, CLOCK_OUT (PIN 5) – LOW and OUT_LATCH_EN (PIN 3) – as defined by user. To enable device operation, OUT_LATCH_EN has to be kept HIGH. When the button on the remote control is pressed, the data stream will appear on IR_IN (PIN 12). Then the sequence is decoded by the device and if the address and command match the stored values, the OUT (PIN 7) will go HIGH. If the address and command do not both match – OUT (PIN 7) will stay LOW. If PIN 3 (OUT_LATCH_EN) is LOW, the saved result is cleared. The functionality waveforms that describe the device operation are shown in Figures 5, 6, 7 and 8.
SLG46620 Implementation
A typical IR receiver application circuit with implementation of the SLG46140V GreenPAK™ IC is shown in Figure 9. Alternatively, an SLG46620V IC can also be used in this application. In that case, the IR receiver would require both SLG46620V matrixes with its components shown in Figure 10.
Conclusion
A remote control IR receiver, decoder, and comparator can be easily implemented using a GreenPAK IC. It is a very useful solution when mostly just one configurable address and command are needed. It features low power consumption, and few external components needed.