Infrared simple transmitting and receiving principle and codec analysis

Infrared remote control system: The general infrared remote control system consists of two parts: transmitting and receiving, and uses the code/decoder ASIC chip to control the operation, as shown in Figure 1. The transmitting part includes keyboard matrix, code modulation, and LED infrared transmitter; the receiving part includes optical and electrical conversion amplifiers, demodulation and decoding circuits.

Introduction to the principle of infrared remote control

Infrared remote control is currently the most widely used means of communication and remote control. Because the infrared remote control device has the characteristics of small size, low power consumption, strong function and low cost, after color TV and video recorder, infrared remote control is also used in other small electrical devices such as tape recorders, audio equipment, air conditioners and toys. In industrial equipment, in the environment of high voltage, radiation, toxic gas, dust, etc., the use of infrared remote control is not only completely reliable but also can effectively isolate electrical interference.

Infrared remote control system: The general infrared remote control system consists of two parts: transmitting and receiving, and uses the code/decoder ASIC chip to control the operation, as shown in Figure 1. The transmitting part includes keyboard matrix, code modulation, and LED infrared transmitter; the receiving part includes optical and electrical conversion amplifiers, demodulation and decoding circuits.

The principle of simple transmission and reception of infrared

At the transmitting end, the input signal is amplified and sent to the infrared transmitting tube for emission. At the receiving end, after the receiving tube receives the infrared signal, it is amplified and processed by the amplifier and restored to a signal. This is the simple infrared transmitting and receiving principle.

1. Structure of infrared remote control system

The main parts of the infrared remote control system are modulation, transmission and reception, as shown in the following figure:

Infrared remote control transmits data in a modulated manner, that is, the “AND” operation between the data and a certain frequency carrier, which can not only improve the transmission efficiency but also reduce the power consumption.

The modulation carrier frequency is generally between 30khz and 60khz. Most of them use 38kHz square wave with a duty cycle of 1/3. The carrier waveform is shown in the figure below, which is determined by the 455kHz crystal oscillator used at the transmitter. At the transmitting end, the crystal oscillator needs to be divided into integers, and the frequency division coefficient is generally 12, so 455kHz÷12≈37.9kHz≈38kHz.

At present, there are many kinds of chips that can realize infrared emission, and can send out different kinds of codes according to the choice. Since the transmitting system is generally powered by batteries, the power consumption of the chip is required to be very low. Most of the chips are designed to be in a dormant state and only work when a button is pressed, which can reduce power consumption. The crystal oscillator used by the chip should have enough Because of its high resistance to physical impact, ordinary quartz crystals cannot be used. Generally, ceramic resonators are used. The accuracy of ceramic resonators is not as high as that of quartz crystals, but usually a little error can be ignored.

Infrared is emitted through infrared light-emitting diodes (LEDs). The internal structure of infrared light-emitting diodes (infrared emission tubes) is basically the same as that of ordinary light-emitting diodes. The materials are different from ordinary light-emitting diodes. When a certain voltage is applied across the infrared emission tube, it emits It’s infrared light instead of visible light.

As shown in the above figure is the simplest circuit for driving LED. When selecting components, pay attention to the fast switching speed of the triode, and also consider the forward current and reverse leakage current of the LED. Generally, the maximum forward current flowing through the LED is 100mA, and the current The larger it is, the stronger the waveform it emits.

The circuit has a little defect. When the battery voltage drops, the current flowing through the LED will decrease, the intensity of the emission waveform will decrease, and the remote control distance will become smaller.

The emitter output drive circuit shown in the figure above can solve this problem. The two diodes clamp the base voltage of the triode at about 1.2V, so the emitter voltage of the triode is fixed at about 0.6V, and the emitter current IE is basically No change, according to IE≈IC, so the current flowing through the LED is basically unchanged, which ensures a certain remote control distance when the battery voltage decreases.

2. Integrated infrared receiver

