The remote control is a wireless transmitting device. The button information is encoded by modern digital encoding techniques. The transmit wave is transmitted through the infrared diode, and the transmitted infrared signal transmits the received infrared signal into electrical signal, by the processor. Decoding, demodulating the corresponding instructions to achieve the required operational requirements for the control set.
First, the principle of infrared remote control
Many electrical appliances use infrared remote control, then what is the working principle of infrared remote control? First let's see what is infrared.
The visible light of the human eye can be seen from the wavelength from long to short, sequentially red, orange, yellow, green, blue, blue, purple. Among them, the wavelength range of red light is 0.62 to 0.76 μm; the wavelength range of purple light is 0.38 ~ 0.46 μm. The light smaller than the wavelength of the violet is called ultraviolet rays, which is an infrared ray than the red light wavelength.
The infrared remote control is to transmit control signals using a near-infrared line of 0.76 to 1.5 μm.
Commonly used infrared remote control systems generally distribute and receive two parts.
The main components of the transmitted portion are infrared light emitting diodes. It is actually a special light-emitting diode, since its internal material is different from the ordinary light-emitting diode, and there is a certain voltage at both ends, it is emitted to be infrared instead of visible light.
The infrared wavelength of the infrared light emitted by the infrared light-emitting diode is about 940 nm, the shape is the same as the ordinary light emitting diode, but the color is different.
Infrared light emitting diodes are generally black, dark blue, transparent three colors.
The way to determine the quality of infrared light emitting diodes is the same as judging the ordinary diode: the positive and reverse resistance of the infrared light-emitting diode is used for the multimeter resistance unit.
The luminous efficiency of the infrared light-emitting diode can be determined using a special instrument, and the pulling method can only be roughly determined under amateur conditions. The infrared receiving tube of the receiving portion is a photosensitive diode.
In practical applications, the infrared receiving diode is contaminated, it can work normally, that is, the infrared receiving diode is in reverse application when applied in the circuit, so that higher sensitivity can be obtained.
Infrared receiving diodes are generally circular and square.
Since the transmission power of the infrared light-emitting diode is generally smaller (about 15 mW), the signal received by the infrared receiving diode is relatively weak, so it is to increase the high gain amplifying circuit.
A special amplifier circuit is often used in infrared reception of μPC1373H, CX20106A. In recent years, both amateur production or official products are used, most of them are adopted in infrared receiving heads.
There are two packages in the finished infrared receiving head: an iron shielding; one is a plastic package. There are three pins, ie power positive (VDD), power supply negative (GND), and data output (VO or OUT). The pins of the infrared receiving head are different from the model different, and can be referred to the instructions for the manufacturer. The advantage of finished infrared receiving head is that it is very convenient to use as a triode without complex debugging and outer shell shielding. However, pay attention to the carrier frequency of the finished infrared receiving head during use.
The carrier frequency commonly used in the infrared remote control is 38kHz, which is determined by the 455kHz potter used by the transmitting end.
In the transmitting end, the transmitting end is integrated to the crystal, the division coefficient is generally taken 12, so 455kHz ÷ 12 ≈ 37.9 kHz ≈ 38kHz. There are also some remote control systems using 36kHz, 40kHz, 56kHz, etc., generally determined by the oscillation frequency of the transmitted end crystal.
Second, infrared remote coding
Commonly used a pulse width modulation (PWM) through the pulse width and the pulse time modulation (PPM) of signal modulation (PPM) to achieve signal modulation is achieved by the pulse width.
My remote control is used by the NEC protocol, that is, the PWM method, which features the following characteristics:
1,8-bit address and 8-bit instruction length;
2, addresses and commands 2 transfers (ensure reliability)
3, PWM pulse position modulation to emit the duty cycle of infrared carriers represent "0" and "1";
4, the carrier frequency is 38 kHz;
5, bit time is 1.125 ms or 2.25 ms;
The bit definition of the NEC code: A pulse corresponds to the continuous carrier of 560US, and a logic 1 transmission requires 2.25ms (560 us pulse + 1680 suline), and a logic 0 transmission requires 1.125 ms (560 us pulse + 560 uq low). The remote receiving head is a low level when the pulse is received. It is high when there is no pulse. In this way, the signal we received at the end of the end should be: logic 1 should be 560US low + 1680us high, logic 0 It should be 560us low + 560 su.
The data format of the NEC remote instruction is: synchronous terminal, address code, address reverse code, control code, and control. The synchronization code consists of a 9MS low level and a 4.5 ms high level, the address code, the address is reversed, the control code, and the control reaction is 8-bit data format. Several sequential sequential sequential in the previous position in the lower position. It is used to increase the reliability of the transmission (available for check).
Third, decoding process
As can be seen from the figure, its address code is 0, the control code is 168. It can be seen after 100 ms, we have also received several pulses, which is the connection code specified by the NEC code (consisting of 9MS low + 2.5m high + 0.56 ms low + 97.94ms high) If the button is still not released after one frame of data is sent, the repeated code is transmitted, that is, even the code, the number of times the button is pressed by the number of times the number of times the number is issued.
Fourth, experimental operation
Based on GD32 Experiment 21 Infrared Remote Control Experiment, add the following macro definition in the remote.h file:
# Definebutton_1 218
# Definebutton_2 242
# Definebutton_3 202
# DefineButton_4 90
# DefineButton_5 240
# DefineButton_6 122
# DefineButton_7 106
# DefineButton_8 114
# DefineButton_9 74
# Definebutton_0 170
#Define button_power 234
As a new key value of the remote control.
The Switch function in main.c file has also been modified as follows:
Switch (key)
{
CaseButton_Power:
LCD_SHOWSTRING (86, 150, "Power");
Break;
CaseButton_1:
LCD_SHOWSTRING (86, 150, "1");
Break;
CaseButton_2:
LCD_SHOWSTRING (86, 150, "2");
Break;
CaseButton_3:
LCD_SHOWSTRING (86, 150, "3");
Break;
CaseButton_4:
LCD_SHOWSTRING (86, 150, "4");
Break;
CaseButton_5:
LCD_SHOWSTRING (86, 150, "5");
Break;
CaseButton_6:
LCD_SHOWSTRING (86, 150, "6");
Break;
CaseButton_7:
LCD_SHOWSTRING (86, 150, "7");
Break;
CaseButton_8:
LCD_SHOWSTRING (86, 150, "8");
Break;
CaseButton_9:
LCD_SHOWSTRING (86, 150, "9");
Break;
CaseButton_0:
LCD_SHOWSTRING (86, 150, "0");
Break;
DEFAULT:
Break;
}
Test everything is normal!
Be
Source: Wiku Electronic Market Network
Our other product: