Vous êtes sur la page 1sur 42

DEDAN KIMATHI UNIVERSITY OF TECHNOLOGY

School of Engineering

Department of Mechatronic Engineering

FIFTH YEAR FINAL PROJECT REPORT

AUTOMATIC BEVERAGE DISPENSER

MICHAEL GICHURU E022-0931/2012

ERIC MAINGI E022-0950/2012

SAMUEL KARAU E022-0957/2012

SUPERVISOR: MR.BENSON KILONZO

Final year project report submitted to Department of Mechatronic Engineering in partial

Fulfillment of the requirements for the award of degree in Mechatronic Engineering of Dedan

Kimathi University of Technology.

1
Acknowledgement
We acknowledge with utmost gratitude, the guidance and counsel of the project supervisor Mr.

Benson Kilonzo. His input throughout the whole project schedule was excessively appreciated.

The Department of Mechatronic Engineering of Dedan Kimathi University of Technology was


instrumental in providing access to all information, equipment and resources that were required
to see the project to completion. There in, we acknowledge unending efforts by the Dean School
of Engineering, Dr. Jean Bosco Byringiro who guided us immensely to bring our idea into
perfection.

We pay special gratitude to Mr. Peterson Nyaga and Mr. kibe the lab technologists who were
very instrumental in guiding us in the fabrication process.

i
DECLARATION
This project report is our original work, excluding the parts which have been acknowledged to
the owners of the ideas. It is to the best of our knowledge that the following idea has not been
previously submitted to Dedan Kimathi University of Technology.

Group Members Reg No. Signature

1. Michael Gichuru E022- 0931/2012 ………………………


2. Eric Maingi E022-0950/2012 ………………………
3. Samuel Karau E022-0957/2012 ………………………

SUPERVISORS’ DECLARATION
This project report has been submitted to the Department of Mechatronics Engineering, Dedan
Kimathi University of Technology, with my approval as the supervisor:
Mr. Benson Kilonzo Signature: ................................... Date: .......................

ii
ABSTRACT

The modern customer is very keen on the hygiene of every item he or she purchases in the
market. The customers who buy drinks from vendors are keen on how the drinks are served.
Many people have learnt the benefits that come with taking blended flavors of drinks/beverages
thus making sellers mix flavors in order to remain competitive in the market. Although many
have moved from manual to semi-automatic drink dispensers, it is necessary to acknowledge the
efforts put by many designers in an attempt to come up with an automatic drink mixer and
dispenser.

The automatic beverage system consists of three buffer tanks mounted on a wooden stand, 12v
power supply, Arduino mega microcontroller, keypad, an LCD, three pumps, piping system,
flow sensors and inductive float level sensors. The user selects the preferred beverage via the
keypad and visual feedback is provided by the LCD. The microcontroller will send and receive
control signals to and from peripheral devices via the Input/output pins. These signals will
perform motor control in order to achieve effective mixing and delivery operation.

The automatic beverage system will allow waiters or bartenders to place and fill orders without
directly measuring and pouring the liquids. The machine helps with liquid and cost control by
dispensing precise amounts of the liquids.

The outcome at the end of the design period will be a working prototype.

iii
TABLE OF CONTENTS
Contents

