Vending Machine Insight


Problems in having a traditional vending machine are - Having to pay for the products with cash most of the time.Easy to hack Traditional vending machine.Prices and Expiry dates are not checked by the Traditional vending machine.

the solution to all the problem is a Smart vending machine which has the (Gender ,Age ,generation wise) analysis , 24 hours Distribution and vending services , Transaction Database services. Which can be used to check the performance of a product in a specific market.Prices and expiry dates are real time because it is connected to the cloud.


Software Architecture.

Concrete meets bricks

The software architecture works like the above mentioned picture First user accesses the web application and he chooses the products and the interface was made by the Python Django and the details are updated in to the database which is made by MongoDB And it is al so in the server which is The Amazon EC3 instance All the communications are done through https. There is an API in the machine which connects the sever to get the Validation requests.Finally the Machine dispences the item chose by the user

Back End Tasks Done

User Registration (User /Admin/Companies)

Where users are classified into who they are according to their Credential. These Roles can determine the access given to a selected user.

Payment Handling

Payment Handling is done through PayPal Which is a secured Payment Gateway

Add /Modify/Delete Items

The admin can Edit any information about the items available


QR code is used for more security and also Django Rest API is used for validity


Every Transaction Done can be Seen by an admin .The User can also see the previous Transactions done by him.


Local server is made using Python Django

The database is made in PostGreSQL

Communication to AWS is done through HTTPS

Django PostgralSQl

Cloud Server

Host in amazon EC2 Instance

Nginix Server is used because Nginx is built to offer low memory usage and high concurrency. Rather than creating new processes for each web request, Nginx uses an asynchronous, event-driven approach where requests are handled in a single thread. With Nginx, one master process can control multiple worker processes.

Gunicorn is used and it internally hands the calling of our flask code. This is done by having workers ready to handle the requests instead of the sequential one-at-a-time model that the default flask server provides. The end result is our app can handle more requests per second

Built with Python Django

Used database PostGreSQL


Rest API

To authenticate we are using JSON web token because it securely transfers information between software and Hardware as an JSON file.It has 2 tokens one is access token which expires within 5 minutes . We are using Rate limit to make sure the hardware/Web Application does not get overloaded by API calls to the cloud and it is only 60 API calls per hour.It ensure the safety of the systems.We can do GET,PUT,POST,DELETE in the APIs that are available in the system.

User Interface.

The Website gets you to this Home page which Can be used to directly buy items or you can sign in and buy things If you sign in the company can give you discounts or other options.And also from the Homepage you can go to the cart which has the items you selected and the total amount.Other than that you can also go to the tab pending orders and use the QR codes to get the paid items to dispense.

This Page is the page you get if you want to Login.You can type in your login credentials and get into the account where you can see your previous orders and etcs. Or If you don't have an account you can go to the Signup option and Sign up for a new account.There is an option to help you reset your password as well if you forget.

This is the SignUp page where you can Sign up for a new Account.The creditentials can be created here and there is a email checker and the email should be legitimate to sign in

After Signing in you will have a page similar to the home page but you can see your account and you can make changes to your account when you click on your profile picture.And also you will have an Profile Button on your webpage where you can go and change your account settings.

After you added the items your Cart the cart looks like this and you can edit the items that you are going to add here also.If you click check out it will take to a page where your can pay for the Items.You can use continue shopping to go back and add more items to the cart.

When you go to the checkout page you can see that it will ask for a name and an email. It is just for the invoice so you can use it for refunds and other proceeds.

After giving the Email and the name You can choose the way to pay (Paypal / Debit Card /Credit card).After choosing the payment method you will be redirected to a dialog box which is going popup and you can give your details there and pay for the items and you will receive the items.

pop up will redirect you to Paypal

If you Login with the admin Credentials you can see all the transactions that have happened with the vending machine over the time. And you can check who has bought the items and their characteristics according to their accounts.And also you can check the pending transactions.

If you Login as an Admin You can also change the number of products in the vending machine.If you see any miscalculations. And also you can search for items according to their places and the prices and also the names.

The other page you can check are the QR codes of the customers who are going to buy the items.

Online Demonstration Video

Hardware Components

Raspberry Pi 3

Broadcom BCM2837 64bit ARMv7 Quad Core Processor powered Single Board Computer running at 1.2GHz 1GB RAM

BCM43143 WiFi on board Bluetooth Low Energy (BLE) on board

40pin extended GPIO , 4 x USB 2 ports 4 pole

Stereo output and Composite video port Full size HDMI

CSI camera port for connecting the Raspberry Pi camera

Upgraded switched Micro USB power source (now supports up to 2.4 Amps) Expected to have the same form factor has the Pi 2 Model B, however the LEDs will change position

