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-range 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 composed of a high-end microcontroller as the core and a wireless transceiver. This article will design a new, low-cost, compact 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 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 select 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 ProcessorExpert toolkit, are free. In the production stage, the internal clock source module, analog circuit 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. It has 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 the performance that is usually only available in larger and more expensive components, including a background debugging system and a 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). It is one of the most flexible and economical modules in its class.
The other main chip is the wireless transceiver, which is also the MCl3192 from Freescale Semiconductor, a new RF chip that complies with the ZigBee standard launched by Freescale. Its operating frequency is 2.405~2.480 GHz, and the frequency band is divided into 16 channels, each channel occupies 5 MHz bandwidth; it adopts direct sequence spread spectrum communication technology, and the data transmission rate is 250 Kb/s. MCl3192 has an optimized digital core, which helps to reduce MCU processing power and shorten the execution cycle. 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 which the chip current is less than 1μA;
sleep mode in which the current is about 3μA;
hibernation mode in which the current is about 35μA.
The chip adopts programmable power output mode, the transmission power is 0~4 dBm, the receiving sensitivity can reach -92 dBm, and the transmission distance is 30~70 m. Due to the low power consumption characteristics of MC13192 and the SPI communication interface, it is very suitable for cooperating with the MC9S08QG8 microprocessor to solve low-voltage, low-power 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 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 generated the interrupt.
The microcontroller MC9S08QG8 completes the connection with the LCD display and buttons through the general I/O interface GPIO, where the LCD data line and the button input line are designed to be multiplexed (4 lines in total), and the control line of the LCD 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
Based on the considerations of the previous 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 The wireless controller application schematic is divided into three parts: the basic connections required by the MC9S08QG8 MCU; the connection of the MCl 3192 wireless transceiver; and the connection of the 16×2 LCD and 4 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, send, 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 MCl3192 can adopt the stream mode. Each time a word (16 b) is received and sent, 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 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 in the application; the data line adopts the 4-line access form of the LCD, that is, only DB4~DB7 is used, which is 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 PTA0~PTA3 of MCU, and multiplexed with LCD data line. The pull-up resistor of the button is configured inside MCU, and no external pull-up is needed to save components. At the same time, when waiting for the button to be processed, MCU directly configures the button input as a button input interrupt, which also reduces the hardware connection and software complexity. When the button occurs, MCU automatically switches to read the button input and button processing. When LCD display is required, MCU temporarily configures the multiplexed line as data output, and completes the LCD content display with LCD control signal.
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 time required in general wireless control applications is generated by the timing comparator, which can be easily implemented through software programming.
4 Wireless Control Function Example
The above design scheme is suitable for a variety of wireless control applications, such as wireless control of air conditioners, smart fans, etc. On the basis of this scheme, more complex wireless control applications can be expanded, because the MCU still has a small number of ports (such as adding another device switch button), and MCl3192 has many interfaces such as its own GPIO, timer, etc., which are all available resources; at the same time, this scheme can actually be simplified. For example, for wireless control applications that do not require display, the LCD display can be omitted.
Taking the wireless control application of air conditioners as an example, according to the hardware design principle of this article, LCD is used to display different function menus, such as current temperature, timing setting, temperature setting, and working status report. The 4 buttons can be arranged as follows:
SW1 is a function menu or status report; SW2 is to increase the value or switch the function; SW3 is to reduce the value or switch the function; SW4 is to confirm or accept, and it also serves as a switch device.
When the application starts, the air conditioner is always in the off state. You must press the SW4 button first to turn on the air conditioner. 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, the temperature can be lowered or increased using the SW2 and SW3 keys respectively. At this time, if you want to set the various working modes of the air conditioner, such as cooling, heating, dehumidification, automatic, wind direction, wind speed, timer and temperature, you can press SW1 to switch the function and cooperate with SW2 and SW3 to operate. Each time the working mode, temperature, timer and other settings are modified by the keys, 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 key 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 forced to turn off manually. Setting the timer can automatically turn off the air conditioner. The timer time can be set between 5 and 300 minutes. If you want to set the desired timer time, the steps are as follows:
(1) Turn on the air conditioner. If the air conditioner is in the off state, the timer time cannot be set;
(2) Press the SW1 key. Adjust the menu to the timing function, so that the timing setting menu is displayed on the LCD;
(3) Press SW2 or SW3 to reduce 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 again display the working mode, current temperature, timing time, remaining time and other related information.
Corresponding to the timed shutdown of the equipment, the automatic opening 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, which is 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:ZVS Phase-Shifted Full-Bridge Controller UCC3895 and Its Application
Next article:Arc length fuzzy controller for submerged arc automatic welding
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- 【Project source code】CRC32 calculation based on FPGA
- Download and get a gift | TE pressure sensor solutions
- ST sensor driver package, official C-Driver-MEMS
- How to measure analog voltage using the ADC of MSP430?
- Please recommend oscilloscopes, tables, power supplies and other equipment
- 【Project source code】Image display system based on FPGA on-chip ROM
- Problems with the primary absorption clamp circuit in the flyback circuit
- How to use MSO5 series oscilloscope to capture abnormal signals?
- Analysis of interrupt processing of S3C2410 && WinCE6.0
- What is the impedance of a power module?