Acknowledgement ................................................................................................................................ i
DECLARATION .................................................................................................................................ii
ABSTRACT........................................................................................................................................iii
1. Introduction ...................................................................................................................................... 1
1.1 Background Information ................................................................................................................ 1
1.2 Problem statement.......................................................................................................................... 2
1.3 JUSTIFICATION .......................................................................................................................... 2
1.4 OBJECTIVES ................................................................................................................................ 2
1.4.1 Specific objectives .................................................................................................................. 2
2. LITERATURE REVIEW ................................................................................................................ 4
2.1 The Beverage Dispenser ................................................................................................................ 4
2.2 Juice dispensing system ................................................................................................................. 6
2.3 Automatic Drink Dispenser ......................................................................................................... 10
2.4 THEORETICAL REVIEW ......................................................................................................... 10
2.4.1 Arduino Mega 2560 .............................................................................................................. 10
2.4.2 LEVEL SENSOR.................................................................................................................. 12
3. METHODOLOGY ........................................................................................................................ 14
3.1 System overview .......................................................................................................................... 14
3.2 Design approach .......................................................................................................................... 14
3.3 Design specifics ........................................................................................................................... 15
3.3.1 Power supply ......................................................................................................................... 15
3.3.2 Dispensing unit ..................................................................................................................... 15
3.3.3 Storage unit ........................................................................................................................... 15
3.3.4 User interface ........................................................................................................................ 15
3.4 OPERATION ............................................................................................................................... 16
3.5 DESIGN DETAILS ..................................................................................................................... 16
3.5.1 Mechanical structure ............................................................................................................. 16
3.6 Electrical Circuitry....................................................................................................................... 18
3.6.1 Power Supply ........................................................................................................................ 18

iv
3.6.1 Microcontroller ..................................................................................................................... 19
3.7Blockdiagram ................................................................................................................................ 22
3.8 Flowchart ..................................................................................................................................... 23
4. RESULTS ..................................................................................................................................... 24
5. DISCUSSION ................................................................................................................................ 24
5.1 Constraints and Alternatives ........................................................................................................ 24
6. CONCLUSION .............................................................................................................................. 25
7. RECOMMENDATION ................................................................................................................. 25
8. FINAL BUDGET OF THE PROJECT.......................................................................................... 25
9. WORK SCHEDULE ..................................................................................................................... 27
10. REFERENCES ............................................................................................................................ 28
APPENDIX 1 – SOURCE CODE ..................................................................................................... 28

v
vi
1. Introduction
1.1 Background Information
Beverages form integral parts of our culture. They can be defined as any drink intended for
human consumption except water. It is believed that beverages date back in ancient world and
has evolved to the many varieties in the world today.

In the 17th century many drinks were introduce around Europe. Gin was invented in Holland
early in the century, Rum was first distilled in the Caribbean, and champagne was invented in
England in the late 17th century. There were also new non-alcoholic drinks available in 17th
century England. Coffee was discovered in Ethiopia and it entered Europe in the 16th century
through Italy. Tea was discovered by the Chinese in the earliest days of their civilization but it
only reached Europe in the 17th century. Cocoa was also first drunk in England in the late 17th
century. Chocolate comes from Central America. [2]

In the late 19th century there were great improvements in public health. The industrial revolution
meant the mass production of drinks. For centuries ordinary people brewed their own beer and
made their own soft drinks like lemonade and cordials. In the 19th and 20th centuries they all
became mass produced. Meanwhile Marvin Stone invented paper drinking straws in 1888. The
screw bottle top was patented in 1889. Many new drinks were invented in the 19th century and
early 20th century. [3]

In today’s world leading restaurants are seeking ways to improve customer service in the
globally increasing competition. They are always looking for the best way to serve customers in
hygienic and satisfactory manner. Restaurants are looking for ways to reduce operational cost,
increase efficiency and offer fast and reliable services to their customers and one way to achieve
this is to reduce human labor cost, human error in mixing, contamination during handling and
reduce the time taken to serve an individual customer. The existing beverage dispensing units are
only tailored to dispense a single type of beverage at a time say coffee, water, lemon juice,
orange juice and many others, most of which are done by vending machines . However, majority
of people in the world prefer taking wide variety of beverage in one single mixture the so called
cocktail in proportions and recipes of their choice, which the food and beverage industry has
always overlooked.

1
The approach in this project is that the automatic beverage system will be able to serve different
cocktails as per customer’s requirement. It is based on microprocessor programming and
ON/OFF control via flow sensors. The scope of the project is limited to three drinks.

1.2 Problem statement


In the service industry contamination of beverages is a serious concern. A lot has been done to
ensure that drinks get to customers without contamination. The most common source of
contamination can be attributed to human handling. Contamination of the specific
cocktails/drinks/beverages poses a health threat to the customers and negatively hampers
business operations. There is a need to come up with a new way of delivering cocktails to
customers without the intervention of a human handler.

