Wireless sensor networks are the product of the combination of computer technology, sensor technology and network communication technology. They consist of a large number of randomly distributed sensor nodes with real-time perception, wireless communication and self-organization capabilities [1]. With the rapid development of wireless technology, wireless sensor networks are increasingly entering people's field of vision. Compared with wired technology, wireless technology has the advantages of low cost, small size and no complex wiring. However, since most of the existing wireless sensor nodes are powered by batteries and their placement locations are randomly changed, node interruptions may occur at any time, and the communication capacity is very limited, requiring regular manual maintenance. Therefore, wireless sensor network nodes must have the functions of self-organization and self-repair of interruptions. It is necessary to design appropriate communication protocols and routing algorithms to improve the reliability of system communication. To this end, this paper uses wireless RF chip nRF905 and STC12 series microcontrollers to design a wireless sensor node, and based on the communication protocol of typical self-organizing networks - Dynamic Source Routing (DSR) [2-4], improves the routing maintenance algorithm, designs a communication protocol that is easy to implement and highly practical, and realizes a wireless communication system for self-organization and multi-hop data transmission.
1 Node hardware design
Nodes are divided into coordinator nodes and ordinary nodes. Ordinary nodes are equipped with sensors and are responsible for collecting required data and forming a network. Coordinator nodes are responsible for the control of the entire network and the aggregation, analysis, and processing of data. Figure 1 is a structural diagram of the coordinator and ordinary nodes.
1.1 MCU
The STC12LE5410AD microcontroller is a single clock/machine cycle (1T) 8051-compatible core microcontroller. It is a new generation of high-speed, low-power 8051 microcontroller. The instruction code is fully compatible with the traditional 8051, but the speed is 8 to 12 times faster. It integrates hardware high-speed SPI (Serial Peripheral Interface) interface, 2 KB EEPROM, A/D conversion module and MAX810 dedicated reset circuit. The operating voltage is 2.4 to 3.8 V, so it can work with batteries and can work for a long time. The device can wake up quickly from low-power mode in less than 6 μs. The ultra-small package, high integration, and streamlined external circuit of the STC12LE5410AD can design smaller nodes, and the ultra-low price can lay sensor nodes on a large scale. These features of the STC12LE5410AD microcontroller are very suitable for use in wireless sensor networks.
1.2 RF transceiver device nRF905[5]
nRF905 is produced by Nordic Company of Norway. It is a single-chip wireless transceiver chip designed for 433/868/915 MHz-ISM (industrial, scientific and medical) frequency band. It has a 32-pin QFN package, an operating voltage of 1.9~3.6 V, and a maximum transmit power of 10 dBm. The transceiver chip consists of a frequency synthesizer, a receive demodulator, a power amplifier, a crystal oscillator and a modulator, and automatically completes Manchester encoding/decoding on the chip. nRF905 has two active (TX/RX) modes and two power saving modes. The transition time between active modes is less than 550 μs, and the transition time between active mode and power saving mode is less than 650 μs.
nRF905 communicates with the microcontroller via SPI and automatically processes the header and cyclic redundancy check (CRC). When sending data, you only need to send the configuration register information, the data to be sent and the receiving address to nRF905, and it will automatically complete the data packaging (adding header and CRC check code) and sending. When receiving data, nRF905 automatically detects the carrier and performs address matching. After receiving the correct data, it automatically removes the header, address and CRC check code, and then transmits the data to the microcontroller through SPI.
1.3 Hardware connection settings
The STC microcontroller is connected to the nRF905 through the internal integrated hardware high-speed serial peripheral interface SPI, which can reach up to 3 Mb/s, which is about 30 times faster than the software simulation SPI method, greatly reducing the program execution time and improving the network throughput. At the same time, when designing the communication program between the coordinator node and the PC host computer software, the advantage of the STC microcontroller 1T clock is used to set the timer 12 times the serial port baud rate, so that the serial port baud rate is increased to 115 200 b/s, which improves the response speed of the coordinator node, reduces the waiting time, and improves the system throughput.
2 Node software design
The software design of this system is divided into the design of the coordinator node Connector software and the common node Node software. The coordinator node is the main node of the entire network system and plays the role of controlling the entire network. Through the host software of the PC, commands and data can be received and sent to the coordinator, thereby realizing the control of the entire system network. Each common node also reserves a communication interface, which can be connected to other devices when needed.
Due to the need for this system to realize a self-organizing network, the same physical address is defined for each node (including coordinators and common nodes) in the physical layer to realize the broadcast function of the entire network. A unique network address is assigned to each node at the network layer, and the software is used to determine whether the destination node for receiving data is the local machine.
Figure 2 is a node self-organizing flow chart. When a new node is added to the network, after the new node is powered on and initialized, it will first send a routing request RREQ to the coordinator to request to join the network and start the timer; after the coordinator receives the RREQ, it records the new node information and sends a response signal ACK to the source node through reverse routing; if the new node receives the ACK signal within the set time, it means that it has successfully joined the network and records the routing information from this node to the coordinator; if the ACK signal is not received within the set time, then the routing request RREQ is resent to the coordinator, and the cycle is repeated until the ACK signal is received. If the number of retransmissions reaches the set upper limit and the ACK signal is still not received, the RREQ is broadcast to the entire network, and the timer is turned on to wait for the return of the RREP command; after the set time, the RREQ is rebroadcast until the retransmission limit is reached. The new node receives the RREP, indicating that it has successfully joined the network, and the routing information in the RREP command frame is saved.
2.1 Routing Protocol
The existing routing protocols of wireless mesh networks can be generally divided into: table-driven routing protocols and on-demand routing protocols. The former requires each node in the network to maintain one or more routing tables to record the routes to other nodes, which increases the routing overhead. The on-demand routing protocol, the dynamic source routing protocol (DSR), uses source routing. The frame header of each data packet contains the information of the entire route. The intermediate nodes do not need to maintain the current routing information. The packet itself carries the routing information. The on-demand routing feature avoids periodic routing broadcasts and detection of neighbor nodes.
The DSR protocol includes two processes: route discovery and route maintenance. The route discovery process uses flooding routing. In order to reduce the overhead of the route discovery process, each node includes a cache to store the recently learned and used routing information. The route maintenance process is a mechanism used by the source node to detect whether the network topology has changed. If the topology changes and the source route is interrupted, the source node will receive a routing error message. After receiving the routing error message, other nodes delete the interrupted route and re-initiate a broadcast to find a route. The
routing protocol in this system adopts the DSR protocol and makes some improvements to the DSR protocol.
(1) Each node contains at most two route caches to the destination node.
(2) After finding the interrupt node, first check whether there is information about the lower-level node of the interrupt node in this node. If yes, use this route directly. If not, broadcast and send RRER immediately.
(3) After all nodes receive RRER, check whether there is a terminal route. If yes, delete the interrupt route.
The system communication protocol format is shown in Table 1. Among them, FRAME_TYPE represents the command frame type, SOURCE_ADDR represents the source address, FIRE_ADDR represents the destination address, MID represents the routing node address, REMIAN represents the remaining hops under the maximum hops, MAX represents the maximum hops, DATA represents the data to be transmitted, and ODD represents odd parity.
2.2 Program Design
2.2.1 Broadcasting
When broadcasting RREQ, in order to avoid broadcast conflicts, the carrier sense multiple access mechanism CSMA/CA of nRF905 is used to enter the receiving mode before sending to monitor whether the channel is idle. If the CD signal is detected to be high, it means that the channel is occupied. According to the backoff delay, the CD signal is detected to be high again.
According to the detection, the time for receiving the data packet is approximately 20 μs, the time slot is 60 μs, plus the time of program running, the short frame space SIFS and the time slot are defined as 50 μs and 100 μs respectively, and the distributed frame space DIFS is SIFS plus 2 time slots, that is, 250 μs. The CSMA/CA program flow is shown in Figure 3, and NB, CW and BE are defined.
Backoff times (NB): The initial value of NB is 0. When the device has data to transmit, after a backoff time of (2BE-1)×100 μs, CD is detected. If the channel is detected to be busy, the backoff time will be generated again. At this time, the NB value will be increased by 1, and the maximum NB value is defined as 4. If the channel is still busy after 4 backoff delay times, the transmission is abandoned to avoid excessive overhead.
Number of attempts (CW): Loop to determine whether the current channel is idle. When the channel is still idle after a certain number of judgments, it will jump out of the loop and start transmitting data. The initial value is set to 2.
Backoff index (BE): The initial value is set to 2.
In this design, when the CD signal is high, the CD signal must be reset by switching to standby mode to ensure the next CD signal detection.
According to the timing of the nRF905 module, the time for the module to switch from standby mode to receive or transmit mode is 650 μs, and the switching between transmit and receive modes requires 550 μs. The switching time is much longer than the time slot and DIFS values. Therefore, BE is set to 2, and the maximum is 4.
2.2.2 Data transmission
During data transmission, the source node first checks whether there is routing information to the destination node in its cache. If not, it first performs routing discovery, which is the same as the broadcast mode. If there is routing information to the destination node, it first sends a data request command RTS based on the routing information. When the destination node receives the returned permission to send command CTS signal, it means that the data transmission channel has been established, and the requesting node starts to transmit data. After the transmission is completed, the destination node sends DATA_ACK to the source node, indicating that the data transmission is completed. Its workflow is shown in Figure 4.
2.2.3 Route Repair
During data transmission, after each node receives data, it must first reply with an ACK signal to its previous node, and then forward it to the next relay node. A timeout timer is set in the node to wait for about 1 633 μs ACK signal. If the previous node does not receive ACK, it retransmits the data, and the number of retransmissions is set to 3. If no ACK signal is received after 3 retransmissions, the next node is determined to be an interrupted node. Check whether there is other information in the cached route that reaches the downstream node of the interrupted node. If there is, use this backup route. If not, broadcast and send RERR to all source nodes containing the interrupted node route. After receiving the RERR, each node will delete all routes containing the interrupted node from its route cache.
An example of route repair is shown in Figure 5. Node 0 needs to send data to node 5. Node 0 contains the routing information to node 5, 0→1→2→5; node 0 starts to send RTS, and each node returns ACK to the previous node after receiving RTS, indicating that the route is not interrupted; if node 1 does not receive ACK, and there is still no ACK returned after resending 3 times, it is determined that node 2 is an interrupted node; then query node 1 to see if there is a route to node 5, and find 1→3→4→5, then continue to send RTS according to this route; when node 1 returns DATA_ACK, indicating that the data transmission is completed, after a delay of 10× hop count (ms), broadcast RRER, and each node that receives RRER queries whether the node contains an interrupted route, and if so, deletes the route containing the interrupted node from the route cache.
3 Experimental results
The experimental network system consists of 10 common nodes and 1 coordinator node. All nodes are placed in an open area of about 200 m by artificial random placement. First, the coordinator node is connected to the main control PC through the serial port, the host computer control software is opened, and the coordinator node is powered on; then the power of the nodes is turned on one by one while the common nodes are randomly placed.
It can be clearly seen from the host computer software that whenever a new node joins the network (power is turned on), the host computer will display the address and routing information of the newly joined node in real time, and return a response signal to the new node through reverse routing, indicating that it has successfully joined the network. When all nodes have joined the network, the routing information of each node in the entire network can be seen through the host computer software, and each node or multiple nodes can be remotely controlled.
In order to monitor the operation of each node in real time, each node program adds a timing scanning program, with a timing time of 1 minute, to detect whether the node itself is idle within 1 minute. If it is idle, it sends a node signal to the coordinator node to ensure that there is no interruption in this link; the coordinator detects each received node signal within a certain time period. If the information of a certain node is missing, the coordinator sends a detection signal to this node to find the interrupted node and perform routing maintenance. It is also possible to manually send a detection signal to each node directly through the host computer software of the main control computer to detect the operation of each node.
The peak value of the air transmission rate of nRF905 is 100 kb/s, and the effective transmission rate is 50 kb/s.
The host computer software is used to conduct a continuous data transmission test on the entire network to test the network throughput under this protocol. Test conditions: 200 m open area, test the throughput of point-to-point, 1 hop, 2 hop, and 3 hop in a network from one node to 10 nodes, and the data packet size is 32 B. The transmission requires that a packet returns a response after reaching the destination node, indicating that the transmission is completed. The throughput is calculated as follows [6]:
The measured network throughput is shown in Figure 6. It can be seen that the throughput is about 16 kb/s for point-to-point data transmission in the network, and the impact is small as the number of nodes increases; as the number of hops increases, the network throughput decreases, but the number of nodes in the network increases, and the probability of node transmission increases, so it gradually tends to a stable value. Finally, when the network is set to the maximum number of hops (3 hops) and a 10-node network, the network throughput is about 4 kb/s.
The experimental data show that in a short-distance wireless communication network, the system can operate stably and reliably, with high data transmission rate and network throughput that can fully meet the requirements of general wireless sensor networks. The system has good scalability, portability and practicality, and can be widely used in temperature, humidity, light sensor data collection, energy monitoring and circuit control technologies.
References
[1] Sun Limin, Li Jianzhong, Chen Yu, et al. Wireless Sensor Networks [M]. Beijing: Tsinghua University Press, 2005.
[2] Chen Moke, Chen Qin, Luo Min, et al. Improvement of DSR local repair algorithm [J]. Microelectronics and Computers, 2009(26):142-145.
[3] JAWHAR I, TRABELSI Z, Al-JAROODI J. Towards more reliable source routing in wireless networks [C]. Proc. IEEE Int. Conf. Networking, Archit., Storage-IEEE NAS 2008, 2008.
[4] Tu Zihao, Wu Rongquan, Qian Liqun. Optimal design of DSR routing protocol for wireless Ad Hoc networks [J]. Computer Engineering, 2009, 35(4):97-99.
[5] Nordic VLSIASA. Single Chip 433/868/915MHz Transceiver nRF905. 2004-01.
[6] Ke Xin, Sun Limin. Throughput analysis of multi-hop infinite sensor networks[J]. Journal of Communications, 2007, 28(9):78-84.
Previous article:Design of infrared photoelectric wire-detecting sensor
Next article:Wireless sensor network body temperature and pulse monitoring system based on JN5139
- 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
- Image recognition system based on STM32H745
- Brief analysis of the working principle of DSP
- When writing Linux drivers, where can I find the prototypes or usage instructions of these API functions?
- [Power amplifier case] Application of power amplifier in giant magnetostrictive transducer hole crack defect detection
- TI's GaN technology brings half the size and double the power to machines
- MSP430F149 MCU Control Stepper Motor C Language Example
- Design of high frequency AC signal sampling circuit
- [RVB2601 Creative Application Development] 5 Display letters AB at the same time, and eliminate them by long pressing and short pressing
- How to quickly test the continuity and sequence of wire harnesses using the ATX-100S wire harness tester?
- [FreeRTOS check-in station 5 opens] Interrupts and task switching, closing time is August 26