Design of intelligent remote control signal transmitting device based on USB port

Publisher:科技奇才Latest update time:2013-08-06 Source: DZSC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  0 Introduction.

  There is a kind of intelligent switch on the market, which can use a remote control to control the on and off of the appliances connected to the switch. Its working principle is to use a single chip microcomputer to simulate PT2272 for software decoding according to the traditional general protocol. However, the disadvantage is that the number of terminals controlled by the sending end is too small. One remote control can only control 4 terminals at most. In order to make up for the deficiency of the product in this aspect, this device is designed.

  The design idea is to use a single-chip microcomputer to simulate the PT2262 chip encoding on the original remote control according to the PT2262/2272 transmission protocol, and then connect the system and the computer to communicate through the USB port, so that the receiving end can be directly controlled by the computer, which greatly increases the number of controls. It is more practical and more powerful.

  1 Hardware Design

  1.1 Overall system design

  The system is mainly composed of a USB to serial port module, a single-chip microcomputer main control module and a wireless signal transmission module. The system block diagram is shown in Figure 1. The working process of the system is that the computer sends data to the single-chip microcomputer through the USB serial port, and the single-chip microcomputer returns the received data to verify whether the data is sent correctly. If the received data is incorrect and the original data is sent, it will be resent. If the reception is correct, the single-chip microcomputer encodes the received data and transmits it to the wireless transmission module, which transmits the signal. During the signal transmission process, an LED light is used to indicate whether the signal transmission is completed.

Figure 1 System

Figure 1 System

  1.2 Design of each module

  1.2.1 USB to serial port module design

  The circuit of the module is shown in Figure 2. The module adopts a classic circuit design, and the conversion chip is PL2303HX. At the same time, in order to realize the productization of the device and reduce its size, the use of components is minimized while maintaining reliable performance. Figure 2 is the most simplified circuit design diagram.

Figure 2 USB to serial port module circuit.

Figure 2 USB to serial port module circuit.

  1.2.2 Single chip control module design

  Hardware design of the single-chip control module: Connect the RXD and TXD lines of the USB serial port module to the TXD and RXD lines of the single-chip microcomputer respectively to realize the information transmission and exchange between the single-chip microcomputer main control module and the computer. At the same time, select two ports at the P1 port, one connected to the LED indicator to indicate the working status, and the other as a data output port connected to the wireless transmitter module for information transmission between the single-chip microcomputer module and the wireless transmitter module.

  1.2.3 Wireless Transmitter Module Design

  This module is mainly responsible for transmitting the codes transmitted from the MCU main control module in sequence. The module circuit uses the common 315 wireless transceiver circuit diagram, as shown in Figure 3. It is a three-point oscillation circuit composed of a SAW resonator and a high-frequency transistor. The data is input by the MCU, and the high-frequency oscillator is controlled by transistor Q2 to realize the OOK modulation transmission of the data. [page]

    2 Software Design

  The software is designed according to the previous workflow and is divided into various modular designs. The main program modules include: serial port initialization, serial port communication between PC and MCU, MCU interpretation of data transmitted from PC and data encoding design, and wireless transmission of data.

Figure 3 Wireless transmitter module circuit

Figure 3 Wireless transmitter module circuit

  2.1 Determination of Coding Rules

  The manual remote control uses the PT2262 chip. Although the PT2262/PT2272 coding rules can be found, the coding rules must be re-measured with an oscilloscope for the sake of caution. When a button on the remote control is pressed, the oscilloscope is used to measure the transmission waveform and draw a waveform diagram. Through comparison and calculation, the coding rules of the manual remote control are determined to be: synchronization code + eight-bit address code + four-bit data code. Each bit of the code has three states: high impedance, high level and low level. The waveform diagram of each state is shown in Figure 4. The synchronization code length is 128a, and the first 4a are narrow pulses.

Figure 4 PT2262 bit pulse waveform