The typical circuit of the infrared signal transceiver system is shown in the figure above. The infrared receiving circuit is usually integrated into one component by the manufacturer to become an integrated infrared receiving head. Internal circuits include infrared monitoring diodes, amplifiers, limiters, band-pass filters, integrating circuits, comparators, etc. The infrared monitoring diode detects the infrared signal, and then sends the signal to the amplifier and limiter, and the limiter controls the pulse amplitude at a certain level, regardless of the distance between the infrared transmitter and the receiver. The AC signal enters the band-pass filter, the band-pass filter can pass the load wave from 30khz to 60khz, and then enters the comparator through the demodulation circuit and the integrating circuit, and the comparator outputs the high and low levels to restore the signal waveform of the transmitter. Note that the high and low levels of the output and the transmitting end are inverted, the purpose of which is to improve the sensitivity of the receiving.

Integrated infrared receiver, as shown below:

Infrared simple transmitting and receiving principle and codec analysis

There are many types of infrared receivers, and the pin definitions are also different. Generally, there are three pins, including power supply pins, grounding pins, and signal output pins. According to the difference of the modulated carrier at the transmitting end, the receiving head with the corresponding demodulation frequency should be selected.

The gain of the internal amplifier of the infrared receiver is very large, which is easy to cause interference. Therefore, a filter capacitor must be added to the power supply pin of the receiver, generally above 22uf. Some manufacturers recommend connecting a 330 ohm resistor between the power supply pin and the power supply to further reduce power supply interference.

The infrared transmitter can be customized from the remote control manufacturer, or it can be generated by the PWM of the single-chip microcomputer. It is recommended to use the infrared transmitter (L5IR4-45) for home remote control, which can generate PWM of 37.91KHz. The PWM duty cycle is set to 1/3. A simple timing interrupt switch PWM can generate the launch waveform.

Infrared codec analysis

1. Encoding format

The existing infrared remote control includes two ways: PWM (pulse width modulation) and PPM (pulse position modulation).

The representatives of the two forms of coding are RC-5, RC-6 and the future RC-7 of NEC and PHILIPS respectively.

PWM (Pulse Width Modulation): Represents “0” and “1” with the duty cycle of transmitting infrared carrier. In order to save energy, in general, the time of transmitting the infrared carrier is fixed, and the duty cycle is changed by changing the time when the carrier is not transmitted. For example, the commonly used TV remote control uses NEC upd6121, whose “0” means the carrier transmits 0.56ms and does not transmit 0.56ms; its “1” means that the carrier transmits 0.56ms and does not transmit 1.68ms; in addition, for the convenience of decoding, there are Pilot code, the pilot code of upd6121 is 9ms for carrier transmission and 4.5ms for no transmission. The total encoding length of upd6121 is 108ms.

But not all encoders are like this, such as TOSHIBA’s TC9012, its pilot code is 4.5ms for carrier transmission, 4.5ms for not transmitting, its “0” is 0.52ms for carrier transmission, 0.52ms for not transmitting, its “1” is The carrier transmits 0.52ms and does not transmit 1.04ms.

PPM (Pulse Position Modulation): “0” and “1” are represented by the position of the transmitted carrier. It is “0” from transmitting carrier to not transmitting carrier, and “1” from not transmitting carrier to transmitting carrier. The time of transmitting the carrier and not transmitting the carrier is the same, which is 0.68ms, that is, the time of each bit is fixed.

Through the above analysis of coding, it can be concluded that learning infrared with a certain fixed format of “0” and “1” is likely to be unsuccessful. That is to say, the advertised on the market can learn 64-bit and 128-bit is bound to be unreliable.

In addition, because the status of air conditioners is much more than that of TV and audio and video, and there is no standard, each manufacturer makes one according to its own format, resulting in even greater differences. For example: Midea’s remote control uses PWM coding, with a code length of about 120ms; Xinke’s remote control also uses PWM coding, with a code length of about 500ms. With such a big difference, how many bits should it be in terms of “bits”? 64? 128? is obviously impossible to contain such a different length of encoding.

2. Infrared remote control coding format

The encoding format of infrared remote control usually has two formats: NEC and RC5