1.3 JUSTIFICATION
In most restaurants, the personnel is responsible for filling orders of not only the customers at the
restaurant, but also those seated elsewhere in the restaurant. There are times when the premises is
very busy, the only current solution is to hire more staff to assist in making cocktails. No
commercially available product exists to automatically mix and dispense drinks. However,
products do exist to automatically mix drinks, such as the Computerized Liquor Control System
(CLCS) by Easy bar. The CLCS looks similar to a soda gun and mixes correctly proportional
drinks at the touch of a button. However, unlike the Automatic Beverage Dispenser it only
mixes the drinks but it does not dispense without the personnel’s involvement. The automatic
beverage dispenser would allow the waiters to input the ordered drink and serve it without
having to mix and pour the required liquids. This system also assists in liquid control by
dispensing the precise amounts and portions of the liquids.

1.4 OBJECTIVES
The aim of this project is to design, fabricate and test a working prototype of the automatic
beverage system.

The prototype is to expedite the mixing and serving of drinks at restaurants and bars.

1.4.1 Specific objectives


1. To design and develop the mechanical structure to house the components

2. To design and develop the electrical circuits of the system

2
3. To develop a program to run the microcontroller

4. To design and develop the required pipework for the system

3
2. LITERATURE REVIEW
It is important to acknowledge the existence of beverage systems in the market today. Although
they work perfectly, earlier systems were limited to domestic use due to their simple design. The
researchers will use other articles of available dispensers to guide them come up with a design of
an Automated Beverage System.

2.1 The Beverage Dispenser


An invention of the Beverage Dispenser by Martin F. Berry, Detlef Westphalen, Gorm Bressner,
Zebulon Robbins, Bill Wright and David Beittel was the first design the researchers looked at. It
included a beverage cabinet, gravity-fed piston valve operated mechanically. This valve closes
and opens to control the flow of the beverage [4]

4
Figure 2.1.1

The design has an actuator below the valve and supported on the actuator. A pathway lumen
extends to direct the beverage to the receptacle. The beverage pathway lumen provides a directed
how of beverage that can essentially eliminate splashing into the dispensing body or cabinet, thus
reducing clean-up effort and the possibility of unsanitary conditions in the dispenser. This
assures that the beverage is fresh each time the actuator is operated. The actuator body can be
assembled just below the container to assure accurate and easy alignment of the actuator with the
valve arrangement and avoid misalignment caused by opening and closing the door during
replacement of the beverage container

The actuator body can be a two piece member arranged around the beverage pathway for easy
assembly, disassembly and cleaning. The pathway can be defined by a removable tube extending
from the valve through the body and the vent openings define enlarged retaining regions that
have a cross section larger than the lumen through the body so that the tube cannot accidentally
fall through the body into a user receptacle.

5
Figure 2.1.2

The problem with this dispenser is the cleaning process. It is obvious that time will be wasted
when serving two different drinks because it will require cleaning every time a drink is served
[7]. Another problem is where a drink flows through gravity. This may consume a lot of time
when the level of the drink in the tank is less. This means that serving the last cup will take
longer time than the first cup when the level is high due to the pressure head

2.2 Juice dispensing system


Arthur G Rudick, Ga and Marietta invented an apparatus for dispensing a beverage by gravity
feed from a container mounted in the outside of a door of a refrigerated cabinet, such as a home
refrigerator, comprises a vented spout assembly for dispensing a beverage from a container by

6
gravity feed at a substantially constant flow rate in combination with an actuation mechanism
mounted in the door of the refrigerator [7].

7
Figure 2.2.1

8
The vented spout assembly includes a valve assembly collar connectable to a discharge opening
in the container, a vent tube extending from a location in the collar to a location in the container
spaced from the discharge opening, the vent tube defining a vent passage there through. The
collar has a discharge wall with a liquid discharge port there through [7].

