ST20P18 MCU is used in wireless remote control equipment for general household appliances

Publisher:电子设计探索者Latest update time:2012-02-14 Source: 21ICKeywords:ST20P18 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The wireless universal remote control device with a frequency of 433MHz provides a very simple solution for short-distance wireless communication. It is an ideal solution for developing low-cost and low-power wireless communication systems. It is generally composed of a single-chip control circuit, an LCD display circuit, a wireless code sending circuit, etc. According to the number of nodes, it can be divided into single-node and multi-node modes. Single-node is also called point-to-point mode. It has a simple structure and a small size. It is easy to carry and is used to control the communication of a single household appliance; while multi-node is also called point-to-multi-node mode. It can be designed with different numbers of channels according to user requirements, and can also be easily expanded. It can control multiple household appliances at the same time and has complete functions. This system is designed with 16 channels. In the receiving part, multiple household appliances can be controlled according to the received information.

The structural principle and design of system hardware

1 System Introduction

Universal remote control devices are mainly composed of an on/off key, an LCD display, a set key, a confirmation key, a return key, a numeric keypad, etc. Its appearance is similar to that of a mobile phone. Its operation is also very simple. Take the remote control of an electric fan as an example. After turning on the remote control, first

The main menu is displayed, which is the name of various electrical appliances. Use the up and down keys to select the household appliance you want to operate. For example, select "Electric Fan" and press the confirm key to enter its submenu. Then select the item to be operated, such as the size of the wind speed gear, the direction of the fan, etc., and then press the confirm key to enter the next submenu to perform specific operations, such as adjusting the wind speed and wind direction, etc. The remaining household appliances are operated similarly.

The hardware circuit is composed of a 4-bit DIP switch circuit, a wireless transmission circuit, an ST20P18 microcontroller main control circuit, a keyboard scanning circuit, a liquid crystal (LCD) display circuit, etc.

2 Wireless code sending circuit

The single-chip microcomputer used is ST20P18, which is a low-power and low-cost 8-bit single-chip microcomputer manufactured by Taiwan Silicon Creation Company using CMOS technology. The chip has an oscillator, system timer, watchdog timer counter, LCD controller, 16Kb ROM and 192B RAM inside. The schematic diagram of the code sending circuit controlled by ST20P18 is shown in Figure 1. The basic principle of its code sending is: the system uses the code switch to control the setting of the address bit and data bit (binary) information, and then runs the code sending program through the single-chip microcomputer to encode and transform the address bit and data bit information into a series of pulse signals, which are finally transmitted by the wireless transmission circuit. The specific implementation is: the PB0 port of the single-chip microcomputer is the data output port and control port of the code sending circuit. When the code needs to be sent, the port is set as the output port, and then the correct data to be sent is output in the form of pulses according to the relevant communication protocol. Conversely, the PB0 port can be reused for other functions. The pulse data of the PB0 port is modulated by the code sending circuit and transmits 433MHz radio waves.


Figure 1 Wireless code sending circuit

The analog transmitter module circuit built with surface acoustic wave filter in the wireless transmitter circuit has an operating frequency of 433MHz and uses surface acoustic wave resonator SAW for frequency stabilization. The frequency stability is extremely high. When the ambient temperature changes between -25 and +85℃, the frequency drift is only 10-6/℃, which is particularly suitable for one-transmit-multiple-receive wireless remote control and data transmission systems. However, since the transmission of radio signals is affected by many factors, the general practical distance is only half of the standard ideal distance or even less. This needs to be noted during development. If a longer transmission distance is required, a first-level RF power amplifier can be added at the output end of the transmitter module.

After studying the circuit, the following conclusions were drawn:

● In order to obtain a stable and correct frequency, after repeated debugging, it was found that the radio wave frequency depends on R3. When R3=15kΩ, the transmitted radio frequency is 433MHz.

● Since the module is built with analog circuits, its performance is not as good as other types of digital RF chips, but its cost is quite low! Considering the size and cost factors and the short RF wavelength, a 50Ω 1/4 wavelength dipole microstrip printed circuit antenna is selected in the design, that is, a printed electrical conductor separated by a dielectric in the ground layer. Therefore, the shape and length of the antenna play a vital role in this circuit. Design practice shows that if the shape and length of the antenna do not meet the 50Ω 1/4 wavelength dipole antenna, the circuit will be unstable in transmission, and more seriously, it will directly lead to the circuit being unable to oscillate.

3 Keyboard scanning circuit

Since the I/O ports of ST20P18 are limited, the keyboard circuit is implemented by scanning. The implementation of this circuit is shown in Figure 2. The basic principle of its operation is: after the microcontroller is initialized, PA0 to PA5 and 6 I/O ports are set to input mode. Taking K1 as the research object, first set the PA0 port to a high level and the PA5 port to a low level. When the K1 button is pressed, PA0 jumps from a high level to a low level and generates an interrupt. The microcontroller responds to the interrupt and executes the interrupt service program. Similarly, the other 6 buttons also work in this way. The microcontroller scanning principle is from top to bottom and from left to right.

Figure 2 Keyboard scanning circuit

4 LCD display circuit

