Design of wireless controller based on MC9S08QG8 low-end microcontroller

Publisher:心灵之窗Latest update time:2010-09-18 Source: 现代电子技术 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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 principle block diagram of the wireless controller implemented in this article

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.

Specific design circuit of wireless controller

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.

Reference address:Design of wireless controller based on MC9S08QG8 low-end microcontroller

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

Development and design of more robust ZigBee solutions
ZigBee has received a lot of attention in the field of wireless sensors, mainly because ZigBee promises to provide global unified standards for reliable, cost-effective and low-power wireless communications. And in the current wireless device market, the ZigBee Alliance has made a big step forward in its status thro
[Test Measurement]
Development and design of more robust ZigBee solutions
STM32's USART0 and ZigBee's P02_RX and P03_TX pins realize serial bidirectional communication
STM32's USART0 and ZigBee's P02_RX and P03_TX pins realize serial bidirectional communication BY:T7 Date:20171214 At:YSU_B307 Development Environment: uVision : V5.12.0.0 STM32F103V8T6 Library version: STM32F10x_StdPeriph_Lib_V3.5.0 1. Hardware connection: 1. STM32:   2. Zigbee   3. Z-TEK ZY099 RS232 TO TTL (5V
[Microcontroller]
STM32's USART0 and ZigBee's P02_RX and P03_TX pins realize serial bidirectional communication
Fengjiawei obtained CSA Zigbee compatible platform certification and will make efforts in four major directions in the future
In recent years, AIoT technology has continued to accumulate and upgrade. Driven by multiple factors at home and abroad, fields and industries at different levels of development have alternately promoted the gradual improvement and maturity of the AIoT industry chain, driving the overall explosive growth of the global
[Mobile phone portable]
Fengjiawei obtained CSA Zigbee compatible platform certification and will make efforts in four major directions in the future
Design of automobile test system based on C8051F and Zigbee wireless network
Abstract: With C8051F020 as the core processor, a wireless sensor network data acquisition system is designed. The system uses SZ05-ADV wireless communication module to build a Zigbee wireless network, and combines the software and hardware technology of the embedded system to complete the data acquisition of 8-channel
[Microcontroller]
Design of automobile test system based on C8051F and Zigbee wireless network
Design of indoor intelligent lighting system based on ZigBee and STM32
In people's traditional consciousness, lighting systems are only for lighting purposes. The main control methods in traditional lighting systems are manual control and automatic control. Among them, the manual control method is simple and effective, but it is too dependent on manual operation, and the control is relat
[Power Management]
Design of indoor intelligent lighting system based on ZigBee and STM32
The second in command of intelligent bus monitoring: GPRS and ZigBee
introduction In today's modern life, buses are the most important part of urban transportation. Their operating efficiency and service quality greatly affect urban traffic conditions and citizens' travel conditions. The important criteria for measuring operating efficiency and service quality are whether bu
[Security Electronics]
The second in command of intelligent bus monitoring: GPRS and ZigBee
EEPROM Virtual Technology Based on MC9S08QG8 Single Chip Microcomputer
Introduction MC9S08QG8 (hereinafter referred to as QG8) is a HCS08 series MCU launched by Freeseale in 2006. HCS08 series MCU is an upgrade of HC08 series, with higher bus frequency and lower operating voltage. QG8 bus frequency can reach 10 MHz, and operating voltage can be as low as 1.8 V. In particular, Q
[Microcontroller]
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号