Door opening detection system based on LoRa
Technical Field
The invention belongs to the technical field of Internet of things, and particularly relates to a door opening detection system based on LoRa.
Background
At present, with the development of the internet of things technology, a plurality of technologies are available for door opening detection. However, although the existing door opening detection can detect that the door is opened, the existing door opening detection needs technologies such as face recognition assistance, a camera and the like to see whether the door is opened or not, and the existing door opening detection is high in cost, so that false alarm is easily caused.
Although the prior art also has a remote monitoring function, the data reporting is usually performed by means of the WIFI and the Ethernet in the home, and once the home is powered off, the router or the gateway in the home is powered off, the effective reporting cannot be performed, so that potential safety hazards are caused.
Disclosure of Invention
Aiming at the technical problems, the invention discloses a door opening detection system based on LoRa, which is simple in structure and method, low in cost and high in safety.
In contrast, the technical scheme adopted by the invention is as follows:
a door opening detection system based on LoRa comprises a server, a gateway, a door opening detector, a LoRa personal identification card and a user terminal, wherein the gateway comprises a central processing unit, a LoRa communication module, a power supply module and a wired or wireless network module;
the door opening detector comprises a power supply module, an MCU, an LoRa module, an acceleration detection unit, a storage module and an alarm module; the LoRa module, the acceleration detection unit, the storage module and the alarm module are respectively connected with the MCU; the door opening detector comprises a ranging algorithm program;
the LoRa personal identification card comprises a LoRa terminal node with a unique identity and a battery;
the user terminal is used for remotely receiving the door opening condition of the currently monitored door and setting the ID of the LoRa personal identification card which can be matched with the door opening detector;
after an acceleration detection unit of the door opening detector senses that the door is opened, whether a LoRa personal identification card capable of being matched with the door exists in the current range is detected through a LoRa module, if the door opening detector detects the matched personal identification card and the distance between the door opening detector and the matched personal identification card is smaller than a distance set value, the door opening detector sends door opening information through the LoRa module, the door opening information is forwarded to a server through a gateway, and the door opening information is sent to a user terminal through the server.
By adopting the technical scheme, whether the door is opened for the user is detected by utilizing the acceleration sensor and the LoRa personal identification card in combination with ranging, and compared with detection modes such as face recognition, the method can save a large amount of cost and improve the recognition rate and increase the convenience. And LoRa's low power dissipation, distance are far away, characteristics with low costs, can reduce the cost greatly under the circumstances of guaranteeing telecommunication quality.
Further, for the gateway, the wired or wireless network module is an ethernet module, a GSM/GPRS module, a 3G/4G/5G module, or a WIFI module.
Further, the gateway includes a peripheral interface. The peripheral interface may be an ISP, SPI, UART, I2C, GPIO, USB, HDMI, VGA, Type C interface, etc.
Furthermore, the central processing unit can adopt single-core or multi-core processors with 8-bit, 16-bit and 32-bit MCU, DSP, FPGA or ARM architecture.
Furthermore, the power supply module can be an alternating current-direct current conversion circuit or can be composed of various lithium batteries and storage batteries and a boost circuit.
For the door opening detector, the power module can be various batteries or an alternating current-direct current conversion circuit; the MCU can be an 8-bit, 16-bit or 32-bit singlechip; the acceleration detection unit can use a gyroscope or other sensors capable of detecting acceleration; the storage module can be EEPROM, FLASH FLASH memory and other storage devices; the alarm module can be a loudspeaker, a buzzer or other devices capable of making sound.
Furthermore, the LoRa personal identification card can be in a card shape, and can also be made into other shapes such as a bracelet.
Further, the ID of the LoRa personal identification card includes DEVEUI (Device Extended Unique Identifier) information and a secret key of the LoRa personal identification card.
Furthermore, a management program of the user terminal, namely a user APP, mainly has two functions, namely the functions of remotely receiving the door opening condition of the currently monitored door and giving an alarm to a house owner in a vibration mode, a sound mode and the like if the door opening condition is abnormal; and secondly, the system is used for setting the ID of LoRa personal identification cards which can be matched with the door opening detector, one door opening detector can be bound with a plurality of personal identification cards, and only the personal identification cards in the list can be identified by the door opening detector.
The ID of the LoRa personal identification card is actually the DEVEUI and AES keys of the LoRa node, and the DEVEUI and AES keys of different nodes are different when the node leaves the factory.
As a further improvement of the present invention, if the door-opening detector does not detect the personal identification card paired with the door-opening detector, or detects the personal identification card but detects that the distance between the door-opening detector and the door-opening detector is far away, it is determined that the door-opening is not owned by the homeowner; the door opening detector gives an alarm through the alarm module, sends abnormal information to the LoRa gateway through the LoRa module, forwards the abnormal information to the server through the gateway, and finally sends alarm information to the user terminal through the server.
As a further improvement of the invention, after the user terminal receives the information, the user selects whether to operate by himself, if the user operates by himself, the user terminal sends the information to the server, and the server sends the information to the door opening detector through the gateway to stop alarming; if the operation is not the operation of the user, the user selects whether to stop alarming or not after processing.
The technical scheme adopts a pairing message transmission mode of two-layer AES encryption, and the safety is greatly improved.
As a further improvement of the present invention, the pairing of the LoRa personal identification card and the door opening detector comprises the following steps:
step S101, the personal identification card LoRa encrypts own DEVEUI information through own secret key and then sends the information out through a terminal node LoRa;
step S102, after the door-opening detector receives the information, the door-opening detector decrypts the information by using the secret key stored in the storage module; and if the decrypted message corresponds to the DEVEUI information stored in the storage module, the pairing is successful, otherwise, the pairing is failed.
As a further improvement of the invention, the encryption is carried out by adopting an AES encryption and decryption algorithm.
As a further improvement of the present invention, before door opening detection is performed, the LoRa personal identification card is added to the door opening detector identification list, which includes the following steps:
step S201, adding a secret key of a door opening detector in a user management program of a user terminal, and adding a secret key and an ID of a LoRa personal identification card;
step S202, the user management program encrypts the secret key of the LoRa personal identification card and the DEVEUI information through the secret key of the door opening detector, and then sends the encrypted information to the server, and the server sends the encrypted information to the gateway;
step S203, the gateway sends the encrypted information to a door opening detector through an LoRa communication module;
in step S204, the door-opening detector uses its own key to solve the key of the LoRa personal identification card and the DEVEUI information, and stores them in the storage module.
As a further improvement of the present invention, the ranging algorithm program is an RSSI ranging algorithm program. The RSSI ranging algorithm is an algorithm for measuring and calculating a distance according to the strength of a wireless signal.
Compared with the prior art, the invention has the beneficial effects that:
firstly, the technical scheme of the invention adopts an encrypted pairing message transmission mode, so that the safety can be ensured, and whether the door is opened under the permission of the user can be effectively detected. For the group of renting the house, the landlord and the manager also have keys or access cards, and the system can be added to detect whether the landlord or the manager enters the room under the condition that the landlord or the manager does not know the situation.
Secondly, a unique checking method of using DEVEUI and AES secret keys of LoRa nodes and sending a matching message with a door opening detector through a LoRa module is adopted, and after a door is opened, a mode of detecting whether the door is opened for the person by using an acceleration sensor, a LoRa personal identification card and combining an RSSI ranging algorithm is compared with detection modes such as face recognition and the like, so that a large amount of cost can be saved, and the recognition rate can be improved, and the convenience is increased.
Thirdly, because LoRa has the characteristics of low power consumption, long distance and low cost, the cost can be greatly reduced under the condition of ensuring the quality of remote communication.
Drawings
Fig. 1 is a schematic structural diagram of a door opening detection system based on LoRa according to the present invention.
Fig. 2 is a block diagram of a door opening detector of a door opening detection system based on LoRa according to the present invention.
Fig. 3 is a block diagram of a LoRa personal identification card of a door opening detection system based on LoRa according to the present invention.
Fig. 4 is a system operation flow chart of a door opening detection system based on LoRa according to the present invention.
Fig. 5 is a flow chart of adding a LoRa personal identification card to a door opening detector identification list by the LoRa-based door opening detection system according to the present invention.
Fig. 6 is a schematic message transmission diagram in the process of adding the LoRa personal identification card to the LoRa-based door opening detection system of the present invention.
Fig. 7 is a flow chart of pairing of a door opening detector and a LoRa personal identification card of a door opening detection system based on LoRa according to the present invention.
Detailed Description
Preferred embodiments of the present invention are described in further detail below.
As shown in fig. 1-3, a door opening detection system based on loRa, it includes server, gateway, detector, loRa personal identification card and user terminal open the door, the gateway includes central processing unit, loRa communication module, power module, wired or wireless network module and peripheral equipment interface, wired or wireless network module is ethernet module or GSM/GPRS module or 3G/4G/5G module or WIFI module. The central processing unit can adopt single-core and multi-core processors with 8-bit, 16-bit and 32-bit MCU, DSP, FPGA or ARM architecture, and the power supply module can be an AC/DC conversion circuit or a combined boost-buck circuit composed of various lithium batteries and storage batteries. The peripheral interface may be an ISP, SPI, UART, I2C, GPIO, USB, HDMI, VGA, Type C interface, etc.
The door opening detector comprises a power supply module, an MCU, an LoRa module, an acceleration detection unit, a storage module and an alarm module; the LoRa module, the acceleration detection unit, the storage module and the alarm module are respectively connected with the MCU; the door open detector includes a ranging algorithm program. The power module can be various batteries or an alternating current-direct current conversion circuit, the MCU can be an 8-bit, 16-bit or 32-bit singlechip, the acceleration detection unit can use a gyroscope or other sensors capable of detecting acceleration, the storage module can be storage equipment such as an EEPROM (electrically erasable programmable read-only memory), a FLASH FLASH memory and the like, and the alarm module can be a loudspeaker, a buzzer or other equipment capable of making sound.
The LoRa personal identification card comprises a LoRa terminal node with a unique identity and a battery; wherein the battery is the mini lithium cell, and this identification card both can make card shape also can make other shapes such as bracelet.
The user terminal can adopt a user mobile phone. The management program contained in the user terminal, namely the user APP, mainly has two functions, namely, the management program is used for remotely receiving the door opening condition of the currently monitored door, and if the door opening condition is abnormal, the management program can give an alarm to a homeowner in a vibration mode, a sound mode and the like; and secondly, the system is used for setting the ID of LoRa personal identification cards which can be matched with the door opening detector, one door opening detector can be bound with a plurality of personal identification cards, and only the personal identification cards in the list can be identified by the door opening detector. The ID of the LoRa personal identification card is actually the DEVEUI and AES keys of the LoRa node, and the DEVEUI and AES keys of different nodes are different when leaving the factory.
As shown in fig. 4, the operation process of the door opening detection system based on LoRa is as follows:
after the acceleration detecting element of the door opening detector senses that the door is opened, whether have in the current scope through the loRa module and can be rather than the personal identification card of matched loRa, if the door opening detector detects the personal identification card of being matched with it and when surveying that both sides' distance is less than the distance setting value, the door opening detector sends the information of opening the door through the loRa module, forwards to the server by the gateway to on the APP that sends for user terminal through the server, cell-phone APP shows normally the information of opening the door.
If the door opening detector does not detect the personal identification card matched with the door opening detector, or the door opening detector detects the personal identification card but detects that the distance between the door opening detector and the door opening detector is far away, the door opening detector judges that the door opening is not the owner of the house; the door opening detector gives an alarm through the alarm module, sends alarm information to the LoRa gateway through the LoRa module, forwards the alarm information to the server through the gateway, and finally sends the alarm information to the APP of the user terminal through the server.
After the user terminal receives the information, the user selects whether to operate by himself, if the user operates by himself, the user terminal APP sends a stop instruction to the server, the server sends the stop instruction to the door opening detector through the gateway, and the door opening detector stops alarming.
If the user does not operate the door opening detector, the user continues to give an alarm until the user processes the door opening detector, if the user selects to stop the alarm, the user terminal APP sends a stop instruction to the server, the server sends the stop instruction to the door opening detector through the gateway, and the door opening detector stops giving the alarm; if the user chooses not to stop the alarm or the user does not operate, the door opening detector continues to alarm.
After the user receives the alarm information on the mobile phone, if the user is determined not to be the user, the user can contact police officers, security personnel or other management personnel for verification and timely perform further processing, and if the user is determined to be the user, the alarm can be manually turned off through the mobile phone APP, so that the method has more convenience.
The ranging is performed by adopting an RSSI ranging algorithm program.
As shown in fig. 5 and 6, before door opening detection is performed, the LoRa personal identification card is added to the door opening detector identification list, which includes the following steps:
step S201, adding a secret key of a door opening detector in a user management program (user APP) of a user terminal, and adding a secret key and an ID (identity) of a LoRa personal identification card;
step S202, the user management program encrypts the secret key of the LoRa personal identification card and the DEVEUI information through the secret key of the door opening detector, and then sends the encrypted information to the server, and the server sends the encrypted information to the gateway;
step S203, the gateway sends the encrypted information to a door opening detector through an LoRa communication module;
in step S204, the door-opening detector uses its own key to solve the key of the LoRa personal identification card and the DEVEUI information, and stores them in the storage module.
Wherein the encryption is performed by using an AES encryption and decryption algorithm.
As shown in fig. 7, the pairing of the LoRa personal identification card and the door open detector includes the following steps:
step S101, after encrypting own DEVEUI information through an AES secret key of the LoRa personal identification card, sending the information out through a LoRa terminal node;
step S102, after the door-opening detector receives the information, the AES secret key stored in the storage module is used for decryption; and if the decrypted message corresponds to the DEVEUI information stored in the storage module, the pairing is successful, otherwise, the pairing is failed.
By adopting the technical scheme of the embodiment, whether the door is opened for the user is detected by utilizing the acceleration sensor and the LoRa personal identification card in combination with ranging, compared with detection modes such as face recognition and the like, the method can save a large amount of cost, improve the recognition rate and increase the convenience; and a pairing message transmission mode of two-layer AES encryption is adopted, so that the safety is greatly improved. In addition, LoRa has the characteristics of low power consumption, long distance and low cost, and can greatly reduce the cost under the condition of ensuring the quality of remote communication.
The foregoing is a more detailed description of the invention in connection with specific preferred embodiments and it is not intended that the invention be limited to these specific details. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.