The ST20P18 microcontroller used in this design has a built-in control/drive LCD module in its core. The LCD (Figure 3) display module is an 8×40 dot matrix, which is often used for LCD display of remote control devices. The main control pins of the LCD display are COM0~COM7. This design only uses COM0~COM3.

LCD display circuit

Figure 3 LCD display circuit [page]

The display RAM of this module is divided into 4 blocks, each with 5 rows and 8 columns, so there are 4×5×8 bits in total. Each 8-dot column on the LCD screen corresponds to a column byte in the display RAM. When the block address and column address are set, a column byte in the display RAM is uniquely determined. The top bit in each column byte is the LSB, and the bottom bit is the MSB. Assigning a column byte of the display RAM is to control whether the corresponding pixel on the LCD screen is displayed. By writing the fonts of different characters into the display RAM bytes at different positions, the corresponding required characters can be displayed on the screen.

Software Design of Universal Remote Control

After powering on, the system will be initialized first, including the initialization of the MCU, LCD and other modules. For power saving, if no key is pressed within 40 seconds, the LCD controller of the MCU will enter the idle mode. Use the "for" loop to count, and set the initial value to zero. Then start the 40-second count. If a key is pressed during this period, the interrupt service program will be entered. If no key is pressed within 40 seconds, the LCD controller of the MCU will enter the idle mode. If a key is pressed during the idle mode, the MCU will be awakened and the interrupt service program will be executed. Since the LCD controller of the MCU is awakened by the interrupt and returns after executing the interrupt program, the MCU will continue to execute the next instruction of the instruction that sets the LCD controller of the MCU to the idle mode. Therefore, there is another loop to count after the instruction that sets the LCD controller of the MCU to the idle mode. Since the initial value of the count is reset to zero before the interrupt returns, the 5-second count will be restarted. If no key is pressed within 40 seconds, the LCD controller of the MCU will enter the idle mode again. The program flow chart is shown in Figure 4.

Figure 4 Software design process

Communication Protocol

1 Codeword format

The logic circuit that can realize the encoding function is called an encoder. Each remote control encoding chip has a specific encoding format. We take the time to transmit a binary number 0 or 1 as a time unit T, and the frequency of the encoding signal is F=1/T. The commonly used encoding format is used here. Each frame consists of a step code, an address code and a data code. The synchronization code is used at the beginning of a frame and is the identification mark of a frame. The width is 8T; the address code is 20 (A0-A19), the width is 20T; the data code is 4 bits (D0-D3), the width is 4T, and the total time occupied by a frame is 32T.

Corresponding to each state, a special code can be generated inside the encoding chip. This code is also composed of "1" and "0", but it does not simply use high level to represent "1" and low level to represent "0". Instead, it uses the difference in the width ratio of high level to low level to distinguish "1" and "0", which is the so-called duty cycle. In order to improve the reliability of this encoding transmission serial signal, this encoding uses a pulse with a duty cycle of 1/4 to represent 0, a pulse with a duty cycle of 3/4 to represent 1, and a pulse with a duty cycle of 1/32 to represent the synchronization signal, as shown in Figure 5.

[page]

Signal duty cycle

Figure 5 Signal duty cycle

2 Protocol Design

Usually, the transmission of remote control signals is to modulate the control instructions and information codes (a sequence of 0s and 1s) corresponding to a certain button on a carrier in the range of 32 to 56 kHz, and then amplify and drive the wireless transmission circuit to transmit the signal.

As shown in Table 1, the functions of each part of the code are as follows: The guide code is used to inform the receiver that the following is remote control data. The address code is used to distinguish which model the data is for, and the receiving end uses this to determine whether the subsequent data is a command that must be executed by the machine. The information code is used to distinguish which key is pressed. The receiving end receives the data of the information code and makes a judgment on what action should be performed based on it. The information code also includes the continuous code sent when the key is pressed continuously. It tells the receiving end that a certain key is being pressed continuously. The end code is used to notify the receiver that a frame of data has been sent.

The key to the remote control data transmission system is the reliability of data transmission. In order to improve the reliability of coding, this protocol stipulates that an inverse code is transmitted after the address code for error checking. A parity bit is transmitted after each bit of information code and is also used for error checking.

Conclusion

The innovation of this design is that it proposes a design scheme for universal home appliance remote control equipment, which can control multiple home appliances according to actual requirements, achieve low power consumption in sleep mode, and has a lower cost than other similar products. After actual operation measurement, the wireless transmission system works stably, has strong penetration ability, and low power consumption (when in idle mode, the current in the circuit is less than 10μA), and can well realize the functions required by the corresponding design.

Keywords:ST20P18 Reference address:ST20P18 MCU is used in wireless remote control equipment for general household appliances

Previous article:Design of high quality wireless audio repeater based on VMR6512
Next article:A DSP Program Optimization Method for XC166 Single-Chip Microcomputer Independent of Hardware Technology

Recommended ReadingLatest update time:2024-11-17 00:37

ST20P18 MCU is used in wireless remote control equipment for general household appliances
The wireless universal remote control device with a frequency of 433MHz provides a very simple solution for short-distance wireless communication. It is an ideal solution for developing low-cost and low-power wireless communication systems. It is generally composed of a single-chip control circuit, an LCD disp
[Microcontroller]
ST20P18 MCU is used in wireless remote control equipment for general household appliances
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号