0% found this document useful (0 votes)
20 views

GDP Report 2021

The document presents a graduation design project for a Hygiene Matic system submitted in partial fulfillment of a Bachelor of Science degree. The system was developed by 4 students and supervised by Prof. Dr. Mustafa Uyguroglu. It aims to develop an automated hygiene product vending machine to help people easily access masks, gloves and other supplies in crowded public places during the COVID-19 pandemic. The document includes an abstract, acknowledgements, table of contents, list of figures/tables, introduction, methodology, working principle, cost analysis, improvements, conclusion and time plan sections.

Uploaded by

Doğu Manalı
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

GDP Report 2021

The document presents a graduation design project for a Hygiene Matic system submitted in partial fulfillment of a Bachelor of Science degree. The system was developed by 4 students and supervised by Prof. Dr. Mustafa Uyguroglu. It aims to develop an automated hygiene product vending machine to help people easily access masks, gloves and other supplies in crowded public places during the COVID-19 pandemic. The document includes an abstract, acknowledgements, table of contents, list of figures/tables, introduction, methodology, working principle, cost analysis, improvements, conclusion and time plan sections.

Uploaded by

Doğu Manalı
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

HYGIENE MATIC

SYSTEM
by

DOGU MANALI

DOGUKAN MANALI

CAGRI TIMEL

TANER YILDIRIM

Graduation Design Project Report


submitted to the
Department of Electrical and Electronic Engineering
in partial fulfillment of the requirements for the
degree of

Bachelor of
Science in
Electrical and Electronic
Engineering

Eastern Mediterranean University

June 2021
Approval of the Department of Electrical and
Electronic Engineering
Prof. Dr. Rasime Uyguroglu

Chair, Department of Electrical and

Electronic Engineering

Author(s) : Dogu Manalı, Dogukan Manalı,Taner Yıldırım , Cagrı Tımel

Supervisor: Prof. Dr. Mustafa Uyguroglu

Jury Date: 28 June 2021

Jury Members:
1. Prof. Dr. Davut Solyali

2. Prof. Dr. Hasan Amca

3. Prof. Dr. Osman Kukrer

4. Prof. Dr. Mustafa Uyguroglu

5. Prof. Dr. Runyi Yu

6. Prof. Dr. Huseyin Ozkaramanli


HYGIENE MATIC SYSTEM
by

Dogu Manali

Dogukan Manali

Taner Yildirim

Cagri Timel

Supervisor: Prof. Dr. Mustafa Uyguroglu

ABSTRACT
These days, one of the biggest problems facing people covid-19. If anyone wants to go
outside from home or want to go some kind of events such as concert or matches. The first
thing that comes to mind, when people are with their friends is covid-19. and how do you
protect yourself . During the pandemic situation, the most important thing is social distance
and hygiene. Lots of cases were taken into consideration and many alternative solutions are
discussed as to which solution is the most effective. Advanced technology was used due to
this situation in this study. This pandemic process is hard and long, That's why we decided
to produce a hygiene matic to make it easier to pass this situation. With this project, people
can use our system with coins. Coinmeter nipples are disconnected or it creates a small
voltage when the coin is inserted by the user.
Then Arduino Uno becomes active. This component is programmed with a customized
code that decides the necessary movement for appropriate positioning. After that Arduino
apparatus send a command to turn on the DC motor. It is proposed to develop a hygiene
Matic system that helps people who are looking for an available place to buy medical goods
such as masks and gloves to use these in crowded places. Many people will benefit from
this project according to us.

Keywords: Hygiene Matic, Arduino Uno,DC Motor

1
ACKNOWLEDGMENTS

We wish to express gratitude toward God Almighty for the fruitful fulfillment of our
undergrad configuration venture. Exceptional gratitude to Prof. Dr. Mustafa Kemal
Uyguroglu who was our supervisor all throughout the course of the project. We would
like to thank the department for their contribution to our education that helped us with the
completion of our project. We appreciate our families for their moral and financial
support in the course of our study and undergraduate project accomplishment. Finally, we
want to thank every individual who was directly or indirectly helpful in finishing our
design project.

2
TABLE OF CONTENTS

ABSTRACT............................................................................................................. 1

ACKNOWLEDGMENTS ......................................................................................... 2

TABLE OF CONTENTS ..........................................................................................3

