DOI: 10.21307/ijanmc-2019-060 International Journal of Advanced Network, Monitoring and Controls Volume 04, No.03, 2019 65 Design of a Vibration Detection Terminal Guoshao Chen School of Computer Science and Engineering Xi’an Technological University Xi’an, China e-mail: 1825247141@qq.com Fei Xu School of Computer Science and Engineering Xi’an Technological University Xi’an, China e-mail: xinfei2000@qq.com Abstract—By detecting the vibration of bridge deck, the information of passing vehicles can be obtained indirectly, which is of great significance to grasp the dynamics of the enemy. In this paper, a micro-power wireless vibration detection terminal is designed. In order to reduce the overall power consumption of the terminal, which use two sensors, one is spring switch and another is acceleration sensor. When no vehicle passes by, the terminal is in a dormant state. When a vehicle passes by, the spring switch wakes up the CPU and the acceleration sensor to collect data. ZigBee network is used for data transmission, which has the advantages of low power consumption and ad hoc network. Experiments show that the average power consumption of the terminal is less than 7 mW. If the terminal is powered by 3.6v, 36AH lithium battery, In theory, it can work for at least two years. Keywords-Vibration Detection; Zigbee; Micro-power Consumption I. INTRODUCTION In the national defense and military affairs, the detection of passing vehicles in a specific area is of great significance for understanding each other's dynamics. The monitoring of bridge vibration can be more convenient to monitor vehicle dynamics. Considering the concealment, destructiveness and inconvenience of construction, this terminal uses wireless communication, battery power supply and micro-power design. Common wireless communication methods include Bluetooth technology, Wi-Fi technology, GPRS, ZigBee and so on. Because of the low power consumption of ZigBee network and autonomous network, this paper chooses ZigBee network. In order to achieve low power consumption, this paper considers two aspects, one is sensor power consumption, the other is processor power consumption. There are two sensors, spring switch and acceleration sensor. If there is no vehicle passing, the system will sleep deeply to save power. When there is a vehicle passing, the spring switch will wake up the CPU and the acceleration sensor will start collecting data. With regard to processor power consumption, the terminal uses CC2530 chip for ZigBee communication. Because the chip integrates mcs51 core processors, the power consumption is reduced without additional processors. The processor Computational ability is relatively low, so the calculation of signal filtering and recognition is completed by the server. The detection terminal is responsible for signal acquisition and communication tasks. In this paper, a micro-power vehicle vibration detection terminal is designed, which uses dual sensors to reduce power consumption, ZigBee wireless communication and battery power supply. At the same time, the communication reliability is guaranteed and the low power consumption is taken into account by waking up the communication at a fixed time. The detection terminal can meet the requirements of long-term maintenance-free work. International Journal of Advanced Network, Monitoring and Controls Volume 04, No.03, 2019 66 II. PRINCIPLE When vehicles pass the bridge, the vibration caused by the vehicles pass the bridge deck is violently than that pass the ground. Therefore, this paper obtains vehicle information by detecting the vibration of the bridge deck. When there is no vehicle passing, the detection terminal is in deep sleep state, CPU sleep, acceleration sensor and data memory power off, thus saving electricity. Once a vehicle passes by, the bridge vibration triggers the spring switch, wakes up the CPU, the switch opens, so the acceleration sensor starts to detect the bridge deck vibration amplitude, and the data is stored in the memory. When ZigBee network transmits data, it needs enough routing nodes to be awakened. Therefore, in order to ensure that ZigBee network works simultaneously, the terminal uses the method of periodic wake-up. During the wake-up period, data is transmitted to the server for processing and identification. III. LOW POWER IMPLEMENTATION In order to meet the battery power supply, maintenance-free long-term use, the terminal must reduce power consumption. This paper solves the problem of low power consumption from three aspects: hardware, communication and software. The hardware is designed with dual sensors, low power CPU, power switch and unnecessary equipment shut down during sleep. ZigBee is used in communication, because of its advantages of ad hoc network, it can achieve low power relay transmission of data. In order to achieve low power consumption, to not lose information, on software, data acquisition using external interrupt mode, communication using timing wake-up mode. IV. HARDWARE ARCHITECTURE Figure 1. Hardware structure is shown Figure 2. Switch structure The overall hardware structure is shown in Figure 1. The spring switch is connected to the external interruption pin of the CPU. When no vehicle passes by, the spring switch breaks the power, no current passes through, and the power consumption of the spring switch is zero. When a vehicle passes by, the spring switch triggers the interruption and wakes up the CPU. The structure of the spring switch is shown in Figure 2. The center position is the wire and the surrounding is the spring. The vibration causes the short circuit between the spring and the wire, thus triggering the external interruption of the CPU. Vibration sensor adopts three-axis acceleration sensor. When the CPU is dormant, the vibration sensor is International Journal of Advanced Network, Monitoring and Controls Volume 04, No.03, 2019 67 disconnected to save power. When the CPU is awakened, the acceleration sensor is energized and starts to work. The clock is powered by a single battery using a DS1307 chip. The memory uses AT25DF641 to store the data of acceleration sensor temporarily, waiting for the arrival of the next communication cycle. The battery uses a disposable lithium battery with a capacity of 36 ah and a voltage of 3.6 v. The communication adopts ZigBee wireless mode. In order to save power, instead of increasing the CPU, the data acquisition and communication are carried out by using the 51 single chip microprocessor core integrated with cc2530. The power supply control is realized by electronic programmable switch ADG821, which can realize the maximum 150 mA current output capacity, short switching time and low power consumption. V. OVERVIEW OF ZIGBEE NETWORK ESTABLISHMENT Establishing a complete ZigBee mesh network consists of two steps: network initialization and node joining the network. There are two steps for a node to join the network: to connect to the network through a coordinator and to access the network through an existing parent node. A. Initialize network coordinator Firstly, it judges whether the node is a FFD node, and then it judges whether the FFD node has a coordinator in other networks or in other networks. Through active scanning, send a Beacon request command, and then set a scan duration . If no beacon is detected during the scan period, then FFD has no coordinator in its pos, then it can establish its own ZigBee network, and as the coordinator of this network, it generates beacons continuously and extensively. Broadcast. In a network, there is only one coordinator. Initialize network coordinators shown in Figure 3. Figure 3. Initialize network coordinator B. Channel scanning process It includes two processes: energy scanning and active scanning. Firstly, it detects the energy of the designated channel or the default channel to avoid possible interference. Channels are sequenced incrementally to discard those channels whose energy values exceed the allowable energy level. Channels with allowable energy level are selected and labeled as available channels. Then active scanning is carried out to search the network information within the communication radius of the node. These messages are broadcast in the form of beacon frames in the network. Nodes obtain these beacon frames through active channel scanning. Then, according to these information, they find the best and relatively quiet channel. Through recording results, they select a channel, which should have the least ZigBee network, preferably without ZigBee devices. During active scanning, the MAC layer discards all frames received by the PHY layer data service except beacons. International Journal of Advanced Network, Monitoring and Controls Volume 04, No.03, 2019 68 C. Set up the network ID When the appropriate channel is found, the coordinator will select a network identifier (PAN ID, value (= 0x3FFF) for the network. This ID must be unique in the channel used, cannot conflict with other ZigBee networks, and cannot be used as the broadcast address 0xFFFF (this address is reserved address, can not be used). PAN IDs can be obtained by listening to the IDs of other networks and selecting a non-conflicting ID, or by artificially specifying the scanning channels to determine the PAN IDs that do not conflict with other networks. There are two address modes in ZigBee network: extended address (64 bits) and short address (16 bits), where extended address is allocated by IEEE organization for unique device identification; short address is used for device identification in local network. In a network, the short address of each device must be unique. When a node joins the network, it is allocated by its parent node and communicated by using short address. For coordinators, the short address is usually set to 0x0000. After the above steps are completed, the ZigBee mesh network is successfully initialized, and then waiting for other nodes to join. When the node enters the network, the parent node (including the coordinator) with the strongest signal in the range of choice will join the network. After success, it will get a short address of the network and send and receive data through this address. The network topology and address will be stored in their flash. D. Nodes join the network through Coordinator When the node coordinator is determined, the node first needs to establish a connection with the coordinator to join the network. In order to establish a connection, FFD nodes need to make a request to the coordinator. After receiving the connection request, the coordinator decides whether to allow the connection, and then responds to the node requesting the connection. Only when the node and the coordinator establish a connection, can the data be sent and received. The specific process of node joining the network can be divided into the following steps: Nodes join the network is shown in Figure 4. Figure 4. Nodes join the network E. Find the network coordinator Firstly, the coordinator of the surrounding network will be scanned actively. If the beacon is detected within the scanning period, the relevant information of the coordinator will be obtained, and then a connection request will be sent to the coordinator. After selecting the appropriate network, the upper layer will request the MAC layer to set the PIB attributes of PHY and MAC layer, such as phyCurrent Channel and macPANID. If not detected, after a period of time, the node re-initiates the scan. International Journal of Advanced Network, Monitoring and Controls Volume 04, No.03, 2019 69 F. Send the Associate Request command The node sends the association request command to the coordinator. The coordinator replies to an acknowledgment frame (ACK) immediately after receiving it, and sends the connection instruction primitive to its upper layer to indicate that the connection request of the node has been received. This does not mean that a connection has been established, but only that the coordinator has received a connection request from the node. When the upper MAC layer of the coordinator receives the connection instruction primitive, it will decide whether to grant the join request of the node according to its own resource (storage space and energy), and then send a response to the MAC layer of the node. G. Wait for the coordinator to process When the node receives ACK from the coordinator to join the association request command, the node Mac will wait for a period of time to receive the coordinator's connection response. If a connection response is received within a predetermined time, it notifies its upper layer of the response. When the coordinator sends a response to the MAC layer of the node, it sets a waiting response time (T_Response WaitTIme) to wait for the coordinator to process the request command. If the coordinator has enough resources, the coordinator assigns a 16-bit short address to the node and generates a connection response command containing the new address and the successful status of the connection, then the node will succeed in building the coordinator. Vertical connection and start communication. If the coordinator resources are insufficient, the nodes to be joined will resend the request information and enter the network successfully. H. Send data request commands If the coordinator agrees to join the node in response time, the Associate Response command is generated and stored. When the response time is over, the node sends the data request command to the coordinator. The coordinator replies to the ACK immediately after receiving the command, and then sends the stored related response command to the node. If the coordinator hasn't decided whether to agree to join the node after the response time arrives, then the node will try to extract the related response command from the beacon frame of the coordinator. If successful, the network can be accessed successfully. Otherwise, the request information will be re-sent until the network is successfully accessed. I. Reply When the node receives the correlation response command, it immediately replies an ACK to the coordinator to confirm that it receives the connection response command. At this time, the node will save the short address and extended address of the coordinator, and the MLME of the node sends the connection confirmation primitive to the upper layer to notify the success of the association. J. Nodes join the network through existing nodes When the FFD nodes close to the coordinator are successfully associated with the coordinator, the other nodes within the scope of the network join the network with these FFD nodes as their parent nodes. There are two ways to join the network, one is through association, that is, the joining nodes initiate joining the network; the other is direct, that is, the joining nodes. The volume is added to that node as a child of that node. The association mode is the main way for new nodes to join the ZigBee network. For a node, only if it has not joined the network can it join the network. Some of these nodes have joined the network but lost contact with their parents (such as orphan nodes), while others are new nodes. When an orphan node is an orphan node, the information of the original parent node is stored in its adjacent table, so it can send the request information of the original parent node to join the network directly. If the parent node has the ability to consent to its joining, it will enter the network successfully by directly telling its previously International Journal of Advanced Network, Monitoring and Controls Volume 04, No.03, 2019 70 assigned network address; if the number of child nodes in its original parent node's network has reached the maximum, that is to say, the parent node can not approve its joining, it can only find and join the network as a new node. For a new node, it first scans the network it can find on one or more pre-set channels actively or passively, searches for the parent node that has the ability to authorize itself to join the network, and stores the data of the parent node that can be found in its adjacent table. Data stored in parent nodes of adjacent tables includes ZigBee protocol version, protocol stack specification, PAN ID and information that can be added. Choose one of the smallest parent nodes in the adjacent table and send a request message to it. If there are more than two parent nodes with the same minimum depth, then randomly select one to send the request. If there is no suitable parent information in the adjacent tables, it means that the access process fails and terminates. If the request is approved, then the parent node will also allocate a 16-bit network address, at which time the network entry is successful, and the child node can start communication. If the request fails, look up the adjacent table again and continue sending the request information until joining the network. VI. SOFTWARE DESIGN A. Introduction to Working Schedule The software work schedule is shown in Figure 5. data is transmitted by relay mode to achieve low power consumption. Therefore, in order to transmit data, it is necessary to wake up all nodes at the same time. The communication wake-up period is T. The selection of T value is based on the size of RAM capacity, the frequency of vehicle passing and the real-time requirement of data transmission. In each cycle, once a vehicle passes by, the sensor collects data, and the CPU stores the data in RAM. After data acquisition, it enters a deep dormant state, waiting for the next vehicle to pass or the next communication wake-up cycle. Figure 5. Software work schedule B. Flow Chart Brief Introduction The system software mainly consists of three parts: main function, data acquisition function and communication function. The main function mainly completes the setting of startup parameters and entering the dormant state. Data acquisition function uses external interrupt wake-up. Communication function uses timer interrupt wake-up. The main function is relatively simple, and it is no longer necessary to elaborate. The following is a brief introduction of the two interrupt functions. The flow chart of the data acquisition function is shown in Figure 6. When the vehicle passes by, the vibration switch is triggered and the CPU enters the external interrupt function. After external interruption wakes up the CPU, the power supply of each device is turned on through ADG821, and the data of acceleration sensor is collected, which is temporarily International Journal of Advanced Network, Monitoring and Controls Volume 04, No.03, 2019 71 stored in the data memory. The terminal collects data and keeps it until no vehicle passes by. After all the vehicles passed, the CPU turned off the power through ADG821, and the terminal went to sleep. The communication function is shown in Figure 7. When the communication time arrives, the timer wakes up the cpu, detects the wireless signal, and waits for the central node to be ready. After Zigbee is successfully networked, each terminal uploads data in turn. If the network is idle after the transmission is completed, it will enter a dormant state. If there is no vehicle passing in the communication process, the sensor power supply need not be turned on. Figure 6. Data acquisition function Figure 7. Communication function VII. CONCLUSION After the prototype is completed, it is placed outdoors for power consumption test. The outdoor ambient temperature ranges from - 5 C to 20 C, and the relative humidity ranges from 20% to 80%. In order to better simulate the vehicle and environment on site, data acquisition is carried out under the viaduct deck during the construction period. The weight and speed of construction vehicles are closer to the field vehicles than those of ordinary household cars. the average power consumption under different working conditions is: no more than 0.1 mW in dormant state, 120 mW in vehicle passing and 200 mW in communication. The average power consumption of the whole day is 162 mWH based on 30 minutes of vehicle passing time and 30 minutes of communication. The selected batteries are 36AH, 3.6V and the total power is 129.6WH. Considering the factors such as battery self-discharge, conservative estimates can work for 1000 days to meet the initial design requirements, that is, the equipment can work for at least two consecutive years. The data packet loss rate of wireless communication is less than 1%, and the failure rate of long-time equipment has not been tested yet. International Journal of Advanced Network, Monitoring and Controls Volume 04, No.03, 2019 72 This paper designs a micro-power bridge deck vibration detection terminal, which uses wireless ZigBee communication, can flexibly network, long-distance low-power transmission, and control the power consumption of hardware, so as to achieve micro-power work. Experiments show that disposable lithium batteries can work for more than two years. The detection terminal has strong concealment and simple construction, so it has good prospects in frontier monitoring and battlefield perception. ACKNOWLEDGMENT Fund Name: National and local joint engineering laboratory of new network and test control Fund Number: GSYSJ2017003 REFERENCE [1] Design of a Vibration Data Acquisition Device Yin Ming Wang Pingping Equipment Manufacturing Technology Issue 2018 [2] Design of an ultra-low power wireless vibration sensorXiuwei State Tang Shengwu Sensors and MicrosystemsVolume 35, Volume 2, 2016 [3] Vibration Detection of Ship Driving System Based on Sensor Network Feng Gang and Cai DonglingShip Science and TechnologyVolume 40, No. 12a, December 2018 [4] Design of Network Monitoring System for Oilfield Water Injection Wellblock. You Bo,Zhang Haitao,Jia Deli.Journal of Xi'an Shiyou University(Natural Science Edition), 2016, 9: vol31 no5. [5] Research on implementation technology of ZigBee wireless communication protocol[J] . Ren Xiuli , Yu Haibin. Computer Engineering and Applications, 2007 [6] Design of oilfield wireless monitoring system based on WiFi and Zig-Bee[J]. Cao Qinghua, Liu Chang,Meng Kaiyuan. Journal of Xi’an Petroleum University (NaturalScience Edition), 2015, 30(3): 101-102. [7] Based on ZigBee oil well remote monitoring system designand implementation[J]. Zhang Xiaohua, Zhang Wenfang, ShiRudong,et al. Control Engineering, 2013, 20