This article refers to the address: http://
Infrared remote control is a commonly used communication and remote control method. It has the characteristics of small size, low power consumption, strong function and low cost. It can be widely used in various home appliances, financial and commercial facilities as well as industrial equipment. However, the infrared remote control of various products cannot be compatible with each other, which brings inconvenience to practical applications. Therefore, a universal learning infrared remote control design system based on Sunplus SPCE061A single-chip microcomputer is given here, which can learn various infrared remote control commands and better solve the product compatibility problem.
2 infrared remote control principle
The universal infrared remote control system consists of two modules, transmitting and receiving, which are controlled by an integrated/integrated integrated circuit. The transmitting part includes a keyboard matrix, a coded modulation, and an LED infrared transmitter; and the receiving part includes a photoelectric conversion amplifier, a demodulation, and a decoding circuit.
When the remote control button is pressed, its internal signal transmitter periodically emits the same pulse width modulated binary serial code, which is output by the infrared transmitting tube. The remote control code pulse transmitted by the infrared remote controller is composed of a preamble, a system code, a function code, and an inverse code of the function code. These codes are transmitted after carrier pulse width modulation, often using a 38 kHz carrier. The remote control receiving completes the receiving, amplifying, detecting, shaping and demodulating the remote control signal, and then implementing the corresponding control function through the microcontroller.
3 system hardware circuit design
The learning infrared remote control can memorize 16 different infrared commands, which are stored in off-chip memory. When it is learning, after the microprocessor decodes, the data is stored in the off-chip memory, and the learning indicator is lit. When remote control, the corresponding control function is selected by the button, the microprocessor calls the infrared code of the corresponding function, and the remote control indicator lights. The system design is to use the powerful voice function of Sunplus SPCE061A MCU, which can be used for voice reminder in different modes. The block diagram of the system hardware design circuit is shown in Figure 1.
3.1 Lingyang SPCE061A microcontroller
The system design uses the Sunplus SPCE061A microcontroller as the processor. SPCE061A is a 16-bit single-chip microcomputer with Î¼'nSPTM 16-bit microcontroller and signal processor as the core. It adopts modular integrated structure and integrates on-chip 2 KBRAM, 32 KB Flash, A/D converter and D/A converter. Parallel I/O interface, etc. Its main performance is: single-chip SPCE061 A (crystal oscillator frequency 32.768 KHz, Flash 32 KB, 3.3 V power supply); 32-bit programmable parallel I / O interface; two 16-bit programmable timer / counter, automatic preset counting Value; has a watchdog maintenance function in Run/Sleep mode.
3.2 Infrared transmitting circuit
The infrared emission is generated by the encoded serial data by carrier pulse amplitude modulation. The most commonly used carrier frequency 38 kHz remote control is used in the transmitting circuit. The modulated square wave can be obtained by inverting the period of the TimerA pulse width modulation output pin IOB8 by a 16-bit programmable timer, and the pulse signal is output by the bidirectional I/O interface IOB6. The infrared transmitting circuit is shown in Figure 2.
3.3 infrared receiving circuit
The infrared receiving circuit is configured to receive the infrared signal and demodulate the remote control binary control pulse signal. The infrared receiving circuit uses HS0038. The HS0038 integrates photoelectric conversion, demodulation and amplification, and requires only a few external components to achieve all the work from infrared reception to output compatible with TTL levels. HS0038 outputs a high level. When the input is a remote control signal, HS0038 outputs a high and low level pulse. The received remote control code is composed of a low level and a high level, and a combination of different pulse widths and high levels constitutes different control codes. This design directly inputs the demodulated signal to the external interrupt source EXTI pin IOB2, and counts and stores the pulse through the internal interrupt service routine. The infrared receiving circuit is shown in Figure 3.
3.4 data storage circuit
This design uses 24LC16 to achieve data storage. The 24LC16 is an EEPROM with an I2C interface. Its capacity is 2 048 Ã— 8 bits, divided into 8 pages, 256 bytes per page. Its large storage space and control mode can meet storage and performance requirements. Connect the serial data transmit pin (IOB10) of the Sunplus SPCE061A to the receive pin (IOB7), and then connect it to the serial I/O pin SDA of the 24LC16. The serial clock of these two pins is provided by the system program software to complete the data reception and transmission.
4 system software design
4.1 Initialization procedure
The task of the initialization program is to clear the stored pulse width data unit, turn off the learning and transmitting indicator, turn off the remote control output, set the corresponding timer mode, set the interrupt, and so on.
4.2 Remote code reading program
The learning process of the remote control code is mainly: the pulse sent by the original controller is sequentially stored in the storage unit. The even address unit stores high level pulse width data, and the odd address unit stores low level pulse width data. The data is stored in the external memory 24LC16.
Read the remote control code reading program, through a large number of different types of remote control code waveform test test analysis, the remote control code frame intermittent bit width is greater than 10 ms, the starting bit code width is 100Î¼s ~ 20 ms, the coding bit is 100Î¼s ~ 3.5 ms . To ensure that most remote controls are successful, use the following methods:
(1) Read start bit method Since the start bit has a large code width range, the technical unit uses a separate 2 bytes, and the count period is about 15 Î¼s. Calculated by 65 535 Ã— 15 Î¼s, the maximum storage start bit pulse width is 983. Ms. When the input is high, the start bit count is stopped and a high level count is entered.
(2) The read remote control code method uses a 1-byte counting unit to count the code width (high level or low level). When the level jumps, the counting ends and the data is stored to the specified address. In the case of the high level code number, when the counter value is greater than 255 (the code width is greater than 3.825 ms), the end frame interval bit is ended, and the data 0x00 is written as the end flag in the corresponding memory unit. The program flow is shown in Figure 4.
4.3 Remote code transmission procedure
The remote control code transmitting program transmits the remote control pulse code by pulsing the pulse data originally stored in the storage unit through a 38 kHz square wave and combining the stored original control code with the carrier. The program flow is shown in Figure 5.
4.4 Main program
After the system main program is initialized after power-on, the port button is queried. When it is confirmed that a button is pressed, the corresponding remote control code is called from the external memory to issue it. The main program flow is shown in Figure 6.
Experiments show that the learning infrared system fully meets the experimental needs. When learning the remote control signal, a large number of infrared remote control codes are comprehensively analyzed, which has certain versatility. When the remote control code is transmitted, the carrier is not generated by hardware design but by software. This saves the hardware equipment, simplifies the circuit, and effectively realizes the receiving and transmitting of the infrared remote control signal. This learning infrared remote control has been successfully applied to remote control devices such as multimedia classrooms, smart homes, and home centralized controllers, and has achieved satisfactory results. Of course, since the current remote control signal has not yet been completely unified, the use of infrared learning technology does not guarantee the learning of remote control signals of all electrical equipment, which is also the direction for learning infrared in the future.
Rubber Cable,Rubber Flexible Cable ,Cable Protector ,Rubber Insulated Cable
Electric Wire & Cable Co., Ltd. , http://www.nbpowercable.com