Design and Implementation of Wireless Sensor Development System
2026-04-06 07:20:39··#1
The rapid development of microelectronics and wireless communication technologies has made it possible to develop low-power, low-cost, and miniaturized sensor networks. Nodes in such networks are placed in the target area, self-organize, collect data, and transmit the data via wireless communication devices through multiple hops to the base station, and then to the user terminal via the Internet or other wired networks. Sensor networks have a wide range of applications, including environmental monitoring, military detection, and healthcare. Their application will have a profound impact on people's lifestyles, and this technology has been named one of the four major high-tech industries of the future by BusinessWeek. This paper introduces a design method for a wireless sensor development system, including nodes and a development board. The nodes are characterized by low power consumption and good versatility, equipped with various sensors capable of sensing temperature, humidity, and light, and have expansion ports. The development board is used to configure the nodes and download programs. The development board has a user-friendly host computer interface and supports different target file formats generated by various compilation systems. 1. Hardware Design of the Node The hardware structure of the sensor node mainly consists of a sensing module, a processing module, a communication module, and a power supply module. Sensor nodes are generally battery powered. Since these nodes are placed in dangerous or inaccessible areas, battery replacement is nearly impossible, making energy saving a key design technology. Furthermore, cost and size must be controlled. The hardware block diagram of the designed node is shown in Figure 1. 1.1 Microprocessor Module The microprocessor selected is the ATMEL ATMEL GAL28L. This chip has low power consumption and multiple sleep modes; multiple interrupt sources, 53 I/O ports, allowing connection to multiple sensor expansion ports; an integrated 8-channel 10-bit A/D converter to convert analog signals from sensors into data signals; a bidirectional I2C serial bus interface; a master/slave SPI serial interface; a programmable serial communication interface; and JTAG and SPI in-circuit programming modes. The chip's abundant resources can meet the requirements of node data processing and transmission, especially the six different sleep modes, which are particularly suitable for energy-constrained applications. Memory stores the data to be processed or received. The Microchip 25AA1024 is selected. This chip has 1024KB of storage, low power consumption, SPI read/write mode, and occupies few I/O ports. The node index generator uses MAXIM's DS2411 to generate a 48-bit random number as the unique identifier for each node. 1.2 RF Module The selection of the RF chip directly affects the node's power consumption, as nearly two-thirds of the node's energy consumption is used for wireless transmission and reception. The selected RF chip is NORDIC's nRF24L01. This chip has low power consumption. In the same operating mode, it saves nearly one-third of the energy compared to Chipcon's CC2420 chip; it operates in the 2.4GHz–2.5GHz ISM band; it supports high-speed frequency hopping; it has a small size; fewer peripheral components, simple configuration, and uses a two-layer PCB, saving costs. The nRF24L01 configuration block diagram is shown in Figure 2. The nRF24L01 only requires six signal lines to connect to the microprocessor, four of which are SPI signal lines connected to the SPI port of the ATMELGA128L; one is for chip select, and the other is for interrupt requests. For good RF performance, the PCB design must be reasonable. The power supply for the nRF24L01 must be well filtered and separated from the digital circuitry; long traces should be avoided; in the RF signal output section, a filtering network should be set according to the transmit power to achieve impedance matching and maximize the signal reaching the antenna. High-frequency signal leakage must be prevented, otherwise it will cause significant interference to the transmitted signal. Since the antenna dissipates electromagnetic energy, components with low Q should be selected. When fabricating the PCB, copper plating should be applied around the components to improve anti-interference performance. 1.3 The sensor module and expansion port board have a photoresistor that senses light signals. Since it is an analog signal, it needs to be connected to the AD pin of the ATMELGAl28L for AD conversion before processing. The board also has a digital temperature and humidity sensor chip SHT15, which can sense temperature and humidity with high accuracy and low power consumption. It uses I2C for reading and writing, occupying very few I/O ports. To allow for wider application of the node, the node board has expansion ports, including I2C ports, AD ports, and interrupt ports, for connecting other sensors. 1.4 Power Supply and Energy Consumption The node has two power supply methods: powered by the development board during laboratory debugging and testing, and powered by two AA batteries when working in the external environment. To prevent interference between the two power supplies, a manual switch is added to the board. Because energy consumption determines the lifespan of the sensor node, energy efficiency must be fully considered in the node's hardware and software design. Unnecessary modules must be shut down to save energy in various operating modes. When communication uses a node timed shutdown and startup protocol with a shutdown-to-start time ratio of 1:99, two 1000 mA-hr AA batteries are used for power supply. The node energy consumption is shown in Table 1. In the above operating mode, if powered by two 1000 mA-hr AA batteries, the node lifespan is 12.55 months. This value is calculated under maximum transmit power. When the transmit power and transmit/receive rate decrease, energy consumption is lower, and the sensor lifespan is longer. 2 Hardware Design of the Development Board The hardware system block diagram of the development board is shown in Figure 3. The node CPU's JTAG port is connected to the development board. If JTAG is used for downloading and debugging programs, a JTAG downloader is required. Therefore, an alternative download method, serial download, was designed. The CPU receives code from the host computer via USB and then downloads it to the node CPU's FLASH via SPI. The CPU acts as the central control module, receiving and processing various commands from the host computer. The CPU chip used is the ATMEL ATMEL16L, which has a programmable UART port and an SPI port operating in master/slave mode. A USB conversion chip, FT232BM, converts USB data from the host computer to UART data from the slave computer. Since both the programming board CPU and ATMEL128 communicate with the host computer via USB, two buffers with enable controls are used to control the on/off state of serial communication between different CPUs to prevent interference between different input/output signals. To facilitate sensor node configuration, an E2PROM is integrated on the board. The target code can be stored in the E2PROM. When downloading to the node is needed, an external interrupt is triggered by a button, writing the code from the E2PROM to the node CPU via SPI. The operation is convenient and simple, eliminating the limitations of the host computer. The node connector is a 17-pin interface between the node and the development board and extended sensors. In addition to the programming port and serial port, there are also expansion ports for connecting sensors, including I2C port, interrupt port and AD port. The node CPU SPI programming requires a total of 4 signal lines, of which 3 SPI communication lines are connected to the SPI port of the development board CPU. The RESET signal of the node CPU can be controlled by the I/O port of the development board CPU. 3 Development Board Software Design 3.1 Host Computer Program Design The host computer program was written using C++ Builder 6.0, and a user operation interface was created. Various object file formats generated by different compilation systems were converted into a file format agreed upon by the host and slave computers and transmitted to the slave computer. In order to improve the efficiency of writing code to the FLASH and E2PROM of ATMELGA128L and facilitate writing code from E2PROM to FLASH, the code transmitted by the host computer to the slave computer adopts the format shown in Figure 4. In Figure 4, the address refers to the initial address where the code segment is to be written to FLASH, including a 2-byte page address and a 1-byte in-page address; the serial number indicates which segment of the code is in the entire code set; the length refers to the number of bytes in the code segment, excluding the address and serial number. Each address segment code uses the format shown in Table 2. The host computer program supports the following target file formats: Intel hex files generated by TinyOS, AVRGCC, and IAR. Intel hex is a file standard proposed by Intel Corporation and is one of the most commonly used target file formats. The host computer program also supports the msp430-txt format proposed by TI (Texas Instruments), and its format and description are shown in Table 2. The host computer program converts target files of different formats generated by different compilation systems into the format shown in Figure 4 before sending them to the slave computer. The host computer operation interface provides various command buttons. After the user clicks a command button, the host computer sends commands and data according to the specified command mode processing protocol. To ensure error-free data transmission during file transfer, a stop-and-wait transmission protocol is used. The host computer sends a predetermined length of data and then stops sending, waiting for an acknowledgment flag from the slave computer before resuming transmission. The overall flowchart of the host computer program is shown in Figure 5. 3.2 Slave Computer Program Design The slave computer receives commands from the host computer and performs functions such as reading and writing FLASH, E2PROM, locking, fuse bit, and switching USB port usage rights. Due to the large number of functions to be implemented, a modular, bottom-up structured design method was adopted. First, following the SPI programming algorithm provided in the ATMELC128L datasheet, modules for reading and writing FLASH, locking bits, and fuse bits were implemented in C language. One challenge in the program design is writing the received file sent by the host computer into the FLASH or E2PROM, as this involves interaction between receiving data and writing to the FLASH or E2PROM. The solution is to use a stop-and-wait transmission protocol for data transmission. The slave computer allocates a predetermined number of buffers, uses interrupts to receive data from the host computer until the buffers are full, processes the buffer data, sends an acknowledgment flag, and the host computer starts the next transmission only after receiving the acknowledgment. Figure 6 shows the flowchart for writing the ATMELGA128L FIASH according to the established protocol. Writing to E2PROM is similar to writing to FLASH, except that the received address, serial number, and length are also written to the E2PROM. The code stored in the E2PROM maintains the format shown in Table 2, i.e., the segment initial address, serial number, segment length, and data format, so that the code stored in the E2PROM can be written to the FLASH. When writing the lower-level program, based on the principles of implementing each module using sub-functions, clear interfaces between modules, and a simple main program, several major modules were implemented, including reading and writing FLASH and E2PROM, reading and writing lock bits, and writing FLASH from E2PROM. The main function simply calls the corresponding module upon receiving a command. When the interrupt button is pressed, the interrupt program first checks the FLASH connection. If the check is successful, it calls the module to write FLASH from E2PROM; otherwise, a red light flashes to indicate operation failure. Using the development board designed in this paper to download the program to the nodes, the program runs normally, the communication between nodes is good, and the power consumption is low, achieving the expected functions and meeting the performance requirements. From the design process and usage, it can be seen that this development system has the following advantages: (1) Low node power consumption, small size, and high RF chip sensitivity; (2) Good node versatility, capable of connecting to various sensor boards; (3) User-friendly development tool interface, supporting multiple target file formats; (4) Code can be stored in E2PROM, and can be written to FLASH by pressing a button when needed, making node configuration convenient. The sensor development system designed in this paper facilitates researchers to conduct more in-depth practical research and promotes the wider application of sensors.