Wireless communication is a part of people’s daily life. In the office, school or home, people are in contact with wireless communication equipment, such as notebook computers, printers, cameras, handheld devices, lighting controllers and home appliances. The complexity of these devices is related to the types of tasks they perform. Many home automation wireless applications use small microcontrollers and a small amount of code to perform simple tasks, and pursue low cost, singleness and miniaturization. In the current many wireless network technology, ZigBee technology as a new wireless network technology, in the past two years in industrial control, consumer electronics and other fields as well as scientific research and development has been a lot of attention and use, and more and more show its strong application momentum. ZigBee is a low-power, short-range and low-speed wireless network technology, which works in the 2.4GHz international unlicensed frequency band. In IEEE standard, ZigBee, WLAN and Bluetooth belong to the 802 family of wireless personal area network.
Usually, ZigBee wireless controller node is composed of a high-end microcontroller as the core and wireless transceiver. This paper will design a new, low-cost, using ZigBee wireless technology, such as the compact wireless controller for air conditioning remote control, the whole target application board has few components, wiring and volume. The design only uses three electronic chips: a low-end microcontroller (MC9S08QG8), an RF transceiver (mc13192) and a 16 bit MCU × 2 LCD, and other required components are passive components such as resistors and buttons.
The concrete design of hardware circuit
According to the consideration of device selection and overall construction, the specific design circuit of wireless controller completed in this paper is shown in Figure 2. Most of the pins of MC9S08QG8 microcontroller (MCU) have multiple functions. In the circuit design, MC9S08QG8 is used as the core to realize various kinds of control.
Figure 2 the application schematic diagram of wireless controller is divided into three parts: the basic connection required by MC9S08QG8 MCU; MCL 3192 wireless transceiver connection; sixteen × 2 LCD and 4 key connection.
The power supply of each part is low voltage 3 V, which can be supplied by two 7 batteries. The clock circuit of MCU does not need external crystal oscillator, but directly uses the internal clock of MCU; The RST and bkgd pins of MCU are used for the connection of BDM interface. After the program is downloaded, they can be used for other purposes. For example, the interrupt signal iro of mcl3192 is connected to pta3 / RST / IRQ for multiplexing; In Figure 2, other peripheral circuits of mcl3192 transceiver use the minimum hardware requirements provided in the data book. The connection between MCU and mcl3192 is in accordance with the standard SPI mode. MCU is the master and mcl3192 is the slave. The transceiver can be configured through the signal lines of MoSi, miso and spsck, and the data can be sent and received. At the same time, the timer and GPIO pins provided by the transceiver can also be configured through SPI for other purposes. The chip select CE signal of transceiver is gated by the general I / O port ptb5 of MCU. The transceiver needs another signal to switch the operation mode (receive, send, semi sleep, sleep or idle). This signal is called rxtxen and is processed by the general I / O port ptb7 of MCU. The data transmission mode between MCU and mcl3192 can adopt stream mode. Each time a word (16b) is sent or received, it is controlled and processed by MCU through interrupt, which can ensure the real-time performance of data transmission to the maximum extent.
sixteen × 2. The RS, R / W and e signals of LCD are controlled by three pins of general I / O port PTB of MCU. In fact, R / W can be directly connected to low level or controlled by software to keep low level all the time, because only commands and data writing to LCD are needed in application; The data line adopts the 4-wire access mode of LCD, that is, only db4-db7 is used, which is provided by pta0-pta3 of MCU; Backlight power BKL +, BKL – not connected to reduce power consumption. The four buttons are also connected to pta0 ~ pta3 of MCU, which are multiplexed with LCD data line. The pull-up resistance of the buttons is configured inside MCU, so there is no need to connect external pull-up to save components. At the same time, when waiting to process the key, MCU configures the key input directly as the key input interrupt, which also reduces the hardware connection and software complexity. When the key occurs, MCU automatically turns to read the key input and key processing. When LCD display is needed, MCU temporarily configures the multiplexing line as data output to complete the LCD content display with LCD control signal. The 8 KB flash and 512 B memory resources of MCU are enough for general wireless control. In addition, the timer resources of MCU will be used in the design. The timing time needed in general wireless control applications can be generated by timing comparator, which can be easily realized by software programming.
This paper only uses a Freescale MC9S08QG8 low-end microcontroller, plus a few connecting lines and hardware resources, has wireless communication ability and human-computer interaction function. This shows that ZigBee wireless applications do not always need high-performance microcontrollers, and low-end microcontrollers can also complete some basic tasks required by wireless network, thus reducing the cost of the whole solution. At the same time, the wireless controller has the characteristics of low power consumption, few components, low cost, high performance and full function, which is a simplified solution for embedded wireless control applications.