LIST OF FIGURES .................................................................................................. 5

LIST OF TABLES ................................................................................................... 5

1. INTRODUCTION ................................................................................................ 7

1.1 Introduction ...................................................................................................... 7

1.2 Nature and Scope of the Problem ....................................................................... 8

1.3 Goals and Objectives ......................................................................................... 8

1.4 Significance of the Project ............................................................................... 8

1.5 Method of the Project ...................................................................................... 9

2. LITERATURE REVIEW .................................................................................... 10

3. METHODOLOGY .............................................................................................. 11

3.1 Hardware and Components ..............................................................................11

3.1.1 Arduino Uno ............................................................................................. 12

3.1.2 Servo Motor .............................................................................................. 13

3.1.2.1 Working Principle of Servo Motor ...................................................... 13

3.1.3 Coin Acceptor .......................................................................................... 14

3.1.4 Nokia Lcd................................................................................................. 15

3.2 Software ...................................................................................................... 16

3.3 Design Of The Project ................................................................................. 17

3.4 Working Principle Of Hygienme Matic Project ............................................ 18

3.4.1 Circuit Diagram……………………………………………………… .. 18

3
3.4.2 Flow Chart Diagram........................................................................... 19

COST ANALYSIS ............................................................................................ 21

4. POSSIBLE IMPROVEMENTS ..................................................................... 22

5. CONCLUSION ............................................................................................. 23

TIME PLAN ..................................................................................................... 24

REFENCES....................................................................................................... 25

APPENDIX ....................................................................................................... 26

4
LIST OF FIGURES

Figure 1: Ardunio Uno ..............................................................................................12


Figure 2: Servo Motor .............................................................................................. 13
Figure 3: Coin Acceptor ............................................................................................ 14
Figure 4: Nokia LCD ...............................................................................................15
Figure 5: Arduino IDE Logo .................................................................................... 16
Figure 6: Measurements of frames ............................................................................ 17
Figure 7: Circuit Diagram ........................................................................................ 17
Figure 8: Flow Chart of Working Principle of the System ....................................... 18
Figure 9: Final view of the Project………………………………….…………………20

5
LIST OF TABLES

Table 1: Necessary components ................................. ……………………………….11


Table 2: Cost analysis of the proposed system .......................................................... 19

6
Chapter 1

1. INTRODUCTION

1.1 Introduction

As we know, in the world there are many vending machine systems and most of the
systems are for the public. By doing this project, we believe that finding items will be not
hard and rush. Because in the world, technology is developing day by day and the amount
of disease is increasing rapidly neither. Due to this, implementation of this protection is
very important in big and crowded cities. According to Infectious Diseases Supreme
Committee if people obey hygiene rules then illness would be less. Even if there are limited
places to buy a mask, gloves, or any other kind of items so it is difficult to obey these rules.
It is easy to encourage people to buy material when the number of places to buy an item is
increased on the streets. This would avoid excuses from people. Also, due to the proper
vending system, the government could charge the community and it could generate the
income that could further be used to build another hygiene system. As a result, we have
planned to do a hygiene matic system that will be achieved by Arduino Uno and also some
other devices, for example; coin meter, spring, or servo motor.
This system can be easily used because this system is used with coins and people
have coins in their pockets all the time. There is no need for membership and there is no
need to carry a card. People who come from another country can easily be adapted to this
system.
This report gives information on the components used, the cost, and the research the
team has conducted to bring forth this system.

7
1.2 Nature and Scope of the Problem

There were a lot of challenges faced during the progress of this project. A major
concern was the availability of some of the components needed for the project. This
system works with coin therefore system failure is expected if people do not have coin.
If there is not any material left users will not be able to use the machine.
Continuous monitoring and checking the machine stations are needed with the
purpose of solving and improving these problems. Machines should be put near places
which markets so people can make their cash coins.

1.3 Goals and Objectives

General purpose of this project is to be able to construct a viable automation system.


The project’s main aim is that to help people to reach health materials easily.

The set of objectives of this report are listed below:


 To explain working principles of the various components
 To design a working vending machine system
To obtain necessary data, books and published academic articles from the library were
read, the internet searched, questions were asked to our lecturers and our theoretical
knowledge gained throughout our undergraduate studies were put to work.

1.4 Significance of the Project

