Design of a wireless sensor network based on the ZigBee protocol
2026-04-06 05:59:25··#1
Abstract: This design uses the ultra-low-power microcontroller MSP430F149 as the core, combined with peripheral sensors and a wireless transceiver module to design a sensor network node. The MSP430F149 controls the sensors to collect temperature and vibration data from the environment, performs preliminary processing on the raw data, and then the wireless transceiver module conforming to the ZigBee protocol sends the data to neighboring nodes. The data is forwarded cascadingly through the sensor network nodes and finally sent back to the aggregation node, which then sends it to the monitoring computer to achieve environmental monitoring. Keywords: MSP430F149, IEEE802.15.4/ZigBee, wireless sensor network, node, low power consumption Abstract: A design scheme of wireless sensor network node based on low power MCU MSP430F149 is given. The node is composed of MSP430F149,sensors,wireless communication module and batteries. MSP430F149 makes sensors to collect the temperature and vibration signals in environment, and processes the original data, after that sends the data to the neighboring nodes by wireless communication module which is complied with the IEEE802.15.4/ZigBee protocol. The processed data are sent to the sink node which is connected to the supervisor device. Finally , we can monitor the environment by the supervisor computer . Introduction Sensors, as an extension of human senses, have been increasingly widely used in modern society. With the development of communication technology, embedded technology, and sensor technology, sensors are gradually developing towards intelligence, miniaturization, and wireless networking. This paper takes a temperature sensor as an example and uses a modular design approach to realize a wireless sensor network [1]. This sensor network integrates embedded technology, sensor technology, and short-range wireless communication technology, and has a wide range of applications in practice. Wireless sensor networks can be applied to environmental science, providing convenience for scientists to obtain random data in the field; they can be applied to medical health, where special sensors can be installed on patients so that doctors can monitor the patients' physical condition at any time; in the commercial field, the combination of wireless sensor networks and central control computers can provide people with a more comfortable, convenient, and humanized home environment. The CPU modules of ordinary nodes and aggregation nodes all use TI's MSP series microcontrollers. The MSP430 series microcontrollers have ultra-low power consumption performance, which is very important for wireless sensor networks. In addition, it has 8 channels and 12-bit high-precision A/D sampling, which can meet the needs of various data acquisition and monitoring applications and has a certain degree of versatility. In addition, the radio frequency section uses the CC2420 from Chipcon, which conforms to the IEEE 802.15.4/ZigBee[2] protocol, as the core radio frequency module. ZigBee is undoubtedly the most suitable wireless local area network communication protocol for wireless sensor networks. 2 Hardware design of ordinary nodes and sink nodes in wireless sensor networks 2.1 Hardware architecture of ordinary nodes in WSN Ordinary nodes are responsible for collecting real-time data and sending it to neighboring nodes. Its hardware structure diagram is shown in Figure 1. [align=center] Figure 1: Ordinary Sensor Node structure in WSN[/align] 2.2 Hardware architecture of sink nodes in WSN The role of the sink node is to collect the data sent by the sensor nodes, perform certain data optimization processing, and send it to the final monitoring computer in the required format. [align=center] Figure 2: Sink Node structure in WSN[/align] Specific composition of each part Central Processing Unit (CPU): Since the entire design is based on the principle of low power consumption, the industry-recognized ultra-low power processor MSP430[6] series microcontroller was selected. The TI MSP430 series microcontroller is an ultra-low-power mixed-signal controller capable of operating at ultra-low power under low voltage. Its controller boasts powerful processing capabilities and rich on-chip peripherals. With 60k Flash ROM memory, it can store large amounts of node data acquisition information and facilitates convenient and efficient online simulation and programming. The most significant feature of the MSP430 series microcontroller is its ultra-low power consumption. Operating at 1.8V–3.6V and a 1MHz clock speed, its current consumption ranges from 0.1mA to 400mA. RAM power consumption is 0.1mA in power-saving mode and only 0.7mA in standby mode. Power consumption is a bottleneck in wireless sensor networks, and nodes must rely on battery power. Therefore, the MSP430F149 is the optimal choice. Wireless communication module design: The CC2420 from the Norwegian semiconductor company Chipcon is used. It is the world's first 2.4GHz RF chip compliant with the 802.15.4/ZigBee Alliance standard. The CC2420 is based on Chipcon's SmartRF03 technology and uses a 0.118μm process. In order to maintain consistency with the ZigBee[4] standard, the CC2420 supports a data transmission rate of 250kbps. The chip has 50 registers: 33 control and status registers; 15 command strobe registers; and 2 first-in-first-out buffer control registers. One of the main innovations of this design is that it selects the LLC sublayer in the physical layer and data link layer that support the IEEE 802.15.4/ZigBee protocol in hardware. Therefore, we only need to implement the upper security layer, MAC layer and user application layer protocol on the protocol layer. The following introduces the characteristics of the ZigBee protocol in the new generation of wireless communication and its advantages for wireless sensor network applications. Low power consumption: Since ZigBee has a low transmission rate and a transmission power of only 1mW, and adopts a sleep mode, the power consumption is low. Therefore, ZigBee devices are very energy-efficient. ZigBee devices can operate for 6 months to 2 years on just two AA batteries, a feat unmatched by other wireless devices. Low cost: The initial cost of a ZigBee module is around $6, and the ZigBee protocol is royalty-free. Low cost is a key factor for ZigBee. Low latency: Communication latency and activation latency from sleep mode are very low. Typical device search latency is 30ms, sleep activation latency is 15ms, and active device channel access latency is 15ms. Therefore, ZigBee technology is suitable for wireless control applications with stringent latency requirements (such as industrial control). Large network capacity: A star-shaped ZigBee network can accommodate up to 254 slave devices and one master device, and the network configuration is flexible. Reliability: It employs a collision avoidance strategy (CSMA-CA) and reserves dedicated time slots for communication services requiring fixed bandwidth, avoiding data transmission contention and collisions. The MAC layer employs a fully acknowledged data transmission mode, where each transmitted data packet must await acknowledgment from the receiver. Retransmission is possible if problems occur during transmission. Security: ZigBee provides packet integrity checks based on Cyclic Redundancy Check (CRC), supports authentication and authorization, and uses the AES-128 encryption algorithm. Each application can flexibly determine its security attributes. The CPU and RF interface design is shown in Figure 3: [align=center] Figure 3: Interface between MCU and RF[/align] The microcontroller communicates with the CC2420 RF chip via a 4-wire SPI bus interface. The microcontroller can be programmed to operate the CC2420 in different states, read and write buffered data, and read information fed back from the CC2420. When using the FIFO and FIFIOP pins to control the status and read information at the FIFO interface with the RF chip, the schematic diagram of the RF antenna part is shown in Figure 5. In the 2.4G HZ wireless communication system, the loop antenna design with good signal shielding and protection effect is adopted. The four-layer PCB design with shielding layer is adopted, which has achieved good results in practice. The schematic diagram of the impedance matching circuit of the antenna part is shown below. [align=center] Figure 4: Schematic diagram of signal protection of RF antenna part[/align] USB-UART[5] conversion module: The USB 2.0 standard has become the standard communication interface for computers and peripherals. This allows users to carry mobile devices conveniently, and the devices can achieve fast data transmission speed and good anti-interference, while the devices work stably and reliably. This module uses the FTDI-232BM bus chip to implement the standard serial RS232 to USB conversion circuit. The interface of this bus chip is briefly described below: there are only three interfaces, one standard USB port, one standard RS232 serial port, and one multi-function port. The schematic diagram of the circuit around the bus conversion chip is shown in the figure. [align=center] Figure 5: Schematic diagram of USB to 232 bus chip[/align] Data acquisition circuit [4]: The data acquisition part of the node can select a suitable sensor according to actual needs, such as vibration, sound, temperature, light, etc. Since the whole module is powered by battery, it requires the sensor to be small in size, low in power consumption, and simple in peripheral circuit. It is best to use a digital sensor that does not require signal conditioning circuit. The two-dimensional digital accelerometer ADXL202 from AD company and the one-wire digital thermometer DS18B20 from Maxim company are good choices for this design. 3 Design of underlying software and protocol stack layer software 3.1 Design of underlying software The underlying software [6] design: Data acquisition part program: ADC12Init: Initialize the basic information of the CPU's AD acquisition channel number, acquisition time, bit number, etc., and enable timer interrupt; ADC12_ISR: Interrupt subroutine, after the timer interrupt expires, stores the digital quantity in the AD buffer into the stack array and waits to send. The timing of the MCU operation of the registers in CC2420 is shown in [4]. The CC2420 SPI operation setup program is divided into basic asynchronous serial port transmit and receive programs, functions for setting the control status register, and reading and updating the RF chip status register. Specific API functions can be found in Table 1 of the document. Table 1: RF Control API Functions. 3.2 Communication Protocol Programming: IEEE 802.15.4/ZigBee Transmission Frame Format and its Function: The IEEE 802.15.4 standard defines a new set of security and data transmission protocols. In this scheme, the wireless module uses a frame format defined according to the IEEE 802.15.4 standard to transmit various data. The figure shows the general format of various frames conforming to the standard in the physical layer and data link layer in this design. The command frame's main function is to control and monitor the behavior and status of full-function devices and reduced-function devices in the network; the data frame structure's function is to transmit specified data to external devices on specified nodes in the network, and the specific receiving target is also given by the "target address" in these two frame structures. The return frame is a return-type data frame structure whose function is for the wireless module to report back to itself the status of transmitted and received data. [align=center] Figure 6: Frame conforming to the IEEE 802.15.4/ZigBee communication protocol[/align] The program defines the following information in the transmit and receive data structures: transmit frame sequence number, transmit device source address, PAN network address, frame length, receive data pointer, etc. The frame transmit and receive program design in this paper conforms to the requirements of the ZigBee protocol, and the transmission and reception of data are implemented in the most reliable form in software. The following figure shows the flowchart of the transmit program. Receive program flowchart 4 Conclusion Considering the low power consumption of WSN applications, this design uses a low-power MSP430 series microcontroller to complete the hardware circuit design of a ZigBee-based wireless sensor network. This includes a core control module based on an ultra-low power MCU minimum system, a wireless radio frequency transceiver module, and a functional module that can provide power, program, and control to sensor nodes via a USB-COM port, further simplifying the external interface. For the special background of sensor networks, the ZigBee communication protocol with multiple advantages was selected, and the technical details of the ZigBee protocol stack were studied. The communication program of the ZigBee wireless communication protocol stack was designed, which can well meet the various needs of wireless sensor networks. The wireless communication protocol was designed through software. References [1] Sun Limin, Li Jianzhong, Wireless Sensor Networks. [2] IEEE 802.15.4 2003: Wireless Media Access Control (MAC) and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Networks (LR-WPANs). [3] ZigBee Alliance, ZigBee Specification.v1.0, Dec 14, 2004. [4] Chipcon AS SmartRF CC2420 Preliminary Datasheet (rev 1.2), 2004-06-09. [5] Zhang Zhuoliang, Wang Zhenqing. Vibration Frequency Data Acquisition System Based on USB Bus [J]. Microcomputer Information, 2004, 12-1: 44-45. [6] MSP430 series MCU Datasheet, TI Corp. [7] Wu Minghui, Embedded Development and Application. People's Posts and Telecommunications Press. 2004.