Features of NEC format:

Use 38 kHz carrier frequency
The boot code interval is 9 ms + 4.5 ms
Use a 16-digit customer code
Use 8-bit data code and 8-bit inverted data code

However, it is necessary to invert the waveform to facilitate analysis:

The NEC protocol implements signal modulation (PWM for short) through the time interval between pulse trains.

Logic “0” is composed of 0.56ms 38KHZ carrier and 0.560ms no carrier interval; logic “1” is composed of 0.56ms 38KHZ carrier and 1.68ms no carrier interval; the end bit is 0.56ms 38K carrier.

The following example is a waveform captured by a known NEC type remote control:

The identification code of the remote control is Address=0xDD20; one of the key values ​​is Command=0x0E;

Note: The waveform sends the low-order address first and then sends the high-order address.

So 0000,0100,1011,1011 is reversed to be 1101,1101,0010,000 DD20 in hexadecimal;

The key value waveform is as follows:

It is also necessary to reverse 0111,0000 to 0000,1110 to get hexadecimal 0E; also note that the 8-bit key code is reversed and sent again, as shown in the figure, 0111,0000 is reversed to 1000,1111. The last bit is a logical “1”.

The RC5 encoding is relatively simple: also because the waveform from the infrared receiver needs to be inverted for easy analysis:

Inverted waveform:

According to coding rules:

Get a set of numbers: 110, 11010, 001101 according to the encoding definition:

The first bit is the start bit S is usually a logic 1.

The second bit is field bit F, which is usually logic 1. In RC5 extended mode, it extends the last 6-bit command code to 7-bit code (high MSB), which can expand from 64 key values ​​to 128 key values.

The third bit is the control bit C, which flips after each key is pressed, so that it is possible to distinguish whether a key has been pressed and not released or repeatedly pressed after being released.

As shown in the figure is the waveform obtained by pressing the same button twice, only the third bit has the opposite logic, and the other bits have the same logic.

This is followed by five system address bits: 11010=1A, and finally six command bits: 001101=0D.

Infrared remote control system: The general infrared remote control system consists of two parts: transmitting and receiving, and uses the code/decoder ASIC chip to control the operation, as shown in Figure 1. The transmitting part includes keyboard matrix, code modulation, and LED infrared transmitter; the receiving part includes optical and electrical conversion amplifiers, demodulation and decoding circuits.

Introduction to the principle of infrared remote control

Infrared remote control is currently the most widely used means of communication and remote control. Because the infrared remote control device has the characteristics of small size, low power consumption, strong function and low cost, after color TV and video recorder, infrared remote control is also used in other small electrical devices such as tape recorders, audio equipment, air conditioners and toys. In industrial equipment, in the environment of high voltage, radiation, toxic gas, dust, etc., the use of infrared remote control is not only completely reliable but also can effectively isolate electrical interference.

Infrared remote control system: The general infrared remote control system consists of two parts: transmitting and receiving, and uses the code/decoder ASIC chip to control the operation, as shown in Figure 1. The transmitting part includes keyboard matrix, code modulation, and LED infrared transmitter; the receiving part includes optical and electrical conversion amplifiers, demodulation and decoding circuits.

The principle of simple transmission and reception of infrared

At the transmitting end, the input signal is amplified and sent to the infrared transmitting tube for emission. At the receiving end, after the receiving tube receives the infrared signal, it is amplified and processed by the amplifier and restored to a signal. This is the simple infrared transmitting and receiving principle.

1. Structure of infrared remote control system

The main parts of the infrared remote control system are modulation, transmission and reception, as shown in the following figure:

Infrared remote control transmits data in a modulated manner, that is, the “AND” operation between the data and a certain frequency carrier, which can not only improve the transmission efficiency but also reduce the power consumption.

The modulation carrier frequency is generally between 30khz and 60khz. Most of them use 38kHz square wave with a duty cycle of 1/3. The carrier waveform is shown in the figure below, which is determined by the 455kHz crystal oscillator used at the transmitter. At the transmitting end, the crystal oscillator needs to be divided into integers, and the frequency division coefficient is generally 12, so 455kHz÷12≈37.9kHz≈38kHz.

