0 Introduction
Wireless communication is part of people's modern daily life. In offices, schools or homes, we are exposed to wireless communication devices such as laptops, printers, cameras, handheld devices, lighting controllers and home appliances. The complexity of these devices is related to the types of tasks they perform. Many wireless applications for home automation use small microcontrollers and a small amount of code to perform simple tasks, pursuing low cost, simplicity and miniaturization. Among the many wireless network technologies currently available, ZigBee technology, as an emerging wireless network technology, has received a lot of attention and use in the fields of industrial control, consumer electronics and scientific research and development in the past two years, and it is increasingly showing its strong application momentum. ZigBee is a low-power, short-distance and low-speed wireless network technology that operates in the 2.4 GHz international license-free frequency band. In the IEEE standard, it belongs to the wireless personal area network in the 802 family together with wireless LAN and Bluetooth.
The usual ZigBee wireless controller node is based on a high-end microcontroller with a wireless transceiver. This article will design a new, low-cost, streamlined wireless controller using ZigBee wireless technology, such as for air conditioner remote control, with very few components and traces on the entire target application board, and a very small size. The design uses only three electronic chips: a low-end microcontroller (MC9S08QG8), an RF transceiver (MC13192) and a 16×2 LCD. The other components required are passive devices such as resistors and buttons.
1 Device Selection
In order to achieve the goal of low cost for industrial or home appliance wireless control applications, the first task is to choose the right microcontroller (MCU) and wireless transceiver. Freescale Semiconductor (formerly Motorola Semiconductor Division) has gained more and more applications in the field of embedded control in China. Its latest MC9S08QG low-end microcontroller series, with its processing core, on-chip peripherals, power-saving functions and development tools, constitutes an ideal solution for cost-, energy- and efficiency-sensitive control applications. With the MC9S08QGx microcontroller series, not only can the development costs be significantly reduced, but the costs of the final production stage can also be greatly reduced. In the development stage, some advanced debugging functions, including the CodeWarrior full-featured tool chain and the ProcessorExpert toolkit, are free. In the production stage, the internal clock source module, analog circuits and E2PROM simulation reduce the need for external devices such as crystal oscillators or resonators, analog comparators, serial E2PROMs, etc., which are otherwise indispensable on the printed circuit board.
The core device of this wireless controller design is the 16-pin MC9S08QG8 from Freescale. It is a highly integrated device in the Freescale 8-bit microcontroller series that uses the high-performance, low-power HCS08 core, with built-in 8 KB FLASH memory, 512 B RAM, SCI/SPI/IIC interface, 8-bit analog/digital timer module, A/D module, etc. The MC9S08QG8 MCU integrates performance that is usually only available in larger and more expensive components, including a background debugging system and built-in online emulation (ICE) function for real-time bus capture, a single-line debugging and emulation interface (BDM), and a programmable 16-bit timer/pulse width modulation (PWM) module (TPM), making it one of the most flexible and economical modules in its class.
Another major chip is the wireless transceiver. Freescale Semiconductor's MCl3192 is also selected. It is a new RF chip that complies with the ZigBee standard. Its operating frequency is 2.405-2.480 GHz. The frequency band is divided into 16 channels, each of which occupies 5 MHz of bandwidth. It uses direct sequence spread spectrum communication technology and has a data transmission rate of 250 Kb/s. MCl3192 has an optimized digital core that helps reduce MCU processing power and shorten execution cycles. In order to meet the requirements of low power consumption, the chip has three low-power operation modes in addition to the three working states of receiving, transmitting and idle:
Power-down mode: In this mode, the chip current is less than 1μA;
Sleep mode: The current in this mode is about 3μA;
Sleep mode The current in this mode is about 35μA.
The chip adopts programmable power output mode, with a transmission power of 0 to 4 dBm, a receiving sensitivity of -92 dBm, and a transmission distance of 30 to 70 m. Due to the low power consumption characteristics and SPI communication interface of MC13192, it is very suitable for cooperating with MC9S08QG8 microprocessor to solve low voltage, low power consumption applications and communication control of battery-powered equipment.
As for other peripheral devices, general ones can be selected. For example, the liquid crystal display uses a 16×2 character LCD, and the buttons are matched according to the final process requirements. The circuit application of this part is a mature technology.
2 Overall construction of the wireless controller
Based on the selection of the above-mentioned main components, the principle block diagram of the wireless controller implemented in this paper is shown in Figure 1.
The interface used to exchange data between the transceiver and the microcontroller is mainly the serial peripheral interface (SPI). The microcontroller MC9S08QG8 reads and writes the internal registers of the MCl3192 through the SPI interface (4 lines), thereby completing the control and data communication of the MCl3192. This interface can read and write the configuration, status and control registers of the transceiver. The SPI interface can also read and write the RAM located inside the transceiver, which is used to send and receive data via RF. Another signal used for communication between the transceiver and the microcontroller is the interrupt request (IRQ) signal. The IRQ pin is processed by the transceiver. When the status register of the transceiver changes, the IRQ pin will generate a falling edge jump. After the IRQ is generated, the first thing the microcontroller does is to read the status register to determine the specific event that caused the interrupt.
The microcontroller MC9S08QG8 is connected to the LCD display and buttons through the general-purpose I/O interface GPIO. The LCD data line and button input line are designed to be multiplexed (4 lines in total), and the LCD control line is provided separately by the MCU (3 lines in total).
BDM program download and online debugging only occupy a single line of MCU, which is necessary at the beginning of design, but after the debugging and downloading are completed, this lead can also be used as a normal I/O or as a spare.
3. Specific design of hardware circuit
According to the considerations of device selection and overall construction, the specific design circuit of the wireless controller completed in this paper is shown in Figure 2. Most of the pins of the MC9S08QG8 microcontroller (MCU) have multiple functions. In the circuit design, MC9S08QG8 is used as the core to realize various controls.
Figure 2 shows the wireless controller application schematic in three parts: the basic connections required by the MC9S08QG8 MCU; the connections for the MC13192 wireless transceiver; and the connections for the 16×2 LCD and four buttons.
The power supply of each part is low voltage 3 V, which can be powered by two No. 7 batteries. The clock circuit of MCU does not need an external crystal oscillator, and directly uses the clock inside the MCU; the RST and BKGD pins of MCU are used for the connection of BDM interface, and can be used for other purposes after the program download is completed. For example, the interrupt signal IRO of MCl3192 is connected to PTA3/RST/IRQ multiplexing; the other peripheral circuits of MCl3192 transceiver in Figure 2 use the minimum hardware requirements required for work provided in the data sheet. The connection between MCU and MCl3192 is connected in a standard SPI manner, with MCU as the host and MCl3192 as the slave. The transceiver can be configured and data can be sent and received through the MOSI, MISO, and SPSCK signal lines. At the same time, the timer and GPIO pins provided by the transceiver can also be configured through SPI and used for other purposes. The chip select CE signal of the transceiver is selected by the general I/O port PTB5 of the MCU. The transceiver needs another signal to switch the operation mode (receive, transmit, semi-sleep, sleep or idle), which is called RXTXEN and is processed by the general I/O port PTB7 of the MCU. The data transmission mode between the MCU and the MCl3192 can adopt the stream mode. Each time a word (16 bits) is sent or received, it is controlled and processed by the MCU through an interrupt, which can maximize the real-time performance of data transmission.
The RS, R/W, and E signals of the 16×2 LCD are controlled by three pins of the MCU's general I/O port PTB. In fact, R/W can be directly connected to a low level, or software control can always be low, because only commands and data writing to the LCD are required during application; the data line uses the LCD's 4-wire access form, that is, only DB4~DB7 is used, provided by the MCU's PTA0~PTA3; the backlight power supply BKL+ and BKL- are not connected to reduce power consumption. The 4 buttons are also connected to the MCU's PTA0~PTA3 and multiplexed with the LCD data line. The pull-up resistor of the button uses the MCU's internal configuration, and no external pull-up is required to save components. At the same time, when waiting for the button to be processed, the MCU directly configures the button input as a button input interrupt, which also reduces the hardware connection and software complexity. When the button occurs, the MCU automatically switches to read the button input and button processing. When the LCD display is to be performed, the MCU temporarily configures the multiplexed line as a data output, and cooperates with the LCD control signal to complete the LCD content display.
The MCU's 8 KB FLASH and 512 B memory resources are sufficient for general wireless control. In addition, the MCU's timer resources are also used in the design. The timing comparator is used to generate the timing required in general wireless control applications, which can be easily implemented through software programming.
4 Wireless Control Function Example
The above design is suitable for a variety of wireless control applications, such as wireless control of air conditioners, smart fans, etc. Based on this solution, more complex wireless control applications can be expanded, because the MCU still has a small number of ports (such as adding a device switch button), and MCl3192 also has many interfaces such as its own GPIO, timer, etc., which are all available resources; at the same time, this solution can actually be simplified, for example, wireless control applications that do not require display can omit the LCD display.
Taking the wireless control application of air conditioner as an example, according to the hardware design principle of this article, LCD is used to display different function menus, such as current temperature, timer setting, temperature setting and working status report. The 4 buttons can be arranged as follows:
SW1 is for function menu or status report; SW2 is for increasing value or function switching; SW3 is for decreasing value or function switching; SW4 is for confirmation or acceptance, and also serves as a switch device.
When the application starts, the air conditioner is always off. You must press the SW4 button to turn the air conditioner on. When the air conditioner is forced to turn off, the SW1+SW4 buttons work. After the air conditioner is turned on, the current temperature and the last set temperature will be displayed on the LCD. Once the air conditioner is turned on, you can use the SW2 and SW3 buttons to lower or increase the temperature respectively. At this time, if you want to set various working modes of the air conditioner such as cooling, heating, dehumidification, automatic, wind direction, wind speed, timing time and temperature, you can press SW1 to switch functions and cooperate with SW2 and SW3 to operate. Each time you use the buttons to modify the working mode, temperature, timing time and other settings, the system will use a simple protocol to send the control command to the heating/cooling system through the MCl3192 wireless transceiver. At this time, you can press the SW4 button to confirm so that the LCD returns to the status report and the new setting indication.
If the timer is not set, the air conditioner will never turn off automatically and needs to be shut down manually. Setting the timer can automatically shut down the air conditioner. The timer can be set between 5 and 300 minutes. If you want to set the timer, follow the steps below:
(1) Turn on the air conditioner. If the air conditioner is off, you cannot set the timer.
(2) Press SW1. Adjust the menu to the timing function so that the timing setting menu is displayed on the LCD;
(3) Press SW2 or SW3 to decrease or increase the desired timing time;
(4) Press SW4 to accept the new timing time;
(5) Once the new timing time is accepted, the LCD will display the working mode, current temperature, timing time, remaining time and other related information again.
Corresponding to the timed shutdown of the equipment, the automatic start-up function of the air conditioner requires adding a special clock chip based on the circuit in this article to obtain the date and time information benchmark to achieve it. The specific details are not discussed in this article.
5 Conclusion
This article uses only a Freescale MC9S08QG8 low-end microcontroller, plus a few connecting wires and hardware resources, and already has wireless communication capabilities and human-computer interaction functions. This shows that ZigBee wireless applications do not necessarily always require high-performance microcontrollers. Low-end microcontrollers can also complete some basic tasks required by wireless networks, thereby reducing the cost of the entire solution. At the same time, the wireless controller implemented in this article has the characteristics of low power consumption, few components, low cost, high performance and full functions. It is a streamlined solution for embedded wireless control applications.
Previous article:WLAN Email Mobile Terminal Based on ARM2410
Next article:Design of universal motor control device based on ATmegal6 single chip microcomputer
Recommended ReadingLatest update time:2024-11-16 16:49
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Detailed explanation and engineering practice of unmanned monitoring technology (Xie Jianbin, Li Peiqin, Yan Wei, Liu Tong, Lin Chenglong, Hong Quanyi, Zhou Hongfei, Cui Yibing)
- Introduction to Wireless Sensor Networks (Edited by Ma Sasa et al.)
- Introduction to the Internet of Things (Liu Yunhao)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How to quickly design a pulse oximeter? TI offers tips!
- Seek help from testing and packaging partners
- Summary: BearPi-Hongmeng-BearPi-HM Nano Review Summary
- "In-depth understanding of BootLoader", introducing the development theory, process and examples of BootLoader
- Weekly review information is here~
- Share an easy-to-understand msp430 microcontroller learning tutorial
- Simulation of a Microstrip Patch Antenna for 2.4 GHz Applications with Radiat...
- Analysis of DSP2407's frame pointer (FP) and stack pointer (SP)
- msp430 MCU rc522 radio frequency program and circuit diagram
- EEWORLD University Hall----FPGA Design Skills and Specifications