Professional Documents
Culture Documents
Controller
Abdullahi Isa Mikail
MSc. Telecommunication and
Electronic Engineering.
Sheffield Hallam University,
Sheffield, England
b5035600@my.shu.ac.uk
Abstract
As people continue to seek ultimate convenience, more
and more technologies are being invented. One of these
technologies is the vending machine. Majority of the
vending machines available today are based on CMOS,
SED or Micro-controller technology. In this paper a
Vending machine controller based on the Mealy Model of
finite state machine is discussed. The design is
functionally verified using Modelsim simulator.
Keywords-FSM;VendingMachine;VHDL;Modelsim
simulator FPGA : Altera DE2 board.
.
Introduction
A vending machine is a machine that dispenses
various products to customers, after the customer must
have inserted money into it. Vending machines have been
around since the early 20th century. The first vending
machine to be used for commercial purposes was
introduced in London used for selling postcards.
Vending machines are more accessible nowadays as
they can be found everywhere from hospitals, schools and
train stations vending chocolates and drinks to the
banking industry as ATM machines. Most vending
machines available nowadays are based on CMOS circuit,
SED, and Microcontroller technology [1]. The CMOS
circuit and SED based machines are more time
consuming than FPGA based machines. Also the FPGA
based vending machine is more flexible to change as it is
reprogrammable and can be reconfigured. Whereas in the
microcontroller based vending machine when there is
need for an upgrade the whole architecture has to be
changed.
In this paper, the design of a finite state machine based
vending machine controller, the machine can only accept
four coins, after the four coins have been inserted into the
machine, any coin fed into the machine again will be
returned back to the customer automatically. This
There are also two input signals reset and clk. The
machine works on the positive edge of clock and returns
to its initial state when reset button pressed. The proposed
machine is designed using Finite state machine modelling
and is coded in VHDL language. VHDL language was
chosen for the implementation of this machine because of
its flexibility and efficiency. Details of the entire signals
with their description is shown in table 2.
The advantages of VHDL implementation includes
minimum cost and time, better design, faster time to
market and increased flexibility.
Table 1: Products with their prices.
S/N Products
Prices
1
Coca-Cola
2 pounds
1 Bar of chocolate
2 pounds
Operation
Bottle of water
3 pounds
Input
Clock
Reset
Input
System reset
Ci
Input
Bi
Input
Chocolate
Request
Wi
Input
Water request
Cr
Input
Cancel
Qi
Input
Total money
Co
Output
Coca-Cola out
Bo
Output
Wo
Output
Water out
Cro
Output
Output
money
Qo
Output
bar
return
Design methodology
The state diagram used to implement this machine
consists of eight states (A, B, C, D, E, F, G, and H) for
every transition from one state to the other, there is
condition that must be met so the machine can decide on
which state to execute next. After the condition has been
met, the machine goes back to a WAITING state. At the
end of the whole process the customer will get their
desired product if the price of the product is equal to the
amount inputted. The conditions for which the circuit
moves from one state to the next are stated below;
1.
2.
3.
Simulation Results
The state diagram in figure 4 and the State table in table 3
were used to produce the wave form below. The wave
form in figure 4 shows 4 different scenarios. In the first
scenario, 2 pounds is inputted into the machine to buy a
bar of chocolate, a bar of chocolate is dispensed. In the
second scenario 2 pounds is also inputted into the
machine but this time the customer wants to buy a bottle
of Coca-Cola, the Coca-Cola is then dispensed. In the
third scenario the customer inputs 3 pounds and buys a
bottle of water. In the last scenario, the customer inserts a
1 pound coin and later hits the cancel, the coin is then
returned.
Conclusion
References
The simulation waveform in figure 5 below shows 5
different scenarios. The first scenario is an attempt to
insert 5 coins into the machine (RED) but the machine
starts to return coins after the third coin has been inserted
(BROWN). Then a bar of chocolate is selected, a bar of
chocolate is dispensed and 1 pound is returned (BLUE).
Four more 1 pound are inputted and the, the machine
returns the third one (RED) 1 Coca-Cola is bought and 1
pound is returned (YELLOW). Buy water is hit and the