At present, there are many kinds of chips that can realize infrared emission, and can send out different kinds of codes according to the choice. Since the transmitting system is generally powered by batteries, the power consumption of the chip is required to be very low. Most of the chips are designed to be in a dormant state and only work when a button is pressed, which can reduce power consumption. The crystal oscillator used by the chip should have enough Because of its high resistance to physical impact, ordinary quartz crystals cannot be used. Generally, ceramic resonators are used. The accuracy of ceramic resonators is not as high as that of quartz crystals, but usually a little error can be ignored.

Infrared is emitted through infrared light-emitting diodes (LEDs). The internal structure of infrared light-emitting diodes (infrared emission tubes) is basically the same as that of ordinary light-emitting diodes. The materials are different from ordinary light-emitting diodes. When a certain voltage is applied across the infrared emission tube, it emits It’s infrared light instead of visible light.

As shown in the above figure is the simplest circuit for driving LED. When selecting components, pay attention to the fast switching speed of the triode, and also consider the forward current and reverse leakage current of the LED. Generally, the maximum forward current flowing through the LED is 100mA, and the current The larger it is, the stronger the waveform it emits.

The circuit has a little defect. When the battery voltage drops, the current flowing through the LED will decrease, the intensity of the emission waveform will decrease, and the remote control distance will become smaller.

The emitter output drive circuit shown in the figure above can solve this problem. The two diodes clamp the base voltage of the triode at about 1.2V, so the emitter voltage of the triode is fixed at about 0.6V, and the emitter current IE is basically No change, according to IE≈IC, so the current flowing through the LED is basically unchanged, which ensures a certain remote control distance when the battery voltage decreases.

2. Integrated infrared receiver

The typical circuit of the infrared signal transceiver system is shown in the figure above. The infrared receiving circuit is usually integrated into one component by the manufacturer to become an integrated infrared receiving head. Internal circuits include infrared monitoring diodes, amplifiers, limiters, band-pass filters, integrating circuits, comparators, etc. The infrared monitoring diode detects the infrared signal, and then sends the signal to the amplifier and limiter, and the limiter controls the pulse amplitude at a certain level, regardless of the distance between the infrared transmitter and the receiver. The AC signal enters the band-pass filter, the band-pass filter can pass the load wave from 30khz to 60khz, and then enters the comparator through the demodulation circuit and the integrating circuit, and the comparator outputs the high and low levels to restore the signal waveform of the transmitter. Note that the high and low levels of the output and the transmitting end are inverted, the purpose of which is to improve the sensitivity of the receiving.

Integrated infrared receiver, as shown below:

There are many types of infrared receivers, and the pin definitions are also different. Generally, there are three pins, including power supply pins, grounding pins, and signal output pins. According to the difference of the modulated carrier at the transmitting end, the receiving head with the corresponding demodulation frequency should be selected.

The gain of the internal amplifier of the infrared receiver is very large, which is easy to cause interference. Therefore, a filter capacitor must be added to the power supply pin of the receiver, generally above 22uf. Some manufacturers recommend connecting a 330 ohm resistor between the power supply pin and the power supply to further reduce power supply interference.

The infrared transmitter can be customized from the remote control manufacturer, or it can be generated by the PWM of the single-chip microcomputer. It is recommended to use the infrared transmitter (L5IR4-45) for home remote control, which can generate PWM of 37.91KHz. The PWM duty cycle is set to 1/3. A simple timing interrupt switch PWM can generate the launch waveform.

Infrared codec analysis

1. Encoding format

The existing infrared remote control includes two ways: PWM (pulse width modulation) and PPM (pulse position modulation).

The representatives of the two forms of coding are RC-5, RC-6 and the future RC-7 of NEC and PHILIPS respectively.

