Design and Implementation of Vending Machine using Verilog HDL
Muhammad Ali Qureshi
1
, Abdul Aziz
1
, Hafiz Faiz Rasool
2
, Muhammad Ibrahim,
2
Usman Ghani
2
and Hasnain Abbas
2
1
Assistant Professors, Department of Electronic Engineering,University College of Engineering &
Technology, The Islamia University of Bahawalpur, Pakistan
2
Deptt. of Electronic Engineering, UCET, IUB, Pakistan
Email:
1
ali.qureshi@iub.edu.pk,
1
abdul.aziz@iub.edu.pk,
2
cute_faiz07@yahoo.com,
2
engr.ibrahim@ymail.com,
2
usmangodblessu@yahoo.com,
2
hasnainryk@yahoo.com
Abstract— vending machines are used to dispenses small different products ( snacks, ice creams, cold
drinks etc.) , when a coin is inserted. These machines can be implemented in different ways by using
microcontroller and FPGA board. Here in this paper, we proposed an efficient algorithm for implementation
of vending machine on FPGA board. Because FPGA based vending machine give fast response and uses less
power than the microcontroller based vending machine. In this paper FPGA based vending machine supports
four products and two coins. The vending machine accepts coins as inputs in any sequence and delivers
products when required amount is deposited and gives back the change if entered amount is greater than the
price of product. It also supports cancel feature means a user can withdraw the request any time and entered
money will be returned back without any product . The proposed algorithm is implemented in Verilog HDL
and simulated using Xilinx StateCAD tool. The design is implemented on Xilinx Spartan-3 xc3s400 FPGA
development board.
Keywords- FSM; Verilog HDL; StateCAD; Xilinx; Vending Machine;
1. Introduction
A vending machine is a machine that provides items such as snacks, chocolates, ice creams, cold drinks
even diamonds and platinum jewellery to customers, after the vendee inserts currency or credit into the
machine using extremely simple steps [1]. These steps would not be time consuming at all. The vendee would
get all the details on the screen which he/she should follow. Previous microcontroller or microprocessor based
vending machines were inefficient as compared to FPGA based vending machine. So it is necessary to make it
more reliable with efficient algorithm that will be fully commanded by FPGA based solution [3].
The main purpose of writing this paper was to create a vending machine which could provide four
products, namely Snacks, Chocolate, Ice cream and Coca-Cola to the people using extremely simple steps.
We have made an attempt to vend four products of different prices in the same machine. The machine will
also provide the change to the vendee depending on the amount of money he/she has inserted. It is also
possible to withdraw the deposited money in between, if consumer wishes by pressing a cancel button.
1.1 Finite State Machine
A finite state machine (FSM) is a digital sequential circuit that consists on number of pre-defined states
that are controlled by one or more inputs[2]. The finite state machine remain stable until the inputs changes.
There are two types of finite state machines: 1- Synchronous FSMs 2-Asynchronous FSMs. Synchronous
FSMs have a clock input and are also called Mealy machines, while asynchronous FSMs are without clock
input and are also called Moore machines[2][3].The proposed algorithm for FPGA based vending machine is
a sequential circuit which is based on Mealy Model. In a Moore machine Model the output of the machine
totally depend on the present state, while in a Mealy machine Model the output is depend on the present state
2011 2nd International Conference on Networking and Information Technology
IPCSIT vol.17 (2011) © (2011) IACSIT Press, Singapore