Disclosure of Invention
The invention aims to solve the technical problem of providing a vending and management system based on an OneNET platform, which can share and conveniently call the state of goods and position data of a vending machine end, and finally presents the state and the position data in a visual form in front of merchants and consumers, so that the types and the surplus of the goods in the vending machine are clearly displayed, the customers can conveniently purchase the goods, and the merchants can supply the goods for replenishment. Meanwhile, the good selling degree of the goods in each time period can be determined according to big data analysis at the cloud, and good selling type recommendation is provided for enterprises and consumers.
In order to solve the technical problems, the invention provides a vending and management system based on an OneET platform, which comprises a data acquisition module, a main control module, the OneET platform and a cloud terminal which are sequentially in signal connection, wherein the data acquisition module is used for acquiring the balance and quality information of goods, processing the information by the main control module and the OneET platform and transmitting the information to the cloud terminal, the cloud terminal is in signal connection with a mobile terminal located in a merchant and/or a consumer, and the mobile terminal can display the information of the cloud terminal and send a control instruction to the main control module through the cloud terminal and the OneET platform.
Preferably, the data acquisition module and the main control module are both located at a vending machine end, the vending machine end is provided with a power supply module, a touch panel, an A/D conversion module and an alarm device, the power supply module is electrically connected with the main control module and used for supplying power to the vending machine end, the touch panel, the A/D conversion module and the alarm device are all in signal connection with the main control module, and the data acquisition module is in signal connection with the A/D conversion module.
Preferably, the main control module comprises an MCU.
Preferably, the data acquisition module at least comprises a margin detection unit and a temperature and humidity acquisition unit.
Preferably, the allowance detection unit comprises a pressure sensor and a single chip microcomputer, and the pressure sensor is in signal connection with the single chip microcomputer.
Preferably, the pressure sensor comprises a bridge type piezoresistor sensor and an A/D conversion chip, the excitation of the bridge type piezoresistor sensor is positioned below the goods and respectively connected to two opposite connection points of the bridge type piezoresistor, and the other two opposite connection points of the bridge type piezoresistor are output ends and are in signal connection with the A/D conversion chip.
Preferably, the method for counting the remaining amount of the master control module comprises the following steps: firstly, the data acquisition module transmits information to the main control module; secondly, the logic analysis of the main control module adopts a fuzzy algorithm, and when the detection data is located in an interval corresponding to one bottle, the system displays that the number of the remaining bottles is 1.
Preferably, the a/D value reading function of the a/D conversion chip is unscented long HX711_ read (void), and the weight conversion is performed by using a linear formula as follows:
Weight_drink=(unsignednt)((float)(Weight_drink*10)/GapValue)-pi。
preferably, the mobile terminal comprises an applet page, and the applet page at least comprises four files, namely page logic js, a page structure wxml, page configuration json and a page style sheet wxss; the small program page comprises three interfaces, namely a consumer login interface, an enterprise user login interface and a login success main interface.
Preferably, the OneNET platform comprises a WiFi module, and a transmission protocol of the OneNET platform, the cloud, the mobile terminal and the vending machine terminal is an MQTT protocol.
The invention has the beneficial effects that:
according to the invention, through an optimized design, the vending machine end, the cloud end and the mobile end are intercommunicated and interconnected, and the functions of good sale recommendation, allowance display, humanized service, quality detection, position display and the like can be realized, so that a consumer and a merchant can know the real-time sales condition of the vending machine without coming. For a consumer, the type of goods and the surplus thereof can be inquired in advance before purchasing to determine the purchasing selection of the consumer, and for a merchant of the opposite side, whether timely replenishment is needed or not and the specific replenishment type and replenishment quantity are needed or not are determined according to the type of goods and the surplus information, so that time and labor are saved, and the development of the Internet of things industry is promoted.
Detailed Description
The present invention is further described below in conjunction with the following figures and specific examples so that those skilled in the art may better understand the present invention and practice it, but the examples are not intended to limit the present invention.
Referring to fig. 1, an embodiment of a vending and management system based on OneNET platform according to the present invention includes a data acquisition module, a main control module, a OneNET platform, and a cloud terminal, which are connected in sequence by signals. The data acquisition module is used for acquiring the balance and quality information of goods and transmitting the information to the cloud after the information is processed by the main control module and the OneNET platform. The cloud signal connection has a mobile end located in the hands of the merchant and/or the consumer, the mobile end can display the information of the cloud, and sends a control instruction to the main control module through the cloud and the OneNET platform. Through the optimized design, the vending machine end, the cloud end and the mobile end are intercommunicated and interconnected, and the functions of good sale recommendation, allowance display, humanized service, quality detection, position display and the like can be realized, so that the consumers and merchants can know the real-time sales condition of the vending machine without coming. For a consumer, the type of goods and the surplus thereof can be inquired in advance before purchasing to determine the purchasing selection of the consumer, and for a merchant of the opposite side, whether timely replenishment is needed or not and the specific replenishment type and replenishment quantity are needed or not are determined according to the type of goods and the surplus information, so that time and labor are saved, and the development of the Internet of things industry is promoted.
Specifically, the data acquisition module and the main control module are both located at the vending machine end. The vending machine end is provided with a power module, a touch panel, an A/D conversion module and an alarm device. The power module is electrically connected with the main control module and used for supplying power to the vending machine end. The touch panel, the A/D conversion module and the alarm device are in signal connection with the main control module. The data acquisition module is in signal connection with the A/D conversion module. After the data acquisition module acquires the goods information, the analog signal part is converted into a digital signal through an A/D conversion module and is transmitted to the main control module. The touch panel is used for displaying and setting information of the vending machine. The alarm device can give an alarm on site when the vending machine end is invaded violently, and can give an alarm signal to a merchant, an police and the like. The alarm means may comprise a buzzer.
The main control module comprises an MCU. The model of the MCU can be STM32F103RET6 or STM32F103xx enhanced series, and a high-performance ARM Cortex-M332 bit RISC core is used, and the working frequency is 72 MHz. A high speed memory is built in with 128 kbytes of flash memory and 20 kbytes of SRAM. The MCU is provided with an enhanced I/O port and peripherals connected to the two APB buses. The MCU may include 2 12-bit ADCs, 3 general 16-bit timers, one PWM timer, and a standard or advanced communication interface. The communication interfaces may include 2I 2C and SPI, 3 USART, one USB, and one CAN. Preferably, the MCU is an STM32F103xx enhanced series, which can work in a temperature range of-40 ℃ to +105 ℃, the power supply voltage is 2.0V to 3.6V, and a series of power saving modes ensure the requirements of low power consumption application; meanwhile, the complete STM32F103xx enhanced series product comprises five different packaging forms from 36 feet to 100 feet; according to different packaging forms, different types of peripheral configurations in the device can be selected.
The data acquisition module at least comprises a margin detection unit and a temperature and humidity acquisition unit.
The allowance detection unit comprises a pressure sensor and a single chip microcomputer. The pressure sensor is in signal connection with the single chip microcomputer. The pressure sensor may be model number HX 711. The type of the single chip microcomputer can be STM 32. Through corresponding programming, the analog signals received by the pressure sensor are converted into digital signals and sent to the STM32 single chip microcomputer for subsequent use and storage. The platform utilizes the certainty of goods self weight scope and functional relation to convert the signal of telecommunication that pressure sensor sent, and then shows remaining cargo volume.
Specifically, referring to fig. 2, the pressure sensor includes a bridge type piezoresistive sensor and an a/D conversion chip. The excitation of the bridge type piezoresistor sensor is positioned below the goods and is respectively connected with two opposite connection points of the bridge type piezoresistor. The other two opposite connection points of the bridge type piezoresistor are output ends and are in signal connection with the A/D conversion chip. The pressure change is caused by the change of the quantity of goods on the sensor, the pressure of the object is transmitted to the bridge type piezoresistor sensor, the sensor is deformed due to uneven stress, the resistance value of the resistor is changed along with the change of the resistance value, the bridge is unbalanced to output an analog voltage signal which is in direct proportion to the weight of the object to be measured, the analog voltage signal is amplified, converted into a high-precision digital signal through an A/D conversion chip and transmitted to the single chip microcomputer for storage and processing. And then converting the weight into the remaining number of the beverage through certain logic analysis, and displaying the corresponding allowance on a touch panel or a mobile terminal. The model of the A/D conversion chip may be HX 711. HX711 has 24 bit A/D conversion chips, and it has integrated including peripheral circuit that other chips of the same type required such as constant voltage power supply, on-chip clock oscillator, has integrated precision height, and response speed is fast, advantages such as interference killing feature is strong.
Because the quality of the beverage has certain fluctuation, the specific bottle number corresponds to a certain interval, for example, the corresponding interval of a bottle is [50,60], therefore, after the data acquisition module transmits the information to the main control module, the logic analysis of the main control module adopts a fuzzy algorithm, and when the detection data is located in the corresponding interval of a bottle, the system displays that the residual bottle number is 1. The reading function of the A/D value of HX711 is signed long HX711_ read (void), and the weight conversion utilizes a linear formula as follows:
Weight_drink=(unsignednt)((float)(Weight_drink*10)/GapValue)-pi
specifically, the weight of a bottle of yogurt is measured if desired. Firstly, the red, black, white and green lines of HX711 are respectively connected to corresponding pressure sensors, then GND is grounded, SCK is connected with a clock, VCC is connected with a power supply and the like. The partial drive measurement procedure is as follows:
HX711 moiety:
1. the sensor collects pressure sensor data via the HX711_ Read1() function.
2. Internal a/D data conversion is performed.
3. The values are read and displayed when the a/D converter hx711 device is present.
SHT20 part:
1. the sensor collects temperature and humidity sensor data through an SHT20_ GetValue () function.
2. When the SHT20 sensor is present, the data is read and displayed.
After data are read, infrared data are sent to a cloud end at intervals through a LIGHT _ GetVoltag () function, and therefore the cloud end, the mobile end and the vending machine end of the data are interconnected.
The model of the temperature acquisition unit is an SHT20 sensor. The SHT20 sensor comprises a capacitance type humidity sensing element and a standard energy gap temperature sensing element, the humidity precision can reach 2% RH, the temperature precision is 0.3 ℃, the digital output adopts a serial port communication protocol, and the SHT20 sensor has good reliability. The working voltage range of the SHT20 is 2.1-3.6V. Preferably, the operating voltage is 3.3V. The communication between the SHT20 sensor and the STM32 adopts a standard I2C protocol, and a serial bus is formed by a data line SDA and a clock SCL and can send and receive data. When the vending machine is used, the I2C interface is initialized, specific contents displayed by the touch panel are set, and then the temperature and humidity values of the SHT20 sensor are read, so that the temperature and humidity can be displayed on the touch panel, the product quality in the vending machine can be detected in real time, and the milk and other easily-deteriorated foods and drinks can be prevented from deteriorating; meanwhile, the temperature of the end of the vending machine can be adjusted based on the temperature, and food or drink can be heated or refrigerated.
Specifically, referring to fig. 3, a peripheral circuit of the SHT20 sensor is shown. SDA is a serial data bidirectional port and is connected with a signal input end PB 11. VDD is a power interface, and is connected with VCC3V3, namely 3.3V DC power supply. SCL is a serial clock interface and is connected to clock input PB 10.
The model of the touch panel is 1.44T-TFTLCD. When utilizing STM32 singlechip to drive, carry out the transmission of serial ports data through SDA. If four words "welcome" are required to be displayed on the touch panel, the specific display codes are as follows:
SPILCD _ DisZW (0,0, RED, huan 1); // show "Huan"
SPILCD _ DisZW (16,0, RED, yin 2); // show "welcome"
SPILCD _ DisZW (32,0, RED, guang 1); v/show "light"
SPILCD _ DisZW (48,0, RED, lin 2); // show "Lin"
The cloud end adopts a OneNet View2.0 developer platform provided by the OneET platform to create and develop. The OneNet View2.0 is a data visualization tool, supports the establishment of 3D projects, can avoid programming and visual dragging configuration, integrates data layers with summarizing and conversion capabilities, supports the access of various data sources, can carry out various logic processing on disordered data by a powerful data filter, is flexibly embedded and built, and makes the combination of 2D and 3D possible. Meanwhile, the development of the visual large screen of the Internet of things can be rapidly and flexibly finished, and the visual requirements of data such as smart homes, smart cities, water conservancy and hydropower and smart medical treatment can be easily met.
The mobile terminal utilizes a real-time communication software developer tool to carry out creation and development. Through JavaScript language, the corresponding function of the mobile terminal can be well realized. The mobile terminal includes an applet page. The applet page comprises at least four files, namely page logic js, page structure wxml, page configuration json and page style sheet wxss. The small program page can adopt sentences such as navigationsebackgroupcolor, enableprildownRefresh and the like to realize the rendering of the interface, the beautifying of the layout and the like. The small program page at least comprises three interfaces, namely a consumer login interface, an enterprise user login interface and a login success main interface. The consumer login interface comprises a user name and password input and registration columns, and privacy and safety are guaranteed. The enterprise user login interface comprises user name and password input and registration columns, so that merchants can conveniently know the purchase information of consumers, and corresponding business adjustment such as goods feeding and replenishment can be carried out according to actual conditions. The login success main interface at least comprises purchase information and residual amount information of each food or beverage, and is simple and clear.
The OneNET platform includes a WiFi module. The OneNet platform, the cloud end, the mobile end and the vending machine end are in an MQTT protocol, and the cloud end communication of information can be realized by combining a WiFi module. The MQTT protocol is an instant messaging protocol oriented to the application of the Internet of things, provides network connection by using TCP/IP, can realize message shielding transmission on load contents, has low cost and can effectively reduce network flow. The MQTT protocol at the time of communication at least comprises the following functions: a. a long connection protocol; b. and reporting a terminal data point, wherein the supported data point types comprise: integer (int), floating point (float), string (string), JSON format, binary data; c. issuing a platform message; d. based on the subscription, the publishing and the message pushing of the Topic, the message unicast and the message multicast among the devices can be realized. Compared with the HTTP protocol, the MQTT protocol can realize the management and control of the equipment, and c has great advantages for the subsequent development of project equipment, so that the MQTT protocol is used as an access protocol with an OneNet platform.
The model of the WiFi module is ESP 8266. The WiFi module includes two modes, STA and AP. Preferably, the STA mode is adopted for control and data transmission of the smart device. A preferred specific data transmission step of this embodiment is:
AT + CWMODE ═ 1: setting operation mode (STA mode)
AT + RST: module restart (effective working mode)
AT + CWJAP ═ 111","11111111 ": WiFi hotspot connecting with the Current Environment (hotspot name, password)
AT + CIPMUX ═ 0: setting one-way connection mode
AT + CIPSTART ═ TCP "," xxx.xxx.xxx.xxx ", xxxx: establishing a TCP connection
AT + CIPMODE ═ 1: open transparent transmission mode
AT + CIPSND: in transparent transmission mode, data is transmitted
8.+++: exit transparent transmission mode
Through the steps, the data measured by the data acquisition module can be conveniently transmitted, and the interconnection and intercommunication of the mobile terminal, the cloud terminal and the vending machine terminal are realized.
The cloud data display method and the mobile terminal data display method are as follows:
firstly, uploading the measured data to a mobile terminal and a cloud terminal by using an MQTT protocol and a WiFi module, namely, data flow uplink. The first in parentheses in the code presented next is the name of the data stream; the second is the address of the variable that needs to be uploaded; the third is the type of variable, such as int, unsigned char; and the fourth mark is used for judging when uploading and packaging, wherein the mark is pressed into the package for uploading if the mark is 1, and the mark is not pressed into the package if the mark is 0, so that the mark cannot be uploaded. The data to be uploaded in the project include the remaining amount of each beverage, the sales volume, the temperature and humidity inside the vending machine, the state of a buzzer, the state of an LED lamp, the time and the like. Wherein the HX711_ Read1 and HX711_ Read2 functions are the analyzed beverage a residual quantity and the historical sales quantity, and the beverage B residual quantity and the historical sales quantity, respectively.
And secondly, after the data transmission is finished, the creation and development of the cloud are carried out by utilizing the OneET View2.0 developer platform provided by the OneET platform. OneNet View2.0 is a data visualization tool, can avoid programming, visual configuration of dragging, the integrated data layer of gathering, conversion ability, supports the access of multiple data sources, and powerful data filter can carry out multiple logic processing to mixed and disorderly data, can carry out nimble embedding simultaneously and build etc..
And finally, the mobile terminal utilizes a real-time communication software developer tool to carry out creation and development. Through JavaScript language, the corresponding function of the mobile terminal can be well realized. The small program page consists of four files, namely js, wxml, json and wxss, and the specific meanings are page logic, page structure, page configuration and page style sheet in sequence. The interface rendering, the layout beautifying and the like can be realized by utilizing sentences such as navigationsebackgroupcolor, enableprolldownRefresh and the like. The following examples illustrate methods of achieving functionality:
1. the page layout is implemented using a < view class ═ indexcontainer' > statement.
2. Using < text style ═ margin-left:5 px; ' > vending machine </text > sentence realizes the literal display.
3. Using "pages": [] (ii) a The statement sets the page.
4. Using a "window": [] (ii) a The sentence sets the top window.
5. Using a "tabBar": [] (ii) a The sentence sets the bottom navigation bar.
6. And setting the pull-down refresh function of the small program by using 'enablePullDownRefresh'.
7. The picture path of the WeChat applet is set using the "iconPath".
The above-mentioned embodiments are merely preferred embodiments for fully illustrating the present invention, and the scope of the present invention is not limited thereto. The equivalent substitution or change made by the technical personnel in the technical field on the basis of the invention is all within the protection scope of the invention. The protection scope of the invention is subject to the claims.