You are on page 1of 5

VENDING MACHINE CONTROL SYSTEM PROTOTYPE

USING ALTERA FPGA EPF 10K10

Wini Rizkiningayu1, Agfianto Eko Putra2
1
Electronics and Instrument, Department of Physics, Faculty of Mathematics And Natural Sciences,
Gadjah Mada University, Bulaksumur, Yogyakarta Indonesia
2
Electronics and Instrument, Department of Physics, Faculty of Mathematics And Natural Sciences,
Gadjah Mada University, Bulaksumur, Yogyakarta Indonesia

Abstract
The objective of this project is to design and build an FPGA based vending machine control system prototype using
VHDL desig and modular approach. Vending Machine has its own comparative advantages compared with conventional
purchasing mechanism; it provides better accessibility and practicality, not to mention anonymity and limitless purchasing
time. These advantages become apparent in big metropolis city where the demand over practicality to purchase daily needs
such as beverages and snacks is high. Vending machine is designed with the fixed control over its nominal money input and
its product price and variety, due to the user’s demand. This control system has tendency to be static and hard to modify
neither its nominal money input nor its product price and variety. Thus, it is proposed to design the decent, easily configured
and modified control system by the user so that it can be applied respectably to the needs.
The FPGA based Vending Machine’s control system is designed using VHDL design and modular approach. This
approach is held with the main principal of dividing the whole system into modules implemented through VHDL. Eventually
these modules will be integrated and compiled using the Max+plusII software. The design runs smoothly on the ALTERA
EPF10K10 development board.

Keywords: Vending Machine, Control System, FPGA, VHDL
* Corresponding author.
E-mail address: sleepyGreen_cute@yahoo.com

1. Introduction transaction. These advantages considered significantly
important in big metro cities and also in student cities,
Vending Machine is one of the most practical where practically in purchasing beverages and drinks
selling device applicable in many countries. The history of becomes priority.
vending machine began at 215 BC when a mathematician Typically Vending machine is designed with
named Hero designed the tool for a temple in Alexandria, fixed control over its nominal money input and its product
Egypt, to pour holly water if people put on a bronze coin. price and variety, due to the user’s demand. This control
Basically almost every product can be sold through system has tendency to be static and hard to modify
vending machine, include foods and drinks. Even in 1980 neither its nominal money input nor its product price and
in Paris, the vending machine which sells wine, beer and variety. Thus, this project is to design the decent, easily
liquor existed. In countries like Japan, with rapid configured and modified control system by the user so that
development of vending machine, it can be found variety it can be applied respectably to the needs. The Vending
and amount of this device which sells clothes, flowers, Machine’s control system is designed based on FPGA and
milk, cigarette, stamp, condom, cologne, baseball card, using VHDL design approach.
book, bait, comic book, cassette, and CD, lottery ticket,
camera and film. In many developed country like 2. FPGA
Germany, France, and Singapore, almost all of the train
ticket selling is through vending machine. FPGA, or Field Programmable Gate Array, is an
In Indonesia, along with the trend of growing integrated circuit consists of configurable and
number of population and the growing activities and programmable logic blocks, and configurable
business in which creates the escalating demand over interconnection blocks amongst the logic blocks [3]. The
practicality, the presence of vending machine would be system design use the Wizard FLEX-A01 FPGA
very helpful. Vending machine has its own comparative development board, which has the RAM based
advantages such as practicality accessibility, not to EPF10K10LC84 from ALTERA with 10.000 logic gates
mention how it provides anonymity and limitless time of

