Basic Principles of Infrared Remote Control and Design of Universal Multi-Address Remote Control System

Publisher:知音学友Latest update time:2018-04-11 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    Infrared remote control is widely used in household appliances, security, industrial control and people's daily life, especially household appliances and security.

    When there are many TVs, VCDs, and DVDs at home, sometimes conflicts and misoperations may occur when using the remote control to control them. Originally, I only wanted to control one of the machines, but two TVs or a VCD (DVD) and a TV were controlled at the same time. A careful analysis shows that the conflict between the two devices is caused by the problem of infrared coding. Since they have the same address code, they will act at the same time, which causes the above trouble. The key to solving the problem is to set a different address code for each appliance. When controlling the remote control, send the address code first. Only those with the same address can receive the action and receive the subsequent data. First select the object to be remotely controlled, and then press the button to perform the corresponding action.

    In the design introduced in this article, a single-chip microcomputer is used to simulate the infrared remote control coding. The address to be remotely controlled is input from the matrix keyboard, and then the coded signal is transmitted through the infrared light-emitting diode. The receiving part first receives the coded signal transmitted by the transmitting part, and then compares it with its own address. If the addresses are the same, a diode will light up, indicating that the addresses are the same and the remote control is successful; otherwise, the diode will remain off.

    This design is based on the principle of infrared remote control. On this basis, a circuit system can be designed to solve the "fighting" phenomenon of household appliances and applied to actual production, so it has certain practicality.

    The basic principle of infrared remote control

    Infrared remote control systems generally consist of two parts: a transmitter and a receiver. The transmitter consists of a command key, a command signal generating circuit, a modulation circuit, a drive circuit, and an infrared transmitter. When the command key is pressed, the command signal generating circuit generates the required control signal. After the control command signal is modulated by the modulation circuit, the drive circuit finally drives the infrared transmitter to send out an infrared remote control command signal.

    The receiver is composed of an infrared receiving device, a preamplifier circuit, a demodulation circuit, a command signal detection circuit, a memory and drive circuit, and an execution circuit. When the infrared receiving device receives the infrared command signal from the transmitter, it converts the infrared light signal into an electrical signal and sends it to the preamplifier circuit for amplification. After passing through the demodulator, the command signal is detected by the signal detection circuit, and finally the memory circuit and the drive circuit drive the execution circuit to realize various operations.

    Control signals are generally distinguished by certain different characteristics. The commonly used characteristics for distinguishing command signals are frequency and code group characteristics, that is, different frequencies or coded electrical signals are used to represent different command signals to achieve remote control. Therefore, infrared remote control systems are usually classified according to the methods and characteristics of generating and distinguishing control command signals, and are often divided into frequency division infrared remote control and code division infrared remote control.

6

