ZigBee network-based electronic water meter system and control method thereof
1. The utility model provides an electron water gauge system based on zigBee network which characterized in that includes:
the server side is used for storing the number of the user radio frequency card and the amount information associated with the number;
the coordinator is connected with the server through a network interface and is used for establishing a ZigBee network so as to transmit data;
at least one router connected with the coordinator through a ZigBee network, wherein the at least one router is used for forwarding data information in the ZigBee network; and
at least one device side connected to the at least one router;
wherein the coordinator and the at least one router form a transport network, the at least one router being capable of joining another router.
2. The electronic water meter system based on the ZigBee network of claim 1, wherein the equipment terminal comprises: the system comprises an STM32 single chip microcomputer, a ZigBee terminal connected with at least one router, an LCD display screen for displaying data information, an NFC radio frequency card communication module for reading user radio frequency card information, a water meter for sending instant flow information, a buzzer for sending an alarm signal, a relay for controlling the opening and closing of an electromagnetic valve and the electromagnetic valve for controlling the opening and closing of a water using component;
the ZigBee terminal, the LCD display screen, the NFC radio frequency card communication module, the water meter, the buzzer and the relay are respectively connected with the STM32 single chip microcomputer, and the electromagnetic valve is connected with the relay.
3. The electronic water meter system based on the ZigBee network of claim 2, wherein the STM32 single chip microcomputer is respectively connected with the ZigBee terminal, the LCD display screen, the NFC radio frequency card communication module and the water meter through a serial port communication mode, and the STM32 single chip microcomputer is respectively connected with the buzzer and the relay through an output port.
4. The electronic water meter system based on the ZigBee network of claim 1, wherein the coordinator is connected with a MYSQL database at the server side through a network interface access Ethernet, wherein the MYSQL database is used for storing the number of the user radio frequency card and the amount information associated with the number.
5. A control method of an electronic water meter system based on a ZigBee network is characterized by comprising the following steps:
step one, an NFC radio frequency card communication module identifies certain number information of a user radio frequency card in real time and transmits the certain number information to an STM32 single chip microcomputer;
step two, the STM32 single chip microcomputer sends a money deduction instruction associated with the certain number information to a server side;
step three, the server side searches the current amount associated with the certain number information and judges whether the current amount is less than the amount to be deducted;
step four, if the current amount is not less than the amount to be deducted, the server side sends a starting instruction to the STM32 single chip microcomputer;
and step five, the STM32 single chip microcomputer controls a relay to open an electromagnetic valve based on a starting instruction so as to enable water to be discharged.
6. The method for controlling the electronic water meter system based on the ZigBee network of claim 5, further comprising:
step six, the STM32 single chip microcomputer calculates the consumption amount in real time based on the water yield and sends a money deducting instruction to the server side again, wherein the deducted amount is the consumption amount;
step seven, the server side judges whether the current amount is less than the consumed amount;
and step eight, if the server side judges that the current amount of money is smaller than the consumed amount of money, the server side stops sending a starting instruction to the STM32 single chip microcomputer.
Background
The electronic water meters are generally used in various places such as schools, factories and communities in China, the electronic water meters need to read user information by using radio frequency cards, and the electronic water meters used in the places such as the schools, the factories and the communities have the characteristics of wide distribution, large quantity and the like. If these nodes are connected by wire, a huge cost is generated. If these electronic water meters do not use the mode of networking, have hidden danger to the security situation again.
Although the existing electronic water meter system adopts the technology of the internet of things, the installation cost is high, and the expandability of the network is poor.
Disclosure of Invention
In view of this, the main purpose of the present invention is to solve the problems of high installation cost and poor network expandability of the existing electronic water meter system.
The invention provides an electronic water meter system based on a ZigBee network, which comprises: the server side is used for storing the number of the user radio frequency card and the amount information associated with the number; the coordinator is connected with the server through a network interface and is used for establishing a ZigBee network so as to transmit data; at least one router connected with the coordinator through a ZigBee network, wherein the at least one router is used for forwarding data information in the ZigBee network; and at least one device side connected to the at least one router; wherein the coordinator and the at least one router form a transport network, the at least one router being capable of joining another router.
In some embodiments of the invention, the device side comprises: the system comprises an STM32 single chip microcomputer, a ZigBee terminal connected with at least one router, an LCD display screen for displaying data information, an NFC radio frequency card communication module for reading user radio frequency card information, a water meter for sending instant flow information, a buzzer for sending an alarm signal, a relay for controlling the opening and closing of an electromagnetic valve and the electromagnetic valve for controlling the opening and closing of a water using component; the ZigBee terminal, the LCD display screen, the NFC radio frequency card communication module, the water meter, the buzzer and the relay are respectively connected with the STM32 single chip microcomputer, and the electromagnetic valve is connected with the relay.
In some embodiments of the invention, the STM32 single chip microcomputer is respectively connected with the ZigBee terminal, the LCD display screen, the NFC radio frequency card communication module and the water meter in a serial port communication manner, and the STM32 single chip microcomputer is respectively connected with the buzzer and the relay through output ports.
In some embodiments of the present invention, the coordinator is connected to a MYSQL database at the server side through a network interface access ethernet, where the MYSQL database is configured to store a number of the user radio frequency card and money amount information associated with the number.
The invention also provides a control method of the electronic water meter system based on the ZigBee network, which comprises the following steps: step one, an NFC radio frequency card communication module identifies certain number information of a user radio frequency card in real time and transmits the certain number information to an STM32 single chip microcomputer; step two, the STM32 single chip microcomputer sends a money deduction instruction associated with the certain number information to a server side; step three, the server side searches the current amount associated with the certain number information and judges whether the current amount is less than the amount to be deducted; step four, if the current amount is not less than the amount to be deducted, the server side sends a starting instruction to the STM32 single chip microcomputer; and step five, the STM32 single chip microcomputer controls a relay to open an electromagnetic valve based on a starting instruction so as to enable water to be discharged.
In some embodiments of the invention, the control method further comprises: step six, the STM32 single chip microcomputer calculates the consumption amount in real time based on the water yield and sends a money deducting instruction to the server side again, wherein the deducted amount is the consumption amount; step seven, the server side judges whether the current amount is less than the consumed amount; and step eight, if the server side judges that the current amount of money is smaller than the consumed amount of money, the server side stops sending a starting instruction to the STM32 single chip microcomputer.
According to the electronic water meter system based on the ZigBee network and the control method thereof, the user information is stored in the server end, the information safety is guaranteed, the cost is reduced, the coordinator and at least one router form a transmission network, network connection of all electronic water meters can be effectively achieved, and the at least one router can be connected with another router in parallel, so that the network expansion is achieved, and the network coverage range is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a schematic diagram of a ZigBee network of an electronic water meter system based on a ZigBee network according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an equipment end of an electronic water meter system based on a ZigBee network according to an embodiment of the present invention.
Wherein: 1. a server side; 2. a coordinator; 3. a router; 4. a ZigBee terminal; 5. STM32 single-chip microcomputer; 6. an LCD display screen; 7. an NFC radio frequency card communication module; 8. a water meter; 9. a relay; 10. an electromagnetic valve; 11. a buzzer; 12. an equipment end; 13. a network interface.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Referring to fig. 1 to 2, an electronic water meter system based on a ZigBee network according to the present application is shown, including: the server end 1 is used for storing the number of the user radio frequency card and the amount information associated with the number; the coordinator 2 is connected with the server 1 through a network interface 13, and the coordinator 2 is used for establishing a ZigBee network so as to transmit data; at least one router connected with the coordinator 2 through a ZigBee network, wherein the at least one router is used for forwarding data information in the ZigBee network; and at least one device side 12 connected to at least one router; wherein the coordinator 2 forms a transport network with at least one router, which is capable of joining another router.
The ZigBee network consists of a server end 1, a coordinator 2, a router 3, an equipment end 12 and a network interface 13, wherein the equipment end 12 comprises a ZigBee terminal 4, an STM32 singlechip 5, an LCD display screen 6, an NFC radio frequency card communication module 7, a water meter 8, a relay 9, an electromagnetic valve 10, a buzzer 11, the server end 1 is responsible for storing information such as the serial number and the amount of a radio frequency card and the like and receiving and sending the information, the coordinator 2 is responsible for building the ZigBee network and sending the information of the terminal to the server end 1 and forwarding the information sent from the server end 1, the server end 1 and the coordinator 2 are connected with the network interface 13 through the coordinator 2 to access the Ethernet for information interaction, the router 3 is responsible for forwarding the information in the ZigBee network and enabling the ZigBee network to cover more widely through a router relay mode, the equipment end 12 is responsible for receiving the information sent by the server end 1 and analyzing the information, other modules in the device end 12 are controlled so that the water outlet component can operate, and meanwhile, the device end 12 can also forward information or instructions obtained by the modules to the server end 1 in the ZigBee network, and record the working conditions of the modules so that the latest data of the sum of the radio frequency card can be obtained.
For the specific structure of the device end 12, the device end 12 includes: the system comprises an STM32 single-chip microcomputer 5, a ZigBee terminal 4 connected with at least one router, an LCD display screen 6 used for displaying data information, an NFC radio frequency card communication module 7 used for reading user radio frequency card information, a water meter 8 used for sending instantaneous flow information, a buzzer 11 used for sending an alarm signal, a relay 9 used for controlling the opening and closing of an electromagnetic valve 10 and the electromagnetic valve 10 used for controlling the opening and closing of a water using component; the ZigBee terminal 4, the LCD display screen 6, the NFC radio frequency card communication module 7, the water meter 8, the buzzer 11 and the relay 9 are respectively connected with the STM32 single-chip microcomputer 5, and the electromagnetic valve 10 is connected with the relay 9.
Specifically, STM32 singlechip 5 passes through serial ports communication mode respectively with zigBee terminal 4, LCD display screen 6, NFC radio frequency card communication module 7 and water gauge 8, and STM32 singlechip 5 passes through the output port and is connected with bee calling organ 11, relay 9 respectively.
In a specific embodiment, the electronic water meter system based on the ZigBee network comprises a server end 1, a coordinator 2, a router 3, a ZigBee terminal 4, an STM32 single chip microcomputer 5, an LCD display screen 6, an NFC radio frequency card communication module 7, a water meter 8, a relay 9, an electromagnetic valve 10, a buzzer 11 and a network interface 13. When a user places a water card, namely a radio frequency card, on the NFC radio frequency card communication module 7, the NFC radio frequency card communication module 7 recognizes the number of the radio frequency card, the number information of the radio frequency card is sent to the STM32 single chip microcomputer 5 through serial port communication, the STM32 single chip microcomputer 5 transmits the information to the server end 1 through the ZigBee terminal 4, the router 3 and the coordinator 2, the server end 1 inquires the money information of the radio frequency card in a MYSQL database according to the obtained number of the radio frequency card, meanwhile, the STM32 single chip microcomputer 5 sends a money deduction instruction to the server end 1 through each module in the ZigBee network, after the server end 1 receives the money deduction instruction, part of money of the radio frequency card is deducted, the deducted money is generally few, the remaining money of the radio frequency card is obtained at the same time, the money information is continuously saved in the MYSQL database, and if the remaining money is larger than zero, the server end 1 sends an instruction to the STM32 single chip microcomputer 5 through the ZigBee network, when the STM32 single chip microcomputer 5 receives the starting command, the relay 9 is controlled to open the electromagnetic valve 10, water can be discharged from the water using component, meanwhile, along with the use of water, the water meter 8 records the water consumption of the water using component constantly and sends the water consumption constantly to the STM32 single chip microcomputer 5, the STM32 single chip microcomputer 5 calculates the water consumption in the period of time at intervals of a period of time, calculates the water consumption into the consumption of money through conversion, sends a money deducting command to the server end 1 through a ZigBee network, the deducted money is the consumption of the money, the server end 1 executes the money deducting command after receiving the money deducting command, the money in the radio frequency card is deducted, the server end 1 inquires the remaining money of the radio frequency card at intervals of a period of time, the single chip microcomputer generally takes three seconds, if the money is more than zero, the starting signal is continuously sent to the STM32 through the ZigBee network, the switch of the electromagnetic valve 10 is controlled, so that the water supply component can continuously use water, and simultaneously, the money amount information and the consumed money amount information are sent to the LCD display screen 6 to be displayed for a user to know. If the gold amount is not enough in the radio frequency card, the server end 1 stops sending the start signal to the STM32 singlechip 5, when the STM32 singlechip 5 does not receive the start signal in a period of time, generally five seconds, the relay 9 is controlled to close the electromagnetic valve 10, the water using component can not discharge water, and at the moment, the STM32 singlechip 5 also controls the buzzer 11 to give an alarm to remind a user.
What has been described above are merely some embodiments of the present invention. It will be apparent to those skilled in the art that various changes and modifications can be made without departing from the inventive concept thereof, and these changes and modifications can be made without departing from the spirit and scope of the invention.