1
and 576 logic elements and 6.144 bit RAM with JTAG three choices per product. For the system input, three coin
connector for byteblaster connection [1] nominal generally used in Indonesia, IDR 200, IDR 500
The Vending Machine’s control system design is and IDR 1000. The IDR 100 coin is not used as it
conducted in VHDL (VHSIC Hardware Description considered inefficient.
Language). VHSIC itself stands for Very High Speed As explained before, the vending machine control
Integrated Circuits. HDL is the hardware description system is designed with modular approach, with the
language which defines circuit character and behaviour, objectives of flexibility in modification and faster error
and is the first hardware description language which gets source detection. These modules consist of several sub
the standardizations from the Institute of Electrical and modules.
Electronic Engineers (IEEE) through IEEE 1076, and In purchasing transaction process, buyers has to
IEEE 64 as the standard addition [4]. input a number of coins with certain nominal. To control
input and process to obtain the total input money, the Input
3. Vending Machine Control System Coin Module is designed. The Input Coin Module, or
MODUL_KOIN_MASUK in the VHDL design code, is a
module with the function of controlling the input coin,
Vending machine control system is designed
nominal per nominal. The module of
using modular approach to obtain the flexibility in design
MODUL_KOIN_MASUK as shown in figure 2 will count
configuration and error source detection. These modules,
the total of inserted coin, and states it as its output
which later would be integrated, consist of sub modules.
(TOTALUANG[6..0]).
The basic reason for modular approach is to
achieve design simplicity, and to avoid system complexity
that will lead to longer design time spent. In other words,
the modular approach design decreases the level of system
design complexity.
Besides that, the modular approach design will
easily allow the designer to spot the error and bugs during
the designing process within the nick of time. Figure 2 Vending machine Input Coin Module
From the user point of view, the modular In purchasing transaction process, besides
approach design allows the user to easily change or inserting the coin in respect to product’s prices, buyers
configure the data, since if the user wants to do some also has to select the product they wish to purchase and the
configuration, they only need to refer to the related amount of product selected. To facilitate this, The
modules and does not need to change the whole system MODUL_PEMILIH_PRODUK or The Product selector
design. The modules or diagram block for this vending Module is designed, as shown in figure 3
machine control system is shown in figure 1.

Figure 3. Vending machine Product selector Module

After total price of selected product and total
inserted coin value have been counted, these data will be
compared and processed to detect whether the total coin
inserted is similar or more than the total product price
selected or not. To facilitate this function, The Vending
Machine Main Module or COMPARE_MECH module in
VHDL code is designed as shown in figure 4
Figure 1. Diagram Block for the Vending Machine Control Systems

System is developed on the basis of vending
machine mechanism using three coin input, three product
sold and allows buyer to choose more than one amount
and more than one variety of products with the limit of

2
Figure 4. Vending machine Main Module

Product Release mechanism Module or named as
MODUL_PRODUK_RELEASE_MECH in its VHDL
code as shown in figure 5 is designed to command the
mechanic system of product release to activate the door to
release the selected product one by one according to
selected number of products (RELEASEPRODUKA,
RELEASEPRODUKB, and RELEASERODUKC).
Figure 6 FSM of Product Release Mechanism Module

In purchasing transaction using vending machine,
the total coin inserted is more than the product price
selected is often happen. Thus, the facility of change
money is needed. Thus, the MODUL_COIN_RETURN_
MECH or The Coin Return mechanism module is
designed as shown in figure 7
Figure 5 Vending machine Product Release mechanism
Module

This Product Release mechanism module worked
with FSM (Finite State Machine) concept. When the
module receive the enable or EN signal with ‘1’ which
generated by main module, the FSM will transit from state
0 (S0) to state 1 (S1). In S0, when the enable value is no
longer ‘1’, x signal will guarantee the transition to S1 will Figure 7 The Coin Return mechanism module
always be held until RESET signal value turned to 1. In
S1, the total number product selected will be checked and The Coin Return mechanism module or
inserted as the SRET variable value, and if the value is ‘0’ MODUL_COIN_RETURN_MECH worked with the FSM
then the transition to state 3 (S3) will happen, and FSM (Finite State Machine) concept where the transition from
will stay in state 3 until the RESET signal value turned to one condition to another will be facilitating the decreasing
‘1’. If the SRET variable value is not ‘0’ then the FSM’s mechanism to obtain the correct value of change money,
state will change to state 2 (S2) where the product will be nominal per nominal as shown in figure 8
released (retA = ‘1’). After that, the whole process will
return to S0 or the decrement process happen in state 1.
After ret signal value turn to ‘0’, the decrement will stop
and the RESET signal value of ’1’ will be generated. The
whole process in FSM is shown on figure 6

