A vending machine is a device used to provide items to the consumers when an acceptable exchange payment is made. There are vending machines like Food and snack vending machine, change vending machine, ticket vending machine etc. The main idea of the machine is to give access to the merchandises after paying for a particular item. There has numerous mechanism for operation of the vending machines to operate efficiently. The main idea of he project is to create a Smart vending machine using WIZ750SR as the gateway to the MQTT broker and then connect to the server. This smart vending machine enables gesture based interaction and cashless payment for vending the items to the consumers in an organization.
Components UsedThe Components I used in this project to integrate a working model are:
- Wiznet WIZ750SR (serial to Ethernet Module based on W7500P).
- Wizwiki W7500.
- RFID-RC522 Reader along with RFID Tags.
- Ultrasonic Sensors (HC-SR04).
- LCD Module 2004A.
- P2N2222A (NPN Silicon Amplifier Transistor).
- DC motors.
- Light Emitting diodes.
- Potentiometer.
- Resistors 330 ohm.
- RS232 Cable and Ethernet Cable.
In the below Fig.1, the block diagram represents the working process of the vending machine from client to the server. The data's collected from the Wizwiki-W7500 are transmitted to WIZ750SR using UART Serial communication. Then the information is published to local MQTT broker with the topic using Ethernet Connection. After the data is sent to MQTT broker, with the help of Flask MQTT library in the server the data is subscribed with the topic name used for publishing. These data's are sent to database and retrieved from database using Psycopg 2. The updated database are displayed on the HTML page for User Interface.
- Wizwiki-W7500 Connections:
In Fig.2, Wizwiki W7500 is Connected to RFID-RC522 , 2 Ultrasonic sensors and LCD module, LED and Motors.
- Working of W7500:
The process involved in W7500 is serially displayed in PC and printed using cool term window.First the code involves a loop to identify the user with provided RFID tags. When the RFID tag is recognized, the tag ID is displayed in the window. Then the tag ID is compared in W7500. The user RFID tag data is stored in W7500 to compare, and when successful identification the user name is serially sent to Wiz750SR. Then another loop is called to identify the distance in cm between the ultrasonic sensors and user gesture. The condition is given in such a way that if the distance between the user and the ultrasonic sensor is less than 11 cm, the item name is serially sent to the Wiz750SR with prefix character ' / ' . The corresponding motor is made to run to vend an item. When the item is vended and the LCD module displays the information like the item name and item cost. And then it restarts to RFID recognisation loop.
Wizwiki-W7500 and WiZ750SR Connections:
Wizwiki W7500 and Wiz750SR connected using RS232 (Serial Cable) as following.
Wizwiki W7500 Serial Cable
- D0 (U_RXD0) Pin 2
- D1 (U_TXD0) Pin 3
- WIZ750SR working:
The program into WIZ750SR is loaded with the help of W7500 ISP Tool.
The process of receiving and sending the data to the MQTT broker using WIZ750SR is displayed using Cool term Window in Fig.6 . First the W750SR wits and checks for creating a link. When connection is established it returns IP address. Topic: Vending machine is the topic used to subscribe from the MQTT broker. When it is connected to the broker it returns value 0. The value published in the broker is "luffy/drink". Where "luffy" is the name of the user and "drink" is the item vended.
" / " is used in between two strings to differentiate it in the server.
MQTT lens is used to display the value published by the WIZ750SR to the MQTT Broker.
I used python programming language to create a Server. Installed flask to create a custom server to accept and store data into a SQL database. By utilizing Flask-MQTT library I was able to publish and subscribe data with MQTT broker.Used Psycopg2 library to be able to integrate SQL database with the server.HTML and CSS was used and integrated with server to display the data from the database to the web-page. Used pg admin 4 to check the database state and add required fields to the database to update the balance by the admin.
Server handles the data by subscribing the user name and item name from the MQTT broker. The cost of the item is determined by the Admin.The MQTT data is subscribed by the server, when the data is published into the MQTT broker by WIZ750SR. The Data is sent with ' / ' in between user name and item name.Split function is used to differentiate the username and item name in the server. when ' / ' recognized the data is split. Once when the user name is recognized by the server, It gets the values from the database of that particular user and by item identification it reduces the value from the main balance. And the updated data is displayed in the website. so that the user can access the balance data.
Comments