PWM (Pulse Width Modulation): Represents “0” and “1” with the duty cycle of transmitting infrared carrier. In order to save energy, in general, the time of transmitting the infrared carrier is fixed, and the duty cycle is changed by changing the time when the carrier is not transmitted. For example, the commonly used TV remote control uses NEC upd6121, whose “0” means the carrier transmits 0.56ms and does not transmit 0.56ms; its “1” means that the carrier transmits 0.56ms and does not transmit 1.68ms; in addition, for the convenience of decoding, there are Pilot code, the pilot code of upd6121 is 9ms for carrier transmission and 4.5ms for no transmission. The total encoding length of upd6121 is 108ms.

But not all encoders are like this, such as TOSHIBA’s TC9012, its pilot code is 4.5ms for carrier transmission, 4.5ms for not transmitting, its “0” is 0.52ms for carrier transmission, 0.52ms for not transmitting, its “1” is The carrier transmits 0.52ms and does not transmit 1.04ms.

PPM (Pulse Position Modulation): “0” and “1” are represented by the position of the transmitted carrier. It is “0” from transmitting carrier to not transmitting carrier, and “1” from not transmitting carrier to transmitting carrier. The time of transmitting the carrier and not transmitting the carrier is the same, which is 0.68ms, that is, the time of each bit is fixed.

Through the above analysis of coding, it can be concluded that learning infrared with a certain fixed format of “0” and “1” is likely to be unsuccessful. That is to say, the advertised on the market can learn 64-bit and 128-bit is bound to be unreliable.

In addition, because the status of air conditioners is much more than that of TV and audio and video, and there is no standard, each manufacturer makes one according to its own format, resulting in even greater differences. For example: Midea’s remote control uses PWM coding, with a code length of about 120ms; Xinke’s remote control also uses PWM coding, with a code length of about 500ms. With such a big difference, how many bits should it be in terms of “bits”? 64? 128? is obviously impossible to contain such a different length of encoding.

2. Infrared remote control coding format

The encoding format of infrared remote control usually has two formats: NEC and RC5

Features of NEC format:

Use 38 kHz carrier frequency
The boot code interval is 9 ms + 4.5 ms
Use a 16-digit customer code
Use 8-bit data code and 8-bit inverted data code

However, it is necessary to invert the waveform to facilitate analysis:

The NEC protocol implements signal modulation (PWM for short) through the time interval between pulse trains.

Logic “0” is composed of 0.56ms 38KHZ carrier and 0.560ms no carrier interval; logic “1” is composed of 0.56ms 38KHZ carrier and 1.68ms no carrier interval; the end bit is 0.56ms 38K carrier.

The following example is a waveform captured by a known NEC type remote control:

The identification code of the remote control is Address=0xDD20; one of the key values ​​is Command=0x0E;

Note: The waveform sends the low-order address first and then sends the high-order address.

So 0000,0100,1011,1011 is reversed to be 1101,1101,0010,000 DD20 in hexadecimal;

The key value waveform is as follows:

It is also necessary to reverse 0111,0000 to 0000,1110 to get hexadecimal 0E; also note that the 8-bit key code is reversed and sent again, as shown in the figure, 0111,0000 is reversed to 1000,1111. The last bit is a logical “1”.

The RC5 encoding is relatively simple: also because the waveform from the infrared receiver needs to be inverted for easy analysis:

Inverted waveform:

According to coding rules:

Get a set of numbers: 110, 11010, 001101 according to the encoding definition:

The first bit is the start bit S is usually a logic 1.

The second bit is field bit F, which is usually logic 1. In RC5 extended mode, it extends the last 6-bit command code to 7-bit code (high MSB), which can expand from 64 key values ​​to 128 key values.

The third bit is the control bit C, which flips after each key is pressed, so that it is possible to distinguish whether a key has been pressed and not released or repeatedly pressed after being released.

As shown in the figure is the waveform obtained by pressing the same button twice, only the third bit has the opposite logic, and the other bits have the same logic.

This is followed by five system address bits: 11010=1A, and finally six command bits: 001101=0D.

The Links:   ATC2603A CR6L-100-UL LCD-DISPLAY