Figure 1: Remote control transmitter components

    1 Infrared remote control system transmitting part

    The infrared remote control transmitter consists of three parts: keyboard matrix, remote control dedicated integrated circuit, drive circuit and infrared light emitting diode. The structure is shown in Figure 1.

  When a key is pressed, the system delays for a period of time to prevent interference, and then starts the oscillator. After the key encoder obtains the key code, it obtains the corresponding instruction code (a code composed of 0 and 1) from the ROM. The remote control is generally powered by a battery. In order to save power and improve anti-interference ability, the instruction code is modulated by a carrier in the range of 32 to 56kHz and output to the amplifier circuit to drive the infrared transmitting tube to emit 940nm infrared light. When the transmission is completed, the oscillator is also turned off, and the system is in a low-power sleep state. The frequency and modulation frequency of the carrier will be different in different occasions, but most household appliances use 38kHz, which is obtained by dividing the 455kHz oscillator by 12.

    The signal of the remote control transmitter is composed of a series of binary codes of 0 and 1. Different chips encode 0 and 1 differently. Existing infrared remote controls include two types: pulse width modulation (PWW) and pulse position modulation (PPM or Manchester encoding). The representatives of the two forms of encoding are NEC and PHILIPS' RC-5.

    2 Infrared remote control system receiving part

    The receiving part is composed of amplifier, limiter, bandpass filter, demodulator, integrator, comparator, etc. For example, the earlier infrared receiving diode plus a dedicated infrared processing circuit is used, such as CXA20106. This method has a complex circuit and is generally not used now. However, in actual applications, all of the above circuits are integrated into one circuit, which is what we often call an integrated infrared receiving head. The integrated infrared receiving head has different models according to the different carrier frequencies. Due to the problem of the interface with the CPU, most receiving circuits are inverted code outputs, that is, when there is no infrared signal, the output is 1, and when there is a signal output, it is 0. It has only three pins, namely +5V power supply, ground, and signal output.

    System Design

    1 MCU encoding and transmitting part

    ① Keyboard part

    The transmitter circuit of the infrared remote control is relatively simple, consisting of a 4×4 rectangular keyboard, a PNP driving transistor, an infrared light emitting diode and two current limiting resistors. The receiver to be remotely controlled is input by the keyboard, that is, the address to be infrared remotely controlled is input by the keyboard, and the address is encoded and modulated and then transmitted through the infrared light emitting diode.

    The matrix keyboard consists of 16 touch keys arranged in 4 rows and 4 columns. The I/O port of the microcontroller connected to the row line is used as the output terminal, and the column line is used as the input terminal. When no key is pressed, all output terminals are high level, indicating that no key is pressed. When a key is pressed, the input line will be pulled back. In this way, by reading the state of the input line, it can be known whether a key is pressed.

    The column lines of the keyboard are connected to the lower 4 bits of port P1, and the row lines are connected to the upper 4 bits of port P1. The column lines P1.0~P1.3 are set as input lines, and the row lines P1.4~P1.7 are set as output lines.

      

Figure 2 Schematic diagram of carrier modulation


● Detect whether any key is currently pressed. The detection method is to make P1.4~P1.7 output 0, read the status of P1.0~P1.3, if P1.0~P1.3 are all 1, no key is closed, otherwise a key is closed.

● Remove key jitter. When a key is detected to be pressed, it will delay for a period of time before making the next step of detection and judgment.

● If a key is pressed, it should be identified which key is closed. The method is to scan the rows of the keyboard. P1.4~P1.7 outputs 1110, 1101, 1011, 0111 in the following 4 combinations. Read P1.0~P1.3 when each group of rows is output. If all are 1, it means that there is no key input in row 0, otherwise a key is closed. In this way, the row value and column value of the closed key are obtained, and then the row value and column value of the closed key are converted into the defined value by calculation or table lookup.