Recent studies show that majority of people can forget their stuff at home. These are
masks and wet towels. People may finish their stuff and may need new ones. It was
decided that hygiene matic system wille be a solution to help people. Automats are the
easiest way to make people have these materials. This system gives the oppurtunity that
people can have the health material directly from the machine so this is more hygienic.
Better service will be given to citizens that they can easily and peacefully reach materials
like that. This method is the most hygienic, newest and easiest one.

8
Usage of hygiene materials are compulsory due to pandemic. This system can be used
at hotels, shopping malls and public transportation places.

It could help bring order out of the chaos that exists at present in the pandemic process
and make it really simple and easy.

1.5 Method of the Project

First of all the necessary pieces of equipment collected. These equipment are taken
from the electronic market of China, Turkey, and Cyprus according to the price and
quality. In the progression phase of the project group members learned the working
logic, team working, complete the tasks on day, find a solution for spontaneously
problems how to code the software of the project and to make a design of this project.
According to the knowledge that was collected ,the best way to design and develop the
project was planned . According to plan that was made by members of the group, the
product is designed efficiently. After all these stages, the construction of the product was
started. First of all, construction of hardware was started and than editing hardware
Project into the model was done. After that, programme of Arduino step by step was
done . During the production phase of the project needed information is collected from
the websites and other sources. Dogu Manali, Dogukan Manali,Taner Yildirim and
Cagri Timel are the members of the group that have done the project.

9
Chapter 2

2. LITERATURE REVIEW
Heron developed the first vending machine in a temple in Alexandria in the 1st
century. People wanted to take holy water from the temple, but there was not enough
holy water for every human being, and people were violating the rights of other people
by taking more holy water than they needed. Heron generated a clever solution to this
problem. He developed an arm to the holy water dispenser and a system sensitive to the
weight of the coin to activate this arm. When people throw the coin into the holy water
dispenser, he built a small gate that was active by the weight of the coin. When this
door was opened, an arm came out of it, and you could receive a certain amount of holy
water through this handle. Before the word of robot started to be used in 1920, the word
automat was also used for robots. The future trend is the emergence of smart vending
machines that offer things like cashless payments; face, eye or fingerprint recognition
and social media connection. The vending machines of the future are likely to recognize
your identity and tailor their offerings to your interests and taste. For example, a
beverage vending machine might be well acquainted with what you buy at other vending
machines around the world and ask if you want a "skim latte with vanilla double shot" as
usual

10
Chapter 3

3. METHODOLOGY
In this chapter,information about hardware, software and working principle of the
hygiene matic system project will be given.

3.1 Hardware and Components

In this section, some information about our components of hardware system, circuits
and devices will be given. Therefore, purpose in this section is to show features of the
devices, giving information of devices and how to use these components in the circuit.
The hardware consists two sections body and electronics assembly part.

Assembly Item Quantity Description


Body 1 1 Laser cut wood Body
2 4 Servo Motor
3 4 Push Button
4 1 Nokia 5110 LCD
5 1 Coin Acceptor
6 1 5mm Power switch
7 1 12V 1A DC Power Supply (5.1 x2.2 mm barrel)
8 4 12V LED strip, 5cm,
Electronics 9 1 BreadBoard
10 4 F/F Dupont Jumper Wires, 30cm, 0.10" pitch
11 2 Male extra Long PCB headers, 0.10" pitch
12 3 Misc wire, 1ft 22-24 AWG
13 1 Arduino Uno,
14 1 74HC4050N Logic Level converter

Table 1: Necessary components

11
3.1.1 Arduino Uno

Arduino is a single-board microcontroller meant to make the application more


accessible which are interactive objects and its surroundings. The Arduino Uno board
is a microcontroller based on the ATmega328. It has a 32 KB of flash memory for
storing the code.It has 14 digital input/output pins in which 6 can be used as PWM
outputs, a 16 MHz ceramic resonator, an ICSP header, a USB connection, 6 analog
inputs, a power jack and a reset button. This contains all the required support needed for
microcontroller. In order to get started, they are simply connected to a computer with a
USB cable or with a AC-to-DC adapter or battery. Arduino Uno Board varies from all
other boards and they will not use the FTDI USB-to-serial driver chip in them. It is
featured by the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-to-
serial converter.[2]

