Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 3, No. 2, 2022 134 Design of Remote Control and Positioning System Based on NB-IoT Liangyu Li, Jiaowu Cai College of Information Engineering Zhongshan Polytechnic, Zhongshan 528400, China Abstract: In production practice, important articles are often damaged or lost during storage and transportation due to the failure of real-time dynamic supervision. To solve this problem, a remote control and positioning system based on NB- IoT(Narrowband Internet of Things) is designed. The system uses STM32F103 as the main control chip,uses BC20 as the NB- IoT communication unit.BC20 collects the positioning signal and realizes the communication with the IoT platform. The upper computer obtains data from the IoT platform to realize remote monitoring. The research shows that the system can collect the location information of the equipment in real time, and the positioning accuracy is within 3m. At the same time, it has the functions of remote alarm and temporary password unlocking, which greatly improves the security of important goods storage and transportation. Keywords: NB-IoT, Remote control, Remote positioning, Temporary password. 1. Introduction The standard materials, precision instruments, confidential documents, toxic and harmful substances and other important articles at the industrial site or laboratory are easy to be damaged or lost during the transportation. During the transportation of these articles, both the integrity of the articles themselves and the known ability of their whereabouts should be guaranteed. Take the transportation of precision instruments as an example. Most of them use hard safes and internal buffer materials. This method has many shortcomings, such as: it can not realize real-time dynamic monitoring of instruments, insufficient supervision during transportation, and it can not give an alarm in time when instruments are lost or illegally damaged, etc. [1-3]. In order to avoid the loss and theft of important items due to poor management, and ensure the safety of people's lives and property, this paper uses the Internet of Things technology to design a set of remote control and positioning system, which realizes the remote control function of important items, and has the advantages of high positioning accuracy, timely response, and high safety factor. 2. Overall Design The system adopts modular design to realize the following functions: (1) The positioning equipment obtains and analyzes the satellite positioning signal, and transfers the positioning result to the upper computer through the Internet of Things platform; (2) The on-site staff shall input the 6-digit random digital password generated by the upper computer to unlock; (3) If the vibration amount exceeds the standard or the password input error exceeds the specified number of times, the alarm will be triggered, or the upper computer can send instructions to trigger the alarm; (4) The equipment can and can only remove the incorrect alarm state by remote command; (5) The upper computer can display the real-time position and status of the equipment; (6) The upper computer can select the equipment to be controlled and conduct corresponding control. The overall design of the remote control and positioning system is shown in Figure 1. The hardware part includes two STM32F103 control chips. The host mainly realizes the functions of control positioning and wireless communication, and the slave mainly realizes the functions of vibration detection, password input, unlocking and alarm; BC20 integrates wireless communication and positioning functions, and is responsible for the information interaction between the device and the host computer, as well as the collection and analysis of real-time positioning information; The IoT platform is a data exchange transfer station between the host computer and equipment, which is convenient for remote control; The software part can remotely view the alarm status and location information of the equipment, and control the opening and closing of the audible and visual alarm and password lock of the equipment. Figure 1. Overall Design of the System 135 3. Hardware Design of Equipment The two main control chips used in the hardware design of the device are STM32F103VET6, and its core is Cortex-M3, which belongs to the low-end 32-bit ARM micro-controller. The chip can work at a maximum frequency of 72 MHz, with a storage space of 512 KB, and has rich I/O interfaces, which can meet the functional requirements of the device [4-6]. The hardware structure of the equipment mainly includes power module, key module, audible and visual alarm module, relay module, vibration sensor module, electromagnetic lock module and wireless communication module. The overall hardware block diagram of the device is shown in Figure 2. Figure 2. Hardware Design of Equipment 3.1. Circuit design of vibration sensor In order to realize the anti-theft alarm function of the equipment, a highly sensitive SW-420 normally closed vibration sensor is used to detect the vibration signal of the equipment. LM393 is used in the vibration sensor, which has the advantages of clean signal, good waveform, strong driving ability, etc. The circuit principle of SW-420 normally closed vibration sensor is shown in Figure 3. Figure 3. Schematic Diagram of SW-420 Circuit It can be seen from Figure 3 that the STM32F103 I/O port of the slave is connected with SW-420.The digital signal can be transmitted to the control chip by connecting the DO port of the. STM32F103 judges whether the equipment is damaged by violence through digital signals. If the vibration signal is continuous and the vibration intensity is large, the slave drive relay module controls the audible and visual alarm to open the alarm. 3.2. Dual computer communication design There are many communication modes between MCU and components, such as CAN bus communication, SPI communication, serial communication, etc. In order to 136 facilitate the software design, this design adopts the dual STM32F103 scheme. Serial communication is adopted between host and slave to realize information interaction. The dual STM32F103 carries out bidirectional communication through UART1 serial port, RXD and TXD are cross connected, and the information exchange test of the master and slave computers is realized through the serial port debugging assistant. The serial communication connection of the master and slave is shown in Figure 4. Figure 4. Schematic Diagram of Serial Port Connection between Master and Slave 3.3. Circuit design of NB-IoT module BC20 is a high-performance, low-power, multi band NB- IoT (Narrow Band Internet of Things) wireless communication module that supports GNSS positioning function, and supports GPS, BeiDou and other positioning and navigation systems. LNA and low-power algorithm are built-in in BC20 module: the former ensures higher sensitivity, and the latter ensures lower current consumption in low- power mode. The volume of BC20 module is reduced by 40% compared with the traditional NB-IoT+GNSS scheme.BC20 has rich interfaces, including switch interface, serial port, SIM card interface, GNSS RF interface, NB-IoT interface, etc. According to the design requirements of the system and BC20 official design manual, the hardware circuit design of the NB- IoT module was completed, as shown in Figure 5. Figure 5. Schematic diagram of NB-IoT module circuit 137 4. Software Design of Equipment The software design of the system mainly includes host software design, slave software design and upper computer software design. The compiling environment of host software and slave software is Keil5, and the compiling environment of host software is Visual Studio 2017. The upper computer software is written in C++, including image interface, map display, communication and other subprograms. The map display program is developed on the basis of Baidu Maps, which has the advantages of high accuracy and fast update. The function options of the upper computer include generating temporary passwords, starting and stopping alarms, connecting and disconnecting devices, and synchronizing device movement tracks. 4.1. Host software design The functions that the host needs to realize include two- way communication with the slave, obtaining positioning data, and two-way communication with the Internet of Things platform. After the host is turned on or reset, the device starts to initialize and attempts to obtain the location information of the device. After the communication between the host and the IoT platform is completed, the upper function transmits the control command to the host through the IoT platform, and the host sends the control command to the slave through the UART1 (baud rate 115200). The host software design process is shown in Figure 6. Figure 6. Host Software Design Flow Chart 4.2. Slave software design The functions that the slave needs to realize include two- way communication with the host, anti-theft alarm, temporary password unlocking. The slave needs to transmit the status parameters to the host through UART1, and receive the alarm and unlock command from the host. The password keyboard input of the slave computer is only controlled by the host computer. After the host computer generates a random password and sends it to the host computer, the slave computer stores the temporary password transmitted by the host computer and starts the keyboard scanning subprogram. 138 The audible and visual alarm of the slave is opened and closed, which is only controlled by the upper computer. The design flow of the slave master program is shown in Figure 7. Figure 7. Flow Chart of Slave Master Program 5. System test In order to verify the performance of the system, multiple positioning, moving, remote alarm and temporary password unlocking function tests are conducted in the laboratory and outdoors. First, start the device power supply, log in to the upper computer to check the device login status. Then, click the function option of the upper computer to verify the equipment performance. The specific response time of each function is shown in Table 1, and the positioning accuracy test data is shown in Table 2. Table 1. Equipment Response Time Get Positioning Temporary password Vibration alarm Turn on alarm Disarm Alarm 190 5.1 3.1 3.7 3.3 165 4.2 4.2 4.6 4.1 145 3.6 3.3 3.5 3.1 135 3.3 3.4 3.1 3.3 Table 2. Positioning Accuracy Number of tests Indoor error/m Outdoor error/m 1 2.3 1.4 2 2.8 1.6 3 2.7 1.7 4 2.5 1.3 5 2.1 0.8 It can be seen from the test data in Table 1 and Table 2 that the test equipment designed in this paper has high positioning accuracy, indoor and outdoor positioning error is not more than 3m, and the control response of the equipment to the upper computer is timely, and the control signal can be received within 5s and the corresponding functions can be realized. 6. Conclusion This paper introduces the software and hardware design of the remote control and positioning system based on NB-IoT and STM32F103. This paper gives the overall design idea of the equipment, and introduces the hardware and software design scheme of the equipment in detail. The test results show that the system greatly improves the security of the goods during storage and transportation, with high positioning accuracy and remote monitoring function. At the same time, the dual STM32 chip design is used to facilitate the subsequent functional upgrading or expansion. On the basis of this design, the protection device can be modified to meet the transportation needs of standard materials, precision 139 instruments, confidential documents, toxic and harmful substances and other important articles. Acknowledgment The scientific research project "Intelligent Clothes Dryer Based on Wireless Sensor Network" of Zhongshan Polytechnic in 2022 (Project No.: KYB2204). References [1] Li Hailian,Li Jianyong,Luo Chunyang,et al.Design and test of large precision instrument transport packaging box[J]. Packaging Engineering,2018,39 (17):124-128. [2] Wen Haikun, Gong Xuefei,Du Fujia, et al. Design and test of vibration reduction for inland precision instrument transportation in Antarctica [J].Vibration and Impact,2015,34 (24):98-103. [3] Zhao Ling,Tang Lan,Xiang Chunsheng.Analysis of vibration damping performance of vibration isolators for precision instrument transport vehicles[J].Journal of Xihua University (Natural Science Edition),2011,30 (4):1-4. [4] Chen Gang, Liu Jie, He Jingfeng. Design and manufacture of wireless temperature monitoring device for liquid metal based on STM32[J].Digital Communication World,2019 (10):32-37. [5] LIAO H H.design and implement of pyroelectric energy harvester experimental measurement system based on STM32F103VET6[J].Sensors&Transducers,2016,196(1):69- 74. [6] Chen Bo, Liu Kaihua. Hardware Design of RFID Handheld Terminal of STM32[J].Single Chip Microcomputer and Embedded System Application,2012,12(4) :45-48.