● In order to ensure that the CPU only processes once each time the key is closed, the jitter when the key is released must be removed. The generated key value is placed in the sending database area. 30H stores the generated key value, that is, the 8-bit address to be remotely controlled, a total of 1 byte. 31H stores the same 8-bit address as in 30H. The address code is resent once, mainly to enhance the reliability of the remote control. If the two address codes are different, it means that the data of this frame is wrong and should be discarded. 32H stores 00H (for simple programming), and 33H stores 0FFH, a total of 32 bits of data. When sending data, just read the data there, and then call the transmission subroutine to send it.

    ②Carrier part

    According to the basic principle of infrared remote control introduced above, the method of infrared remote control code modulation is actually very simple, just generate a certain time level. Then transmit the code through a 38kHz carrier modulation. There are many ways to generate the carrier, which can be composed of CMOS gate circuit RC oscillator, or 555 time base circuit, etc.

    In this design, CPU delay is used, that is, it is completed by timer interrupt, and 38kHz carrier is generated by T0 timing of single chip microcomputer. Set the timer to mode 2, that is, 8-bit counter that automatically restores the initial value. TL0 is used as 8-bit counter, and TH0 is used as counting initial value register. When TL0 counts overflow, on the one hand, the overflow flag TF0 is set to 1, requesting interrupt to CPU, and at the same time, the content of TH0 is sent to TL0, so that TL0 starts counting again from the initial value. Therefore, T0 works in mode 2, and the timing accuracy is relatively high. According to the calculation, the initial timing value of 38KHz is set. The initial timing value of 12kHz crystal is 0F3H, and the initial value of 11.0592kHz crystal is 0F4H. The timer interrupt is set. Only the inverted P2.0 (CPL P2.0) is written in the interrupt program. When data 1 is to be sent, when the high level of the first 560μs is sent, the timer interrupt is turned on first, and then the timer is started, allowing the timer to work, delaying 560μs and then turning off the timer. Because the low level of the following 1690μs does not send a signal, P2.0 can be directly set to a high level and a delay of 1690μs can be sufficient; the high level of the previous 560μs of data 0 is the same as that of data 1, and the low level of the following 560μs does not send a signal, so P2.0 can be directly set to a high level and a delay of 560μs can be sufficient.

    2 Infrared receiving decoding circuit

    The infrared remote control receiver uses an integrated infrared receiver head, which installs the infrared receiving diode, amplifier, demodulation, shaping and other circuits together, with only three pins. The signal output terminal of the infrared receiver head is connected to the INT0 terminal of the microcontroller, and the microcontroller interrupt INT0 generates an interrupt at the falling edge of the infrared pulse. The circuit is shown in Figure 3.3. In the figure, a PNP transistor is added to amplify the output signal, and R and C form a decoupling circuit to suppress power supply interference.

      

Figure 3 Schematic diagram of integrated receiving head

    3 Remote Control Signal Decoding Algorithm

    Normally, when no key is pressed on the remote control, the infrared emitting diode does not send out a signal, and the remote control receiving head outputs signal 1. When a key is pressed, the high level of the codes 0 and 1 will be inverted by the remote control receiving head to output signal 0. Since it is connected to the interrupt pin of the microcontroller, it will cause the microcontroller to interrupt (the microcontroller is pre-set to generate an interrupt on the falling edge).

    When the remote control code is transmitted, the guide code is represented by a high level of 9ms and a low level of 4.5ms, the data "0" is represented by a high level of 560μs and a low level of 560μs, and the data "1" is represented by a high level of 560μs and a low level of 1690μs. The guide code is followed by 4 bytes of data. The receiving code is the reverse of the transmitting code, so judging the length of the high level in the data is the key to reading the data. Here, 882μs (between 560 and 1690μs) is used as a ruler. If it is still high after 882μs, it means that it is data 1, and 1 is written into the register (when the data is 1, it needs to be delayed for a period of time to make the level low, which is used to detect the beginning of the next low level). If the level is low after 882μs, it means that it is data 0, so 0 is written into the register, and then wait for the arrival of the next low level.

    Continue to receive the following data. When 32 bits of data are received, it means that one frame of data has been received. Then determine whether this reception is valid. If the two address codes are the same and equal to the address code of this system, the sum of the data code and the data inverse code is equal to 0FFH, then the received frame of data is valid and an LED is lit. Otherwise, the received data is discarded.

    After receiving, initialize the data received this time and prepare for the next remote control reception.

    Conclusion

    The universal multi-address remote control system designed in this paper has achieved the expected performance requirements. In practical applications, an infrared remote control signal self-learning system can be designed based on this system. First, the infrared remote control signal of the device must be identified and stored (self-learning), and then restored when needed. After the self-learning system is made, the remote control signals of the video recorder, projector, and TV can be self-learned and restored, thereby realizing the control of infrared remote control devices in the multimedia distance learning system.


Reference address:Basic Principles of Infrared Remote Control and Design of Universal Multi-Address Remote Control System

Previous article:Design of true airspeed measurement system for UAV based on single chip microcomputer
Next article:Practical Chinese Pinyin Input Method in Single Chip Microcomputer Display and Control System

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号