Figure 2.2.2

A rotary valve element is mounted for rotation in the discharge wall between OPEN and
CLOSED positions. The rotary valve has a liquid discharge conduit and a vent conduit there
through align able with the discharge port and the vent passage, respectively, when in the OPEN
position of the valve element, a spout extends from the liquid discharge conduit of the rotary
valve element and an actuation lever extends from the rotary valve element for engagement with
the actuation mechanism mounted in the door.
The problem with this design is that it serves only one type of drink and an additional type would
require refrigeration. It is also expensive as the dispenser is attached to the refrigerator meaning
that you cannot buy the dispenser on its own. The problem of the pressure head also features in
these designs as the flow of the beverage depends on the level of the juice in the container.

9
2.3 Automatic Drink Dispenser
Lawrence D. McIntosh invented an automatic drink dispenser for filling cups with liquid when
placed in receiving position on a support platform and including a solenoid controlled valve for
dispensing liquid into said cups [6]. It comprises at least one contact member positioned to make
contact with the liquid dispensed into said cup in said receiving position when the liquid reaches
a predetermined level therein and means electrically interconnecting said contact member and
said solenoid control valve for controlling said valve to stop the flow of liquid when the liquid
reaches a predetermined level in the cup [6].

Figure 2.3

2.4 THEORETICAL REVIEW


2.4.1 Arduino Mega 2560
The Mega 2560 is a microcontroller board based on the ATmega2560. It has 54 digital
input/output pins (of which 15 can be used as PWM outputs), 16 analog inputs, 4 UARTs