Stepper Motor

Motor Type: Bipolar Stepper

Step Angle: 1.8 deg.

Holding Torque: (

Rated Current/phase: 1.7A

Phase Resistance: 1.5Ohm±10%

Insulation Resistance: 100MΩ¸ Min, 500VDC

Insulation Strength: 500VAC for one minute

Stepper motor driver

stepper motor provides a constant holding torque without the need for the motor to be powered.Steppers provide precise positioning and repeatability of movement since good stepper motors have an accuracy of 3 – 5% of a step and this error is non-cumulative from one step to the next.

Driver Model: L298N 2A

Driver Chip: Double H Bridge L298N

Motor Supply Voltage (Maximum): 46V

Motor Supply Current (Maximum): 2A

Logic Voltage: 5V

Driver Voltage: 5-35V

Driver Current:2A

Logical Current:0-36mA

Maximum Power (W): 25W

Current Sense for each motor

Heatsink for better performance

Camera Module V2 for Raspberry Pi

5 megapixel native resolution sensor-capable of 2592 x 1944 pixel static images.

Supports 1080p30, 720p60 and 640x480p60/90 video.

Camera is supported in the latest version of Raspbian, Raspberry Pi's preferred operating system.

Relay Module

High-sensitivity (250 mW) and High-capacity (16 A) versions

Rated voltage 12 V DC

Rated current 20.8 mA

Coil resistance 576 Ω

Must operate voltage 75% max. of the rated voltage

Must release voltage 10% min. of the rated voltage

Max. voltage 180% of rated voltage (at 23°C)

Power consumption Approx. 250 mW

Weight Sensor

Differential input voltage: ±40mV (Full-scale differential input voltage is ± 40mV)

Data accuracy: 24 bit (24 bit A / D converter chip.)

Refresh frequency: 10/80 Hz.

Operating Voltage: 2.7V to 5V DC.

Operating current: < 10 mA.

Size: 24x16mm.

PIR sensor

Input voltage: DC 4.5~20V

Static current: 50uA

Output signal: 0,3V (Output high when motion detected)

Sentry angle: 110 degree

Sentry distance: max 7 m

120 degree detection angle

Low power consumption in idle mode only 50uA and 65mA in fully active mode.

This is the physical interpretation of the circuit diagram Which shows how the components are connected

Hardware Design

For the Convenience of the user the design was made to demonstrate which has all the attributes and more of a vending machine In the picture you can see a screen which is used to communicate with the user and there is a proximity sensor to make sure the vending machine only works when someone is present

PCB Design

Hardware Demontration

The Schematic View

For Demonstration purposes we have used proteus simulation platform here firstly the Vending Machine circuit is in OFF state and then if any person comes near the vending machine the PIR sensor detects the person and all the system comes to the on state Then the LED display shows the Welcome message asks to input the QR code.If the user adds the QR code (which has the details of the Transaction). the Vending machine sends a Validation request through an API call.If the QR code is valid then according to the Item list the motors according to the Item will rotate and the Items are delivered.The weight sensor makes sure if the items are delivered and the system goes to the power off State

Data Path.

The flow of data is projected above normally a user signs in or signs up with the user app after that user app sends the server data through HTTPs requests and also the response from the server also is through HTTPs responses similarly the API in the vending machine also sends the request as HTTPs and the response is through HTTPs.

ER Diagram

The Main entities are User,Customer , Product, Order, Order Item And QR Code.Every Entity has unique primary Key. And if we go in to details Customer Makes an order or multiple orders so the relationship between Customer and the Order is one to many.Customer can get multiple QR codes so there will be a one to many relationship.likewise one order can have multiple order items that is also a one to many relationship.For Order to QR Address the relationship is 1 to 1. For products and Order Item its 1 to many.

Software Testing.

URL unit Testing

We are checking to make sure every Url gets the reverse Match.By using the dummy http request

Codes for the Test

POST/GET Request unit Testing

CRUD operations are Checked using artifical AJAX API calls for that we are using Hard coded Json data

We are sending in dummy data to check the reliability of the authendication

Codes for the Test Codes for the Test

Form Validation Testing

Authetication form is checked

We are creating a new user and database and checking the form

Post request is sent and check if it is updated

new products are created in example to check where all of them are being updated

Codes for the Test

Testing Results

results results

22 checks were done for end point reverse matches all were passed.We failed to check the QR code at the first time but after some minor changes QR code got accepted by the test and also 15 tests were done one of them were checking QR codes



Karikaran Vettirivel


Girishikan Selvaratnam


Bragadeeshan Suppusamy



Do you want us to style your home? Fill out the form and fill me in with the details :) We love meeting new people!