3
Figure 10 Temporal Tray Module

This vending machine control system has two
money input tray, the temporal storage and the non
temporal storage as shown in figure 11. The money will be
put in the temporal storage at first until the OK verification
button is pushed then the money will enter the non
temporal storage tray.
This mechanism exists to facilitate the
Figure 8 FSM of The Coin Return mechanism module cancellation of transaction by the buyer with pushing the
CANCEL button. This is also to avoid misuse of vending
In the designing process of vending machine machine as the coin changer. For the product input, the
control system, a limit of maximum input coin inserted is buyer may choose more than one product and more than
made. If the amount of total coin inserted exceeding the one amount per product per transaction. The limit is three
limit then the place to insert money is closed automatically amounts per product. Other limitation is that the amount of
so that the buyer cannot insert anymore coin. To control transaction cannot be more than IDR 10.000., with
the door closing mechanism when this limit is crossed, mechanism of closing the coin input door if this limit is
The Door Control Module or named as CLOSE_ENTRY passed.
in the VHDL coding is designed, as shown in figure 9 .

Pintu non
temporal tray

Uang masuk

Pintu
temporal tray

Figure 9 .Door Control Module
To facilitate the cancelation of transaction by the
buyer and returning the inserted coin, then the control of
Uang keluar
temporal tray which store the inserted coin before the OK
button as transaction verification is pushed and change the Pintu non
temporal tray
storage into non temporal tray, is designed. When the OK
button has not been pushed yet and the buyer is willing to
cancel the transaction by pushing the CANCEL button,
then the temporal tray will be opened and the inserted coin
Figure 11. The Trays in the Vending Machine Control
will be released so that the buyer will get the exactly
Systems
inserted coins. To facilitate the whole process, the
Temporal Tray module, or in its VHDL code named as
MODUL_TEMPORAL_TRAY_CONTROL, is designed 4. Experiment result
as it shown on figure 10
The usage of logic and flip flop resources by the
whole module in FPGA ALTERA EPF10K10 circuit with
using VHDL code for vending machine control system is
shown by table 1.

4
Total logic element used in the system design is 6. References
552 logic element or 86% of the FPGA’s total logic
element capacity. 1. Altera, 2001, FLEX 10K Embedded Programmable
The experiment result shows that the vending Logic Device Family, ALTERA Coorporation, USA.
machine control system runs well. The strength of this
2. Dong, B. & Roff, G., 2004, Adaptive Self-
control system is the simplicity in reconfiguration by user
Configuring Traffic Control Systems,
to meet the demand.
This vending machine control system is capable 3. Maxfield, C., 2004, The Design Warrior’s Guide to
of facilitating products with different prices and input FPGAs, Mentor Graphics Corporation and Xilinx
nominal coin with different value. The capability lays on Inc., USA.
its flexibility of modifying the inside data of prices and 4. Pedroni, V. A., 2004, Circuit Design with VHDL,
nominal, and adding or changing the amount of product MIT Press, Massachusetts.
sold and the variety of input coin, done by modifying the
related module instead of the whole system.

Table 1 The Usage of Logic Element and Flip-Flop

5. Conclusion
The experiment result shows that the vending
machine control system runs well; with total logic element
used in the system design is 552 logic element or 86% of
the FPGA’s total logic element capacity.
The vending machine control system has the
capability to facilitate products with different prices and
input nominal coin with different value. The capability
lays on its flexibility of modifying the inside data in
modules

5