Figure 4 PT2262 bit pulse waveform

  2.2 Delay setting

  The main delays in program design are as follows: a, 4a, 12a and 124a are accurately set. By measuring the corresponding minimum delay unit a in the manual remote control, which is 120μs, an accurate single-chip delay program is written. At the same time, when programming and setting the delay, comprehensive considerations should be made. It is worth noting that the instruction operation speed of the single-chip microcomputer chip used in this system is 6 times that of the traditional 51 series single-chip microcomputer. The setting of these 4 benchmark delays should minimize the deviation. In order to improve the accuracy, the time consumed in executing each instruction should be taken into account.

  At the same time, the delay programming of 4a and 12a cannot be completed by simply repeating the delay of a several times, otherwise there will be a large error and it cannot be decoded correctly. The delay setting must be repeatedly calculated and measured to see if it is accurate. If it is not accurate, it should be modified.

  2.3 Analog pulse coding

  According to the PT2262/PT2272 protocol, and by measuring the transmission waveform of the manual remote control, it is known that the analog coding of the microcontroller should be divided into three parts, namely the synchronization code, the address code and the data code.

  The address code and data code originally have three states, namely high level, low level and high impedance. The address code in the manual remote control has been fixed when welding the circuit, and the measured code is in high impedance state. The 4-bit data code is controlled by 4 buttons respectively, so there are only two states of high level and low level. Only one button can be pressed during remote control, so a manual remote control has only 4 different codes, so a manual remote control can only control 4 different terminals at most. However, when encoding in a single-chip microcomputer, it can be flexible and changeable without control. If 1 and 0 are used to represent the two states of high and low levels, then up to 212 different terminals can be controlled. If 00, 01, and 10 are used to represent these three states, then up to 312 different terminals can be controlled. In an ordinary working environment, only using 1 and 0 to encode can meet general design requirements.

  When using a single-chip microcomputer to simulate pulse coding, the data stream sent by the USB to serial port module is converted by the corresponding algorithm to determine the state of each bit of the 8-bit address code and the 4-bit data code, and then different reference delays are called to simulate different state codes, thereby forming a simulated 12-bit waveform code. At the same time, a simulated synchronization code is added at the end. The synchronization code can be independently compiled into a program and directly called and inserted. In this way, the simulated PT2262 chip coding is completed through the software programming of the single-chip microcomputer.

[page]

2.4 Experimental Results

  The system has been completed, and the finished product has been completed through PCB plate making and welding, as shown in Figure 5. Since the shell problem was not taken into consideration during PCB plate making, the PCB layout is not perfect enough, resulting in the position of the LED indicator light not being very appropriate.

Figure 5 Positive and negative effects of the system.

Figure 5 Positive and negative effects of the system.

  Since the starting point of the system design is to use a computer instead of a remote control, after the hardware of the system is completed, a control software that can be installed on any computer is written in LabVIEW language. The control interface of the software is shown in Figure 6. The number of ports that can be effectively controlled in the software is 212, that is, 4096, which far exceeds the number of control ports of ordinary remote controls and can basically meet the needs of various occasions.

Figure 6 System software control interface

Figure 6 System software control interface

  3 Conclusion

  This system has been completed and debugged successfully. A computer can control a simple set of electric lights through this device. The system is packaged in a traditional USB flash drive shell and has obtained a national utility model patent certificate. Patent number: ZL2010 2 0546946.5). The system has a simple structure, light volume, flexible control, and is controlled by a computer. The control software is a control program window written in LabVIEW. At the same time, the system can achieve remote intelligent remote control of the receiving terminal through wireless media or the Internet through functional expansion. It belongs to the application scope of the Internet of Things and has broad application prospects.

Reference address:Design of intelligent remote control signal transmitting device based on USB port

Previous article:How many methods are there to read data from each I/O port? How to read latch instructions?
Next article:Why do we need to set up an interrupt system? What are the entry addresses of each interrupt service routine?

Latest Microcontroller Articles
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号