1 Introduction
In recent years, computer technology, modern communication technology and automatic control technology have developed rapidly. With the development of new technologies, intelligent home systems have also entered thousands of households. Home systems such as air conditioners, televisions, lighting systems, etc. are all controlled by remote controls. Infrared remote controls have become the most widely used remote control method due to their simple structure, small size, low power consumption, powerful functions and low cost. However, due to the fact that the technical standards and protocols used by various infrared devices are very different, the remote controls of various devices are not compatible, which brings many inconveniences to users and consumers.
At present, most universal remote controllers on the market have built-in infrared control commands of multiple brands, and are powerless against infrared devices other than the built-in brands. To this end, this paper designs an intelligent learning infrared remote controller for air-conditioning equipment. By recording the pulse width, it successfully realizes the learning and reproduction of multiple infrared air-conditioning remote control signals, truly realizing "universal". Based on the overall structure and hardware design of the system, this paper studies in detail the software design and implementation of the system learning, sending and communication functions.
2 System Overall Structure and Hardware Design
The system adopts modular design, and each module is connected to the main control chip through the interface circuit. The main modules are: matrix keyboard, LCD display, storage module, infrared sending module, infrared receiving module, RS232, RS485 communication module, and temperature detection module. The system structure diagram is shown in Figure 1.
The system uses Atmega16 microcontroller as the main control chip. Atmega16 has 16K bytes of in-system programmable Flash, 512 bytes of EEPROM, 1K bytes of SRAM, 32 general I/O lines, 32 general working registers, JTAG interface for boundary scan, support for on-chip debugging and programming, three flexible timers/counters (T/C) with comparison mode, on-chip/external interrupts, programmable serial USART, universal serial interface with start condition detector, 8-channel 10-bit ADC with optional differential input stage programmable gain, programmable watchdog timer with on-chip oscillator, an SPI serial port, and six power saving modes that can be selected by software. The chip is powerful, meets the needs of system design and provides sufficient expansion space. The main control chip uses an 8MHz crystal oscillator, and the crystal oscillator circuit is close to the main control chip to minimize input noise. The reset circuit uses a low-level reset.
Figure 1 System structure diagram
The matrix keyboard adopts a 3*3 design and is equipped with 8 function keys for users to operate manually. A mode switch key is designed separately, which can be switched between learning, transmitting and communication modes. In order to realize the learning function, the infrared receiving module uses an integrated receiving head NB1838, whose photoelectric detection and preamplifier are integrated in the same package, with a center frequency of 37.9KHz. The epoxy resin packaging structure of NB1838 provides it with a special infrared filter, which has strong protection against natural light and electric field interference. NB1838 amplifies, detects, and shapes the received infrared signal, and modulates the infrared code to obtain a TTL waveform, which is inverted and input into the single-chip microcomputer, and then further processed by the single-chip microcomputer and stored in the EEPROM. The receiving circuit is shown in Figure 2.
Figure 2 Receiver hardware circuit diagram.
Considering that the system requires a large storage space, a separate storage module is designed. The selected EEPROM is AT24C64, which provides 8KB capacity. It communicates with Atmega16 TWI interface through IIC protocol and stores the learned infrared commands here so that they will not be lost when power is off.
In the transmission mode, the system reads the corresponding data information from the EEPROM, uses the amplifier circuit composed of the transistor 9013, and transmits the modulated infrared signal through the high-power infrared transmitting tube. The transmitting circuit is shown in Figure 3. When not transmitting, the transistor works in the cut-off state, and the infrared transmitting tube does not work, which is beneficial to reduce power consumption and extend the service life of the infrared transmitting tube. According to actual tests, the transmission distance can reach about 10m.
Figure 3 Transmitter hardware circuit diagram.
In the communication mode, the system communicates with the host computer through the RS232 circuit. When communicating with the host computer, DS18B20 is used to feedback temperature information. The DS18B20 one-line bus design greatly improves the anti-interference ability of the system, which is unique and economical. The system also adds an RS485 module to facilitate networking to achieve control of multiple infrared devices. When networking, RS485 only needs to use a pair of twisted pairs to connect the "A" and "B" ends of the sub-device. This wiring method is a bus topology structure. Multiple nodes can be connected on the same bus, which is convenient for connection.
In order to increase the practicality of the equipment, the system has designed two power supply schemes, one is to directly connect to a 5V DC power supply, and the other is to connect to a 12V DC power supply, and then step down the voltage to 5V through the transformer circuit composed of L7805.
3 System Software Design and Implementation
The system program is mainly divided into three parts: learning mode, sending mode and communication mode. When entering the system for the first time, the device address is initialized and then the communication baud rate is set, providing three options: 1200, 9600 and 19200. The system main program switches between the three modes and enters the communication mode by default. The mode can be changed through the mode switch button or directly changed through the host computer. For the stability of the system, a software watchdog is added to the program to prevent the program from "running away".
3.1 Learning function design
3.1.1 Learning Mode
Infrared remote controllers have various code types. The codes generally include: frame header, system code, operation code, synchronization code, frame interval code, and frame tail. The positions of synchronization code and frame interval code are not fixed. Therefore, the code format is flexible and changeable, and it is difficult to distinguish the coding meanings of various code types. The coding lengths of various infrared remote controllers are different, and the sending methods are also varied. The most commonly used methods are: a complete frame is sent only once, a complete frame is sent repeatedly twice, and a complete frame is sent first, followed by a frame header and a pulse. Faced with such a variety of coding methods, if the meaning of each code is distinguished for learning, the learning complexity will be very high, and the versatility will also be affected. Therefore, in order to avoid the interference of various code types, the system does not care about the actual meaning of the code data when learning, and only records the time width of the pulse. The system is mainly aimed at infrared remote controllers with a carrier frequency of 38KHz (a period of 26us), and uses the variable IR_time to record the received pulse width. The learning program flow is shown in Figure 4.
Fig. 4 Flowchart of the learning procedure.
3.1.2 Compressed Storage
Since the specific meaning of the code data is not taken into account and only the width of the pulse is recorded, the versatility of the system's learning function is improved. However, the amount of data learned in this way is very large, and the storage requirements become very high.
Although the system has designed a separate storage module for large-capacity storage requirements, data compression technology is used when storing data in order to ensure sufficient storage capacity without increasing hardware overhead and meet the needs of future expansion.
Previous article:Design of RS485 Serial Communication Based on C8051F020 Single Chip Microcomputer
Next article:Design of Reverse Doherty Power Amplifier in 4G-LTE System
- Popular Resources
- Popular amplifiers
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Chip prices are going to drop? Is this good news or bad news?
- Development board brand
- RT-Thread device framework learning——by ID.LODA
- 51 MCU serial communication, display on LCD
- Purgatory Legend-FIFO Battle
- Want to solve the overheating and board separation uncertainty problems of LED driver chips?
- How to quickly and securely connect IoT applications to Google Cloud
- X-NUCLEO-IKS01A3 sensor test based on STM32F401RE development board 7 LSM6DSO click test
- ESD electrostatic protection issues
- Design of intelligent control system for traffic lights