10
(hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP
header, and a reset button. It contains everything needed to support the microcontroller.

Features
Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital I/O Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per I/O Pin 20 mA

DC Current for 3.3V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by boot loader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 101.52 mm

Width 53.3 mm

Weight 37 g

11
Figure 2.4.1[8]

2.4.2 LEVEL SENSOR


The level sensors used are inductive float level switches that act as ordinary switch. The float
sensor switches have to be connected to a pull up resistor and then fed to the microcontroller.
The orientation of the float level sensors is such that their output is initially high so long as there
is adequate beverage in the feeder tanks. When the beverage level is below the threshold head
then the level sensor output goes low so the LCD displays empty tank.

12
Figure 2.4.3[10]

13
3. METHODOLOGY
The automatic beverage system is to deliver single drinks as well as cocktails.

3.1 System overview


The system will be based on Arduino mega controller. The mode of control shall be ON/OFF. It
shall consist of the following;

1. Buffer tanks (3)


2. Control unit;
The control unit consists of;
a. Arduino mega microcontroller
b. Motor drivers
c. Level sensors
3. Power supply unit
4. Dispensing unit;
a. Pumps
b. Tubes
c. Delivery nozzle
5. User interface;
a. Keypad
b. LCD display
c. On/ Off switch

3.2 Design approach


Following the previous designs, some few changes were made;

1. The buffer tanks were placed at the bottom eliminating liquid flow to the dispenser
nozzle by gravity. Only by pumping will the liquid attain the pressure to reach the nozzle.
This eliminates the need to use solenoid valves to regulate flow.

2. A user interface consisting of an LCD and keypad were integrated. This allows the user
to interact with the machine while providing visual feedback.

14
3. The system dispenses a fixed amount (250ml) of liquids based on our programming.

3.3 Design specifics


3.3.1 Power supply
A step-down transformer, a bridge rectifier and a 5v regulator were used.

3.3.2 System control

ON/OFF control is provided by the microcontroller via its digital outputs. The digital outputs are
connected to the motor drive.

The inputs from the level sensors via digital inputs of the microcontroller tells the user when any
of the buffer tanks is empty.

3.3.2 Dispensing unit


The dispensing unit consists of micro pumps, connecting pipes and delivery nozzle. The
delivery nozzle is to be modified as to meet the various dispensing specifications. The micro
pumps will provide the pressure head required.

The dispenser system is an important part in the design of the ABD. Although the control system
does most of the work, the dispenser system moves the liquids from the containers to the glass. It
is important that pumps have a consistent flow rate to accurately dispense the liquids.

3.3.3 Storage unit


The storage unit houses three buffer tanks mounted on a wooden frame for support. The buffer
tanks are filled with different beverages to be dispensed.

3.3.4 User interface


The LCD provides visual feedback to the operator as he keys in to the keypad. It also indicates
the state of the buffer tanks whether empty or full.

The keypad gives an interface for the selection of the recipe.

The on/off switch switches the machine on/off.

15
3.4 OPERATION
The operator plugs in the machine to the power source and switches on. If any of the buffer tanks
is empty then a message as to which tank is empty is displayed. If no message is displayed, then
the operator keys in the recipe he wants. The following are the recipes;

1. A=KEY 1

2. B=KEY2

3. C=KEY3

4. A+B=KEY 4

5. A+C=KEY5

6. B+C=KEY6

7. A+B+C=KEY7

The keyboard serves as an input device to the microcontroller and therefore it knows which
pumps to put on and the running time via the flow sensor.

After that cycle the program resets and the operator can chose another operation.

3.5 DESIGN DETAILS


3.5.1 Mechanical structure
The mechanical structure was fabricated using a wooden frame.

The buffer tanks are made of plastic.

The ABV structure consists of start and stop switches, dispensing area, buffer tank area, LCD
and keypad. The structure shall house all the other components and circuitry. The automatic
beverage system is to be fabricated as shown;

16
Figure3.5.1.1

17
Figure 3.5.1.2

3.6 Electrical Circuitry


3.6.1 Power Supply
The power supply is to be made of a step-down transformer, bridge rectifier, capacitors and a 12v
regulator. Even though the Atmega 2560 can operate at different supply voltages, a 7-12V DC
power supply is the most suitable. The circuit uses a cheap integrated three- terminal positive
regulator and provides high-quality voltage stability and quite enough current to enable the
microcontroller and peripheral electronics to operate normally

18
.

Figure 3.6.1

3.6.1 Microcontroller
The Arduino mega microcontroller was interfaced with the other electronic components as
shown;

Input devices;

19
The input devices are keypad and level sensors

Output devices;

The output devices are LCD and the pumps.

The pumps output pins are 25, 26 and 27.

Transistor logic switches the pumps.

Figure 3.6.2.1

20
Figure 3.6.1.2

We chose atmega2560 microcontroller as it provided the following features that are crucial to our
project;

1. 256KB flash memory

2. 4KB EEPROM

3. 8KB RAM

4. 86 General I/O pins

5. 12 16 bits resolution PWM channels

6. 4 serial UARTS

7. 16 ADC channels

The large number of I/O pins it possesses is most crucial to our project due to the large number
of input and output components to interface.

Resistors R5, R6, R7 are used to limit current drawn from the output pins of the microcontroller.

21
Diodes D1, D2, D3 are freewheeling diodes and helps eliminate the back EMF produced by the
pumps. A fly back diode (sometimes called a snubber diode, commutating diode, freewheeling
diode, suppressor diode, suppression diode, clamp diode or catch diode) is a diode used to
eliminate fly back, which is the sudden voltage spike seen across an inductive load when its
supply current is suddenly reduced or interrupted.

The inductive level sensors are shown as active switches. They are connected through resistors
R1, R2, R3 to the analog input pins.

3.7Blockdiagram

22
3.8 Flowchart

23
4. RESULTS
Upon completion of this project;

1. A working prototype of an automatic beverage dispenser was fabricated

2. The dispenser was able to dispense single beverages, or cocktails, which was either a
`mixture of two or three drinks.

5. DISCUSSION
The ABD had three main goals that were tested and proved during the final demonstration:

The interface had to be easily navigable, the pumps had to dispense single beverages and cocktails,
and the pumps had to be accurate to within 10%. After extensive testing and calibrating of each of
the three pumps, the ABD successfully accomplished its goals. On average, the pumps dispensed
accurate amounts with a 10% tolerance. The acceptance testing was proven by the successful
demonstration to Mr Kilonzo. The specifics of the acceptance testing include measuring the
dispensed liquid for each pump in different amounts multiple times. Using a 500ml beaker, each
pump was tested and calibrated until it was accurate and precise. Simple software changes were
made to dispense the amount as required. After these calibrations, the ABD successfully met its
acceptance testing.

5.1 Constraints and Alternatives


1. The flow sensor that we acquired was particularly hard to use because of its operation. This
resulted in the use of a timing program.
2. The incorporation of agitators in this project was challenging due to the fact that we placed
our buffer tanks at the bottom part of the housing.
3. Leakage of the piping system
4. The level sensors were placed above the required accurate positions.

24
6. CONCLUSION
Variety is the name of the game when it comes to pleasing today’s consumers. Soon consumers
might also have that kind of choice when it comes to beverages in quick-service restaurants.

The new dispensers will take up about the same amount of space as the standard eight-valve
dispenser used by many restaurants today.

The prototype will take advantage of micro-dispensing technology, allowing it to make use of tiny
amounts of highly concentrated flavoring. As opposed to the bag -in-box dispensers popular today,
which can be difficult to change and sometimes leak, changing out beverages in the new unit will
be like changing a printer cartridge. It will make it easier to launch new beverages. There will be
also storage and environmental benefits to the new technology. The small size of the flavoring
cartridges will decrease shelf space needed for inventory and packaging waste will be significantly
reduced. There will be benefits on the end-user side, as well.

Customers can choose their beverages—among more than 100 varieties—via a touch screen located
on the front of the machine.

Operators will like the fact that research shows that greater variety of beverages leads to better sales
of beverages—a high-margin item for quick-service restaurants.

7. RECOMMENDATION
Further improvements can be done on the project so that it can dispense liquids by price quantity
ratio. By the incorporation of other sensors and more time and resources being dedicated to the
project, this can be achieved.

The mechanical structure of the dispenser should be made of light material e.g. stainless steel
while other parts could be made of plastic for it to be compact and light weight.

8. FINAL BUDGET OF THE PROJECT

25
ITEM QUANTITY Unit Price PRICE
Arduino Mega 1 3000 3000
Pumps 3 1500 4500
Transformer 1 1000 1000
Flexible Pvc pipes 3 Metres 300 300
Screws assorted
Breadboards 1 200 200
Bonding Adhesives 1 200 200
CAPACITOR 3 50 400
POLAR
Numeric keypad 1 200 200

Lcd display 1 500 500


PLASTIC 3 100 300
CYLINDERS
RECTIFIER 6 10 60
DIODES
LEVEL SENSORS 3 1000 3000

JUMPER WIRES provided

NAILS assorted
WOOD FRAME provided
TRANSISTORS 3 25 75
SWITCH 1 50 50
BUTTONS
RELAY 2 50 100

MOTOR DRIVER 1 500 500


TOTAL 14385

26
9. WORK SCHEDULE
ACTIVITY/MONTH MAY JUNE JULY AUG SEP OCT NOV DEC
S
PROJECT
PROPOSAL
LITERATURE
REVIEW
PRESENTATION
MECHANICAL
DESIGN
CIRCUIT DESIGN
COMPONENT
SELECTION
COMPONENT
ACQUSITION
PROGRAMMING
FABRICATION
TESTING &
DEBUGGING

27
10. REFERENCES
[1] Patent US6708741 - Beverage dispenser. (n.d.). Retrieved July 14, 2016, from
http://www.google.com/patents/US6708741

[2] Emmins, Colin. Soft Drinks: Their Origins and History. Shire, 1991.

[3] Patent US4930666 - Juice dispensing system for a refrigerator door. (n.d.). Retrieved

July 14, 2016, from http://www.google.com/patents/US4930666

[4] Patent US6708741 - Beverage dispenser. (n.d.). Retrieved July 14, 2016, from
http://www.google.com/patents/US6708741

[6] Patent US3916963 - Automatic drink dispenser. (n.d.). Retrieved July 14, 2016, from
http://www.google.com/patents/US3916963

[7] Tamime, A. (2008). Cleaning-in-place dairy, food and beverage operations (3rd ed.).
Oxford, UK: Blackwell Pub.

APPENDIX 1 – SOURCE CODE


#include <Keypad.h>

#include <LiquidCrystal.h>

const byte ROWS = 4; //four rows

const byte COLS = 3; //three columns

char keys[ROWS][COLS] = {

{'1','2','3'},

{'4','5','6'},

{'7','8','9'},

28
{'*','0','#'}

};

byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad

byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

LiquidCrystal lcd(30,31,32,33,34,35);

int motor = 25;

int level1 = A2;

int level2 =A1;

int level3 =A3;

int hysteresis =50;

int sensingLevel =10;

void setup(){

Serial.begin(9600);

lcd.begin(16, 2);

for (int pump = 25; pump < 28;pump ++) {

pinMode(pump, OUTPUT);

void loop() {

/**********************TANK ONE******************************/

lcd.clear();

29
lcd.print("EMPTY TANK:");

if (analogRead(level1)<20)

lcd.setCursor(1,1);

lcd.print(" 1 ");

//delay(10000);

/**********************TANK TWO******************************/

if (analogRead(level2)<20)

lcd.setCursor(6,1);

lcd.print("2 ");

//delay(10000);

/**********************TANK THREE******************************/

if (analogRead(level3)<20)

lcd.setCursor(9,1);

30
lcd.print("3 ");

//delay(10000);

if(analogRead(level1)>20){

if(analogRead(level2)>20){

if(analogRead(level3)>20){

lcd.setCursor(0,1);

lcd.print(" NONE");

char key = keypad.getKey();

if(key != NO_KEY){

lcd.clear();

//lcd.print(key);

Serial.println(key);

switch(key){

lcd.clear();

case '1':

lcd.print("you selected");

lcd.setCursor(0,1);

lcd.print("drink 1");

31
digitalWrite(25, HIGH);

delay(7500);

digitalWrite(25, LOW);

break;

case '2' :

lcd.print("you selected");

lcd.setCursor(0,1);

lcd.print("drink 2");

digitalWrite(26, HIGH);

delay(7500);

digitalWrite(26, LOW);

break;

case '3' :

lcd.print("you selected");

lcd.setCursor(0,1);

lcd.print("drink 3");

digitalWrite(27,HIGH);

delay(7500);

digitalWrite(27, LOW);

break;

32
case '4' :

lcd.print("you selected");

lcd.setCursor(0,1);

lcd.print("drink 4");

digitalWrite(25,HIGH);

delay(3750);

digitalWrite(25, LOW);

digitalWrite(26,HIGH);

delay(3750);

digitalWrite(26, LOW);

break;

case '5' :

lcd.print("you selected");

lcd.setCursor(0,1);

lcd.print("drink 5");

digitalWrite(25,HIGH);

delay(3750);

digitalWrite(25, LOW);

digitalWrite(27,HIGH);

delay(3750);

digitalWrite(27, LOW);

break;

33
case '6' :

lcd.print("you selected");

lcd.setCursor(0,1);

lcd.print("drink 6");

digitalWrite(26,HIGH);

delay(3750);

digitalWrite(26, LOW);

digitalWrite(27,HIGH);

delay(3750);

digitalWrite(27, LOW);

break;

case '7' :

lcd.print("you selected");

lcd.setCursor(0,1);

lcd.print("drink 7");

digitalWrite(25,HIGH);

delay(2500);

digitalWrite(25, LOW);

digitalWrite(26,HIGH);

delay(2500);

digitalWrite(26, LOW);

34
digitalWrite(27,HIGH);

delay(2500);

digitalWrite(27, LOW);

break;

delay(100);

35

Vous aimerez peut-être aussi