Figure 1: Ardunio Mega

adopted by [https://www.arduino.cc/en/Main/arduinoBoardUno/]

12
3.1.2 Servo Motor

A servo motor is a type of motor that can rotate with great precision. Normally this
type of motor consists of a control circuit that provides feedback on the current position
of the motor shaft, this feedback allows the servo motors to rotate with great precision. If
you want to rotate an object at some specific angles or distance, then you use a servo
motor. It is just made up of a simple motor which runs through a servo mechanism.
If motor is powered by a DC power supply then it is called DC servo motor, and if it is
AC-powered motor then it is called AC servo motor. For this tutorial, we will be
discussing only about the DC servo motor working. Apart from these major
classifications, there are many other types of servo motors based on the type of gear
arrangement and operating characteristics. A servo motor usually comes with a gear
arrangement that allows us to get a very high torque servo motor in small and lightweight
packages. Due to these features, they are being used in many applications like toy car, RC
helicopters and planes, robotics, etc.

Figure 2: An example Servo Motor

[https://www.orientalmotor.com/servo-motors/index.html]

3.1.2.1 Working Principle of Servo Motor

A servo consists of a Motor (DC or AC), a potentiometer, gear assembly, and a


controlling circuit. First of all, we use gear assembly to reduce RPM and to increase
torque of the motor. Say at initial position of servo motor shaft, the position of the
potentiometer knob is such that there is no electrical signal generated at the output port
of the potentiometer. Now an electrical signal is given to another input terminal of the
error detector amplifier. Now the difference between these two signals, one comes from
the potentiometer and another comes from other sources, will be processed in a feedback
13
mechanism and output will be provided in terms of error signal. This error signal acts as
the input for motor and motor starts rotating. Now motor shaft is connected with the
potentiometer and as the motor rotates so the potentiometer and it will generate a signal.
So as the potentiometer’s angular positionchanges, its output feedback signal changes.

After sometime the position of potentiometer reaches at a position that the output of
potentiometer is same as external signal provided. At this condition, there will be no
output signal from the amplifier to the motor input as there is no difference between
external applied signal and the signal generated at potentiometer, and in this situation
motor stops rotating.

3.1.3 Coin Acceptor

The sensors in this coin acceptor use the thickness, diameter, voltage difference and
fall time of the coins to identify them and it is fully programmable so you are not
limited to any particular type of currency. Simply use the buttons and 7-segment display
on the side of the unit help to select a coin profile easily, insert a bunch of coin
samples (or the same one, over and over) and your good ready to use. After you have
programmed the coin profiles, the coin acceptor will recognize them and stored in the
memory when each type is inserted, the sensor compare inserted coin with memory,if it is
match coin accepted to system,otherwise system rejected.[6]

Figure 3: Coin Acceptor

[https://www.sparkfun.com/products/11636]

14
3.1.4 Nokia Lcd

At the heart of the module is a powerful single-chip low-power CMOS LCD driver
controller from Philips.The chip model is PCD8544. The chip is designed to drive a graphic
display of 84×48 pixels. It interfaces to microcontrollers through a serial bus interface
similar to serial peripheral interface. This chip operates in the range of 2.7 to 3.3 V and has
3 V communication levels. So, for any 5V logic microcontroller like Arduino, some sort of
logic level shifting is required otherwise display may get damaged. The LCD has a
backlight in different colors. These are red, green, blue and white. The PCD8544 LCD
driver has a built-in 504 bytes Graphic Display Data RAM (GDDRAM) for the screen
which holds the bit pattern to be displayed. This memory area is organized into 6 banks
from 0 to 5. Each bank contains 84 columns/segments from 0 to 83 and each column can
store 8 bits of data.

Figure 4: Nokia LCD

[https://lastminuteengineers.com/nokia-5110-lcd-arduino-tutorial/]

15
3.2 Software

We used the Arduino IDE software to write our program. Arduino is an opensource
platform that contains electrical and electronic components that are easily used to
simplify complicated tasks. The Arduino compiler is based on C/C++ language that
makes it appropriate as we have learned C. It also has very powerful commands and
libraries that makes it perfect for many different applications.

Arduino language is typically divided into three sections: structures, values (variables
and constants) and functions. Functions are the commands that control the Arduino and
perform computations. Values are the variables of the code that can be entered by the
user or by sensors in feedback systems. Structures are the elements that perform
arithmetic operations.

Figure 5:Arduino IDE interface

16
3.3 Design of the Project

In this section, some information will be given about the design of the hygiene matic
system Project. We used forex and plexi material to create a frame. We designed system
with 40 cm width and height 60 cm body..We are planned apporiate positions for
pushbuttons,coinmeter,nokia lcd and servo motors.After that We make holes on the body to
fixed pushbuttons,coinmeter and servo motors. We use glue to fix spring to the servo motor
and we used for nokia lcd to fixed on a frame.On the breadboard we created common
ground and common voltage also we placed level shifter (Integrated circuit) to decrease
voltage from 12 volts to 5 volts because Nokia lcd working range is between 3-5V.Finally
modules are connected to Arduino Uno.The Arduino Uno works with 12 V . We used 1
Amper power supply to use this system.

Figure 6: Measurements of frames

After this While testing the system, we faced some troubles firstly we figure out the length
of springs have not enough length that's why machine can not drop the product to get a
sufficient result We increase size of the spring .During the falling process spring not turn
enough to drop product to solve this issue the angle of servo motors are changed from 180
to 220 degrees.

17
3.4 Working Principle of Hygiene Matic Project

In this section, we will give some information, flow chart diagrams and circuits about the
working principle of the hygiene matic project. It is very simple to understand the working
principle in this project and we will try to make it much simpler.

3.4.3 Circuit Diagram

The circuit as shown in Figure 7 was designed. It is the main circuit of the hygiene
matic project. In the circuit, there are Arduino Uno,four Servo motor, Sensor, and one
Nokia 5110 LCD module. We use +12V in this circuit. Arduino Uno is the main
component of the system. User will insert his/her coin to coin meter module, the sensor
will approve the coin or not if it is approved sensor will send information to Arduino
which slot is able to buy. Than Arduino Uno will organize the servo motor on the
system with a component in the circuit below:

Figure 7: Circuit Diagram

18
3.4.4 Flow Chart Diagram

Figure 9 shows that the flow chart diagram of our system, so it can be see easily
which process followed in the diagram and we understand that the hygiene matic system
is built up as shown in the diagram below:

Figure 8: Flow Chart depicting the working principle of the system

19
The system start with his/her coin to insert to coin acceptor sensor. After that coin
acceptor check to type of the coin. If the type of the coin are match with recorded type,
coinmeter nipples become disconnected. Then Arduino uno become active. User able
to select option with push buttons. After that, Ardunio has information about necessary
movement for appropriate positioning. Finally Arduino apparatus send a command to
turn on Servo motor. Servo motor helps to rotate spring to drop the item into the slot.

Figure 9: Final view of the project

20
COST ANALYSIS

In this section, approximate prices of the products that is used on the model of project
is given. Table 2 shows the material names and the number of items to be used in each
item.

Name of Component Quantity Price (USD)

Arduino Uno 1 12

Push Button 4 4

Coin Acceptor 1 22

BreadBoard 1 4

Servo Motor 4 20

Logic Level converter 1 4

Nokia 5110 LCD 1 6

Materials(Wires,Papers,cardboards
etc.) 25

TOTAL 97

Table 2: Cost analysis of the proposed system

21
Chapter 4

4.POSSIBLE IMPROVEMENTS
An industrially viable product would require more professional precision with the
choice of materials and components as well as organization. Since our project is a small
prototype limited by our capabilities as students, there are many suggestions regarding
possible improvements on the design.

This system works with coin therefore system failure is expected if people do not
have coin, to avoid this trouble we can possible to add paper money entry and credit
card entry. A very useful improvement would be a voice command. For instance, this is
system for whole people thats why the customer may be disabled.This feature
will make it easier for people to choose option. The system has little capacity and to
improve that must expand the case size.

If the system could power from the sunlight, this would make the project even more
environmentally friendly. Also, it would eliminate the need for having to continuously
recharge the batteries.To achieve this we need to put solar cell.

22
Chapter 5

5.CONCLUSION

In this report, information and details of our project are given. We wrote about the
working principle, hardware & software details of the hygiene matic system project. By
this project, people can use our system with coins. We have designed a system that
provides to people who want to find an available place to buy goods.
Therefore the people will waste less effort and time by using the our system. We
have learned lots of information about how to design a model, design a smart device
circuit and some coding languages.

23
Time Plan

Study/ March April May June


Period (2021) (2021) (2021) (2021)

Week Week Week Week Week Week Week Week Week Week Week Week Week
4 1 2 3 4 1 2 3 4 1 2 3 4

Buying the
component

Designing
the system

Assembling
the body part

Assembling
the electronic
part

Design
software
with Arduino
IDE program

Testing the
system and
solving
problems

Additional
tests

Final report
and
presentation

24
REFERENCES

[1] Arduino, Retrieved on November 2018 from the World Wide


Web: http://arduino.cc/en/Guide/HomePage

[2] Advantages and Disadvantages of Vending Machine. Retrieved June 8,


2017, from http://www.costsoldier.com/facilities/vending-
machines/a/advantages-and- disadvantages-of-vending-machines/

[3] Big, S. (2014). Importance of Vending Machine. Retrieved June 8, 2017,


fromhttp://myventurepad.com/importance-vending-machines/.

[4] (Mary Bellis, 2017). The History of Vending Machines. [Online].


Available: https://www.thoughtco.com/the-history-of-vending-machines-
1992599

[5] Kubik MY, Davey C, Nanney MS, MacLehose RF, Nelson TF, Coombes
B. Vending and school store snack and beverage trends: Minnesota secondary
schools, 2002-2010. American Journal of Preventive Medicine. 2013;44(6):583-
588.

[6] Schultz, Mitchel E., Grob's Basic Electronics. 11th ed. New York,
NY : McGraw-Hill. (2011)

[7] Shatrughan Modi, Seema Bawa,Automated Coin Recognition System using


ANN, in 2011 International Journal of Computer Applications, 26 (4), 2011,
13-17.

25
APPENDIX

Code for the system

/*-----------------------------------

* Dogukan manali

* dogu manali

* cagri timel

* taner yildirim

I/O PIN#

ServoA ~11

ServoB ~10

ServoC ~9

ServoD ~6

ButtonA 8

ButtonB 7

ButtonC 5

ButtonD 4

LEDready 13

LEDdispense 12

coinInsert -3

A0-A4 Nokia5110 LCD


26
*/
#include <LCD5110_Graph.h>

LCD5110 myGLCD(A0,A1,A2,A3,A4);

extern uint8_t SmallFont[];

const int ServoA = 10;

const int ServoB = 11;

const int ServoC = 6;

const int ServoD = 9;

const int clockwise = 1700;

const int counterclockwise = 1300;

const int ButtonA = 7;

const int ButtonB = 8;

const int ButtonC = 4;

const int ButtonD = 5;

const int LEDready = 13;

const int coinInsert = 12;

27
long previousMillis = 0;
long intervalIdle = 500;

int LEDreadyState = LOW;

int y1= 0; int y2= 10; int y3=20;

void setup() {

myGLCD.InitLCD();

myGLCD.setFont(SmallFont);

myGLCD.setContrast(70);

pinMode(ButtonA, INPUT_PULLUP);

pinMode(ButtonB, INPUT_PULLUP);

pinMode(ButtonC, INPUT_PULLUP);

pinMode(ButtonD, INPUT_PULLUP);

pinMode(LEDready, OUTPUT);

pinMode(coinInsert, INPUT_PULLUP);

myGLCD.invert(true);

myGLCD.print("EMU", CENTER, 1);

myGLCD.print("BY TANER&DOGU", CENTER, 10);


28
myGLCD.print("GRADUATION", CENTER, 30);
myGLCD.drawRoundRect(13, 0, 70, 8);

myGLCD.drawRect(0, 20, 83, 47);

myGLCD.update(); delay(59000); myGLCD.clrScr(); myGLCD.update(); }

void loop()

unsigned long currentMillis = millis();

if(currentMillis - previousMillis >= intervalIdle) {

previousMillis = currentMillis;

if (LEDreadyState == LOW){

LEDreadyState = HIGH;

myGLCD.clrScr();

myGLCD.print("Please insert", CENTER, y1);

myGLCD.print(" 1 TL ", CENTER, y3);

myGLCD.print(" Coin ", CENTER, y2);

myGLCD.invert(false);

myGLCD.update(); }

else
29
LEDreadyState = LOW;
digitalWrite(LEDready, LEDreadyState);

y1=y1 +5; y2=y2+5; y3=y3+5;

if ((y1==35) && (y2== 45) && (y3== 55))

{y1=0; y2=10; y3=20;}

//wait coin and inserted

while (digitalRead(coinInsert)==LOW) {

digitalWrite(LEDready, HIGH);

myGLCD.clrScr(); myGLCD.update();

myGLCD.print("Please make", CENTER, 0);

myGLCD.print(" a selection. ", CENTER, 10);

myGLCD.drawRect(20, 20, 63, 47);

myGLCD.drawRect(20, 20, 41, 47);

myGLCD.drawRect(20, 20, 63, 34);

myGLCD.update();

servoEnable(); }

void servoEnable(){

30
while (digitalRead(ButtonA) == HIGH || digitalRead(ButtonB) == HIGH ||

digitalRead(ButtonC) == HIGH || digitalRead(ButtonD) == HIGH) {

//---------Servo A--------servoları ekleme yapıcagız-------------

if ((digitalRead(ButtonA) == LOW) ) {

for(int i=0; i<2; i++)

{digitalWrite(LEDready, HIGH); delay(50); digitalWrite(LEDready, LOW);


delay(50); }

myGLCD.clrScr(); myGLCD.print("Vending", CENTER, 0);

myGLCD.drawRect(20, 20, 63, 47); myGLCD.drawRect(20, 20, 41, 47);

myGLCD.drawRect(20, 20, 63, 34); myGLCD.print("A1", 25, 24);

myGLCD.update();

for(int i=0; i<57; i++)

digitalWrite(ServoA,HIGH);

delayMicroseconds(clockwise);

digitalWrite(ServoA,LOW);

delay(20.5); // 18.5ms

break; } 31
//---------Servo B----------------------------------------------------

if ((digitalRead(ButtonB) == LOW) ) {

for(int i=0; i<2; i++)

{digitalWrite(LEDready, HIGH); delay(50); digitalWrite(LEDready, LOW);


delay(50); }

myGLCD.clrScr(); myGLCD.print("Vending", CENTER, 0);

myGLCD.drawRect(20, 20, 63, 47); myGLCD.drawRect(20, 20, 41, 47);

myGLCD.drawRect(20, 20, 63, 34); myGLCD.print("A2", 46, 24);

myGLCD.update();

for(int i=0; i<57; i++)

digitalWrite(ServoB,HIGH);

delayMicroseconds(clockwise);

digitalWrite(ServoB,LOW);

delay(20.5); // 18.5ms

//delay(50);

break; } 32
//---------Servo C----------------------------------------------------

if ((digitalRead(ButtonC) == LOW) ) {

for(int i=0; i<2; i++)

{digitalWrite(LEDready, HIGH); delay(50); digitalWrite(LEDready, LOW);


delay(50); }

myGLCD.clrScr(); myGLCD.print("Vending", CENTER, 0);

myGLCD.drawRect(20, 20, 63, 47); myGLCD.drawRect(20, 20, 41, 47);

myGLCD.drawRect(20, 20, 63, 34); myGLCD.print("A3", 25, 37);

myGLCD.update();

for(int i=0; i<57; i++)

digitalWrite(ServoC,HIGH);

delayMicroseconds(clockwise);

digitalWrite(ServoC,LOW);

delay(20.5); // 18.5ms

//delay(50);

break; } 33
//---------Servo D----------------------------------------------------

if ((digitalRead(ButtonD) == LOW) ) {

for(int i=0; i<2; i++)

{digitalWrite(LEDready, HIGH); delay(50); digitalWrite(LEDready, LOW);


delay(50); }

myGLCD.clrScr(); myGLCD.print("Vending", CENTER, 0);

myGLCD.drawRect(20, 20, 63, 47); myGLCD.drawRect(20, 20, 41, 47);

myGLCD.drawRect(20, 20, 63, 34); myGLCD.print("A4", 46, 37);

myGLCD.update();

for(int i=0; i<57; i++)

digitalWrite(ServoD,HIGH);

delayMicroseconds(clockwise);

digitalWrite(ServoD,LOW);

delay(20.5); // 18.5ms

//delay(50);

break; } } } 34
35

You might also like