Você está na página 1de 41

Faculty of Engineering & Technology

Mechatronics System Design


End-of-Semester Research Project
Coffee & Tea Vending Machine
Abdullah Issa 0057388
Amal Reyahy 0057368
Bassam Ziadeh 0050505
Sarah Ali 0057785
Zaid Asfour 0046470
5/9/2009

Page|i

Abstract

Overtheyears,theadvancementsandapplicationsofmechatronicssystemshaveincreased
andcontinuetoexperienceanupwardgrowth.Theseapplicationshavecontinuedtoallowforthe
automationofmundaneoperations,whetheritbeacomplexoperation,suchasarcweldingofa
automotivechassisorasimpletask,suchaspreparingacupoftea.Thefollowingpaperwill
investigatetheoperationofsuchamachine,whosesoletaskistodispenseacupofcoffeeorteaper
theusersrequest.Wewilllookintotheoperationofthemachine;proposeaconceptualdesign,
includinghardwareandsoftware,aswellassufficientinstructionsonhowtoproperlyoperatethe
system.

Page|i

TableofContents
Abstract..........................................................................................................................................i
Introduction...................................................................................................................................1
SystemDescription........................................................................................................................2
GeneralSystemDescription................................................................................................................2
SystemFlowCharts.............................................................................................................................3
DescriptionofSystemTransducers.....................................................................................................6
CoinDetectionTransducer.............................................................................................................6
FluidLevelSensor...........................................................................................................................6
TemperatureSensor.......................................................................................................................7
SafetyLimitSwitches......................................................................................................................7
DescriptionofSystemsActuators.......................................................................................................8
RotaryMicroPump.........................................................................................................................8
DCMixingMotor.............................................................................................................................8
SelectionofController...................................................................................................................9
DescriptionofControlAlgorithms.................................................................................................10
VendingMachineSafety...............................................................................................................12
VendingMachineStandards.........................................................................................................13
IECInternationalElectrotechnicalCommission..............................................................................13
IEC60335275Householdandsimilarelectricalappliances.......................................................13
NAMANationalAutomaticMerchandisingAssociation................................................................13
MultiDropBus/InternalCommunicationProtocol.....................................................................13
UserInstructions...........................................................................................................................14
MaintenanceRequirements..........................................................................................................15
Appendices...................................................................................................................................16
AppendixAFluidLevelSensorDatasheet......................................................................................16
AppendixBSensitThermocoupleDatasheet.................................................................................19
AppendixCSchwarzerPrecisionRotaryDiaphragmPumpDatasheet..........................................23
AppendixDDetailedWiringDiagram............................................................................................26
AppendixEMicrocontrollerCode...................................................................................................27
AppendixFPro/EngineerIllustrations...........................................................................................35
References....................................................................................................................................37

Page|ii

TableofFigures
Figure1VendingMachine(OutsideView)..................................................................................35
Figure2VendingMachinew/SafetyDoorOpen........................................................................35
Figure3InsideViewofVendingMachine...................................................................................36
Figure4VendingMachine(InsideView).....................................................................................36

Page|iii

Introduction

CoffeeandTeavendingmachines,likemostothervendingmachines,areagreatexampleof
mechatronicssystems.Theyseamlesslyincorporatesensornetworks,includeoneormore
microcontrollers,somesortofactuation,beitlinearorrotational,aswellascontaintheabilityto
interactwiththeoutsideworld.Theoriginofvendingmachines,whicharedetailedin[1]andarenot
thefocusofthispaperhasbeentracedbacktotheearly1880sandhascontinuedtoevolvetothis
day.Theconceptsofthevendingmachineshavebeenusedinawiderangeofproducts,suchas
newspaperdispensers,drinksandsnacks,aswellasslotmachines,whichutilizemanysimilar
technologiesasvendingmachines.
Themainideabehindacoffeeandteavendingmachineistoofferpipinghotcoffeeortea,
oranyotherliquiddrinkforthatmatter,atthetouchofabuttonwithouttheneedtomanually
preparethedrink.Thevendingmachineitselfusuallycontainsoneormoreinsulatedcontainersto
holdthedrinkofchoice.Furthermore,eachcontainerhasitsownindependentelectricheating
elementwhichcaneitherbeusedtomaintainthetemperatureofthedrinkalldayortoinstantly
heatthedrinkuponorder.

Inadditiontothis,numeroussafetyfeaturesarebuiltintothesystemtoensurethatthehot
drinkisnotdispensedintheabsenceofacupandmayalsocontainsomesortofsafetymechanism
whichpreventstheuserfromaccessingthedispensingareaifthehotdrinkisbeingdispensedto
preventanyharm.

Page|1

SystemDescription
GeneralSystemDescription

Asindicatedbythetitle,thissectionwillfocusonthegeneralworkingsofthevending
machinedesignasproposedbythispaper.Thevendingmachine,asdesigned,willonlyacceptcoins
ofcertaindenominations,whichincludethe5,10,25and50piastercoins.Uponinsertingthecoin(s)
intothesystem,theuseristheninstructedtoselectthedrinkofhischoicebypressingoneofthe
threebuttonsavailableontheleftsideofthefrontfaceofthemachine.Oncetheuserselects
his/herdesireddrink,thesystemthencheckstoensurethatthereisenoughofthatdrink,beit
coffee,tea,etc.Ifthereisinfactsufficientquantitytofulfilltherequest,theuseristhenprompted
toselecttheamountofsugar.Thesystemhasthreesugarsettings,eitherNoSugar,OneSugar
orTwoSugars.Intheeventthatthereisinsufficientquantityoftheselecteddrink,theuseristhe
informedthatTheOptionisNotAvailableandpromptedtoselectanotherdrink.

Assumingthedrinkisavailable,andtheamountofsugarisselected,theappropriateamount
ofthedrinkispumpedintothemixingchamber.Theamountofliquid,whichisequaltothevolume
ofthecup,isdeterminedbymultiplyingthevolumetricflowrateofthepumpusedbytheamountof
timethepumpisturnedon
;.Atthesametime,thesugarrequestedbytheuserisalso
placedintothemixingchamber.Atthispointthemixingchamberisviolentlyshakenbackandforth
inordertocompletelymixthesugarintothedrink.

Whilethedrinkisbeingprepared,aStyrofoamcupisreleasedfromthecupdispenser.The
useristhenpromptedtoplacethecupdirectlyunderneaththespoutofthevendingmachine.Two
limitswitcheswillensurethatthecupisproperlyplacedrestingontheplatformaswellaslocated
directlyunderneaththespout.Thisensuresthattheuserhasremovedhishandsfromthevicinityof
thehotdrinkaswellasensuringthatallofthedispenseddrinkwillbepumpedintothecupandnot
spill.Afurtherlimitswitchwillbeemployedtomonitorthestatusoftheguardscreen,whichmust
beshutforthedrinktodispense.Theroleoftheguardscreenisexplainedindetailinthesection
titledVendingMachineSafety.

Oncethemixingchamberhasbeenagitatedforacertainamountoftime,andthecupis
properlyplacedinposition,theopeningofthemixingchamberisreleasedandthedrinkisemptied
intothecup.Atthispoint,iftheuserdidnotentertheexactamountofchange,hisremaining
balanceiscalculatedandreturnedtohimviathechangecollector.Thismarkstheendoftheusers
transactionandthemachinepreparesitselfforanotherrequest.

Page|2

SystemFlowCharts

Page|3

Page|4

Page|5

DescriptionofSystemTransducers

Avendingmachine,especiallyonewhichdistributesdrinks,reliesheavilyonawiderangeof
transducerstofunctionproperly.Thereasonforthisisthefactthattherearenumerousparameters,
suchasfluidheightanddrinktemperature,whichmustbemeasuredand/ormaintainedatacertain
level.Inthissectionwewilldiscussthenumeroustransducersusedintheproposeddesignaswellas
abriefdescriptionoftheirtheoryofoperation.
CoinDetectionTransducer

Thefirsttransducerwewilldiscussischronologicallythefirsttransducerusedinthe
machine,andthatisthecoindetectiontransducer.Inoursystemwewillutilizeaninductivecoin
sensortohelpthesystemdistinguishbetweendifferentcoindenominations,thesecondbenefitof
usinganinductivecoinsensoristhatitprovidesthesystemwiththeabilitytodetectandrejectfake
coins.Thebasisofthissensorisbuiltontheideathateachcoindenominationhasitsowndiameter,
thickness,andmetalliccomposition.Thesepropertiesprovideforanidealuseofamagneticpickup
coil,suchasafluxgatemagnetometer,whichiscapableofdetectingvariationsinmagneticfields.
Now,asdescribedin[1]and[2],thepresenceofacertaincoinwillaffectamagneticfieldin
suchamannerthatisuniquetothatdenomination,whichmeansthata5piastercoinwillaffecta
magneticfielddifferently,thena10piaster,25piasterora50piastercoin.Thisdifferencein
magneticfieldisdirectlyrelatedtothecoinsthickness,diameter,andmetalliccomposition.The
differenceinmagneticfieldisthensensedbythemagneticpickupcoil,conditionedandcompared
tostoredvalues.Ifthevariationinmagneticfielddoesnothaveacorrespondingstoredvalueinthe
vendingmachinescontroller,thenthecoinisdeemedfakeandrejected.Furtherinformationonthe
signalconditioningcircuitisdescribedin[1]butisoutsidethescopeofthispaper.
FluidLevelSensor

Thenexttransducerwhichwillbediscussedisthefluidleveltransducer.Oncetheuserhas
insertedtheappropriateamountofchange,heispromptedbythesystemtoselecthis/herdrinkof
choice.Oncetheuserhasselectedhis/herdrinkofchoicethesystemmustchecktoseeifthereisa
sufficientamountofthatdrinkleft.InordertodothiswewilluseHoneywellsLLESeriesLiquidLevel
Switch.Thistransducerutilizesopticaltechnologytoaccuratelymeasureforthepresenceofliquid.
ThisworksbyemittingalightfromanLEDontoaplasticdome.Whennoliquidispresent,thislightis
reflectedbackontoaphototransistorprovidingalogic1signal.Whentheliquidcoversthedome
theamountoflightwhichisreflectedbacktothephototransistorisreduced,causingtheoutputto
switchtologic0.

Onebenefitofthissensoristhatitprovidespreciseandrepeatableswitchingpoint,which
allowsforaccurateandreliableuse.Furthermore,asthesensorismicroprocessorcompatible,it
allowsforeasyinterfacewiththePICmicrocontroller.

Page|6

TemperatureSensor

Thethirdsensorwhichwillbediscussedisthefluidtemperaturesensor.Thissensorisof
greatimportanceasthewholebasisofourvendingmachineistobeabletoprovideaselectionof
hotdrinksatthepressofabutton.Thissensorwillbeplacedinthemixingcontainerwhichis
responsibleformixingthesugarintothecustomersdrinkpriortoserving.Themixingcontaineralso
containsanelectricheatingelementwhichwillbeusedtoheattheliquid.Toachievethis,wewill
useSensitsKtypethermocoupletofacilitatequickandaccuratemeasurementofthedrinks
temperature.Asthetemperaturerangeofthesensorisfrom30C150Citismorethensuitableto
measurethemaximumtemperatureofthedrink,whichwillbelimitedto90C,whichwillensure
customersatisfactionandmoreimportantlycustomersafety.

Sincetheaccuracyofthefluidisnotofgraveimportance,thesensorandtheheating
elementwillbeconnectedviaaPcontrollercircuit.Thiswillallowtheheatingelementtomaintain
thetemperaturewhilelimitingtheovershoottoanacceptablevalue.Formoreinformation
regardingthesensor,refertoappendixBforthesensorsdatasheet.
SafetyLimitSwitches

Thefinalsensorwewillutilizeinoursystemisapairoflimitswitches.Thefirstlimitswitch
willbeplacedonthebaseofthevendingmachinedirectlybeneaththedeliveryspout.Thesecond
limitswitchwillbeplacedontheglassdoorstopper.Thesetwolimitswitcheswillensurethatthe
drinkisnotdeliveredtothecupunlessthecupisplaceddirectlybeneaththedeliveryspoutandthe
customerhasremovedhishandsfromthedeliverycompartment.Thiswillguaranteethecoffeeis
deliveredtothecupandintheeventthatsplashingoccurs,noneofthehotdrinkcomesincontact
withthecustomer,avoidinganypossibleinjury.Moreinformationregardingthesafetyfeaturesof
theproposedvendingmachinedesignisavailableintheVendingMachineSafetysection.

Page|7

DescriptionofSystemsActuators
RotaryMicroPump

Thecoffeemachinesystemreliesheavilyonactuators,aswellassensors,toachieveitsgoal
ofdeliveringhotcoffeeatthepressofabutton.Theproposeddesignwillrelymainlyontwo
actuators,bothofwhicharerotary.Thefirst,andmostevident,isacentrifugalpump,whichwillbe
responsiblefortransportingthedrinkofchoicefromtheirrespectivecontainerstothemixing
chamber.ThecentrifugalpumpusedisaSchwarzerPrecisionrotarydiaphragmpump,which
suppliesaflowrateof600mL/minwhichisidealforourapplicationasthecupholds0.31Loffluid.
Assuch,simplecalculationwillshowthatthepumpwillbeonforexactly25secondsinordertofill
thecuptoanacceptablelevel,whileleavingenoughroominthecuptopreventspillingduring
handling.

Theoperationofrotarydiaphragmpumpsissimilartovanepumps,inthesensethatthey
relyonaneccentricshafttoactuatethesuctionofthefluid.Accordingto[3],arotarydiaphragm
pumpsiscomprisedofadiaphragmactuatedbyashaftoreccentriccam.Itisdesignedsuchthatthe
diaphragmchangesthevolumeofthechamberduringrotationwhichcreatesalternatesuctionand
pressureconditionsinthechamberwhicheventuallycausesflow.Moreinformationontheselected
pumpcanbefoundinAppendixC.
DCMixingMotor

ThesecondactuatorintheproposedvendingmachinedesignisaDCmotor,whichwillbe
responsibleformixingthedesireddrinkandthesugartogether.WehavedecidedontheuseofaDC
motor,asopposedtoasteppermotor,becausetheapplicationdoesnotrequireanyformof
accuratepositioning.Themotorwillhaveapropellerattachedtotheendofitsshaftwhichwillmix
thesugaranddrinkmixtureforaspecifiedtime,ensuringthatthesugarhasfullydissolved,thus
ensuringcustomersatisfaction.SincetheperformanceofDCmotorsarewellknown,wewillnot
expandonthetheoryofoperationinthispaper.

Page|8

SelectionofController

Inthedesignproposedbythispaper,wehavedecidedtocontrolthemachineusinga
microcontrollerbasedsystem.Thisdecisionwasbasedonthefactthatproductionofthesevending
machineswouldbeonalargescale,thusmakingdedicatedmicrocontrollersamuchmoreviable
optionwhencomparedtoPLCs.Furthermore,asthesystemisdesignedtobesmall,aPCand/or
laptopwouldnotbefeasible,neitherfromacostpointofviewnorfromasizepointofview.

Furthermore,thefactthatamicrocontrollerhasagreaterabilitytohandlesignal
conditioningbetterthenaPLCisagreatadvantage,sincethecoinsensorwillneedsomeformof
A/Dconversionalongwithsignalprocessingtodeterminethevalueofthecoininsertedbytheuser.
AsthemicrocontrollerofchoiceistheMicrochipPIC16F877,adescriptionoftheirA/Dmodule,as
foundin[4],isgivenbelow.Alsotheaforementionedcharacteristicscanbesummarizedinthe
followingtable.
TheAnaloguetoDigital(A/D)ConvertermodulehaseightinputsforthePIC16F877.The
conversionofananalogueinputsignalresultsinacorresponding10bitdigitalnumber.TheA/D
modulehashighandlowvoltagereferenceinputthatissoftwareselectabletosomecombinationof
VDD,VSS,RA2orRA3.TheA/Dconverterhasauniquefeatureofbeingabletooperatewhilethe
deviceisinSleepmode.TooperateinSleep,theA/DclockmustbederivedfromtheA/Dsinternal
RCoscillator[4].

Microcontroller
PLC
PC/laptop

NumberofProductsto
beManufactured
High
Medium
Low

SignalProcessing
Capability
Medium
Low
High

Speed

Cost

High
Low
Medium

Low
Medium
High

Page|9

DescriptionofControlAlgorithms

Indesigningtheproposedvendingmachine,thereweremanyaspectsofthemachinethat
requiredaformofcontroltoensuretherequiredoperation.Assuchwehaveemployedtwo
methodsofcontrolinoursystem,On/Offcontrolandproportional(P)control.Thefollowingtable
illustratesthedifferentareasofuse.
Component

Controlalgorithm

Description

Pushbuttons

ON/OFF

Selectingthedrink

Pump

ON/OFF

Stirrer

ON/OFF

Pumpthedrinkforaprespecifiedperiodof
time
Shakethefluidforaprespecifiedperiodof
time

Limitswitches

ON/OFF

Safetypurposes

Fluidlevelsensing

ON/OFF

Cupdispenser

ON/OFF

Mixingchamberto
cupdispenser
Heater

ON/OFF

Indicatesifthereisenoughdrinksinthe
tanks
Releasingacupwhilethedrinkisbeing
prepared
Releasingfinisheddrinkbythemeansof
gravitytothecup
Negativefeedbackfromthetemperature
sensor.
Heatingwillbecorrespondingtothe
difference(error)betweentheactualandthe
desiredwatertemperaturetomaintainthe
desiredwarmnessofthefluids

Proportional

ProportionalControl

Inthismodeofcontroltheactualvalueofthevariabletobecontrolledissubtractedfrom
thedesiredvalue.Theresultismultipliedbytheproportionalconstant(sometimescalledthegain)
andsenttotheoutputofthecontroller.Thismethodensuresthattheresponseofthecontrolleris
increasedwhentheerrorincreases.Alsonotethatthismethoddoesnothaveanymemory(i.e.,
thereisnoneedtorememberthelastoutputofthecontrollerinthelastupdate).Themain
disadvantageoftheproportionalcontrolisthatitcannoteliminatethesteadystateerror(itcanonly
reduceit).Increasingthevalueoftheproportionalconstantwillimprovethespeedofresponseand
reducethesteadystateerror(butcannoteliminateit).However,thiscouldleadtoovershootingof
thesystemorevenoscillationincertaincases[2].

Page|10

ProportionalControlTheory

Intheproportionalcontrolalgorithm,thecontrolleroutputisdirectlyproportionaltothe
errorsignal,whichisthedifferencebetweenthesetpointandtheprocessvariable.Inotherwords,
theoutputofaproportionalcontrolleristhemultiplicationproductoftheerrorsignalandthe
proportionalgain.
Thiscanbemathematicallyexpressedas

Where:
Pout:Outputoftheproportionalcontroller
Kp:Proportionalgain
e(t):Instantaneousprocesserrorattime't'.e(t)=SPPV
SP:Setpoint
PV:Processvariable

Page|11

VendingMachineSafety

Aswithanydevicewhichinvolvesahumanmachineinteraction,thereliesariskofdanger.
Thisisduetothereasonthatmostmachines,withtheexceptionofAImachines,areprogrammedto
react/interactinaccordancewithspecificinputs.Whentheseinputsareactive,themachinewill
reactaccordinglyregardlessofexternalstates.Thepossibilityofdanger,orhazardrisk,isnotspecific
onlytolargescale,complexsystemsbutisalsoavailableonsmallsystemssuchasacoffee&tea
vendingmachine.

Thehazardriskinoutmachinecomesasaresultofhavinghumaninteractionwithsteaming
hotliquids,suchascoffee.Therehavebeenreportsthatcoffeeservedatcertainfastfood
restaurants,whichutilizecoffeevendingmachines,causedseconddegreeburnswhenthecoffee
wasspilledonbareskin.Furtherhazardsstemfromthefactthatwearedealingwithfooditems,
whichareconsumedbyhumans.Thismeansthatthesystemmustbehygienicallycleans,without
thepossibilityofrustonanymetalliccomponentswhichcomeincontactwiththeliquid.
Furthermore,specialcaremustbetakentoensurethatthemixingchamber,aswellasthecup
dispenser,isperiodicallycleanedtoremoveanybacteria.

Inordertominimizetheriskinourmachine,wewillfirstaddresstheriskofburnwhenthe
drinkisbeingdispensed.Thiswillbeachievedthroughtheuseofaguardscreen.Theguardscreenis
simpleaslidingfiberglassdoorwhichslidesupanddowntoallowaccesstothedispensingarea.In
orderforthedrinktodispensethescreenmustbecompletelyshut,aspreviouslynoted.This
ensuresthatduringthedeliveryofthedrinkthereisnochanceofharmintheevenofspillage.

Thesecondhazard,thehealthrisk,willbeimplementedviascheduledmaintenancebythe
machineowner.Thiswillincludetheremovalofthemixingchamberaswellasthethreedrink
containers,thoroughlywashinganddisinfectingthemandreturningthematregularintervals.This
morethenensuresthatthecontainersremainfreeofbacteriaandotherharmfulgerms.

Page|12

VendingMachineStandards
TheFollowingareacoupleofstandardswhichapplytovendingmachines.

IECInternationalElectrotechnicalCommission
IEC60335275Householdandsimilarelectricalappliances

ThisInternationalStandarddealswiththesafetyofelectriccommercialdispensing
appliancesandvendingmachinesforpreparationordeliveryoffood,drinksandconsumerproducts,
theirratedvoltagebeingnotmorethan250Vforsinglephaseappliancesand480Vforother
appliances.
Appliancesthatarewithinthescopeofthisstandardare:

bulkteaorcoffeebrewingmachines;
cigarettevendingmachines;
coffeegrinders
commercialliquidheaters;
espressocoffeeappliances;
hotandcoldbeveragevendingmachines;
hotwaterdispensers;
icecreamandwhippedcreamdispensers;
icedispensers;
newspaper,audioorvideotapeordiscvendingmachines;
packagedfoodanddrinkvendingmachines;
refrigeratedmerchandisers

Thisstandardalsodealswiththehygieneaspectsofappliances.Asfarasispracticable,thisstandard
dealswiththecommonhazardspresentedbyappliancesthatareencounteredbyusersand
maintenancepersons.However,ingeneral,itdoesnottakeintoaccountyoungchildrenplayingwith
theappliance.

NAMANationalAutomaticMerchandisingAssociation
MultiDropBus/InternalCommunicationProtocol
TheMultiDropBus/InternalCommunicationProtocolisanInterfaceStandardthatallowsthe
variouscomponentsofavendingmachinetocommunicatetotheVendingMachineController.Itisa
wayfortheElectronicControllertolearnwhatcoinswereacceptedbytheCoinChanger,whatbills
wereacceptedbytheBillAcceptor,andhowmuchcreditisavailablethroughtheCardReader.Itisa
wayfortheControllertotelltheCoinChangerhowmuchchangetopayoutortotellthecard
readerhowmuchcredittoreturntothecard.ThereareotherdevicestheControllercan
communicatetothroughthisinterfaceand,theoptionforevenadditionaldevicesexistsforthe
future.
MDBisutilizedinVendingmachinestoconnecttheBillAcceptorsandCoinChangermechanisms.
Thisevolvedasthestandardinvendingmachinesafter1995.

Page|13

UserInstructions
Inordertoinformtheuserofthevendingmachinehowtouseit,thenit'srequiredtoputthe
instructionsonfrontofthebodyofthemachine,andit'scontainthefollowing:
o
o
o

Teacostis0.15JD
Coffeecostis0.25JD
Cappuccinocostis0.5JD

MachineOperationInstructions:
1 Putthemoneyonthecoinentrance
2 Presstherequireddrink
3 Presstherequiredamountofsugar
4 Takethecup,andputitinitsplace
5 Closethedoor.

*Putawarninglabel:"DONOTROCKORTILTMAYCAUSESERIOUSINJURYORDEATH.

Page|14

MaintenanceRequirements
Maintenanceoperationisneededinmostmachines,andtheMaintenanceoperationsrequiredin
thevendingmachineisthefollowing:
1 Themachinehastoberefilledwithdrinkswhenit'sempty.
2 Themachinemaybeplacedoutside,thesafestwaytocleanitisbyusingadrymethod,such
asgoodqualitypapertowelsornylonbrushesdedicatedforthispurpose.
3 ThedrinkcontainersandmixingcontainerMUSTbethoroughlywashedanddisinfectedwith
antibacterialsoapatleaseonceamonthtoensureconsumersafety.
4 Themachinecontainselectricalcomponentsthatmaybefault,likeLED's,itmustbe
changed.
5 Replenishvendingmachineswithchangeandcontrolmoniesandcashlesssystems.
6 Leaveatleast4inches(10cm)ofspacebetweenthebackofthevendorandanywallor
obstructionforpropercirculation.

Page|15

Appendices
AppendixAFluidLevelSensorDatasheet

Page|16

Page|17

Page|18

AppendixBSensitThermocoupleDatasheet

Page|19

Page|20


Page|21

Page|22

AppendixCSchwarzerPrecisionRotaryDiaphragmPumpDatasheet

Page|23

Page|24

Page|25

AppendixDDetailedWiringDiagram

Page|26

AppendixEMicrocontrollerCode

;***********************************************
;Thiscoderepresentsthevendingmachineprocess
;intputs:
;RB0:insertcoin,RB1:capuccino,RB2:coffee,RB3:tea
;RB4:twosugars,RB5:onesugar,RB6:nosugar,RB7:limitswitch,RD5:quantitysensorofcapu(levelsensor)
;RD6:quantitysensorofcoffee(levelsensor),RD7:quantitysensoroftea(levelsensor),RA0:temperaturesensor
;RA3:safetyswitch
;Outputs:
;RD0:(fillingmachine),RD1:CapuccinoLED,RD2:coffeeLED,
;RD3:teaLED,RD4:cupholder,RE0:coinrejection,RE1:Capupump,RE2:coffeepump,RA1:teapump,RA2:sugargate
;*********************************************
include"p16f877a.inc"
;*********************************************
cblock0x20

cost
;thevalueofthecoininserted

Capu_cost

coffee_cost

tea_cost

remaining_balance
;=costtype_cost

counter_1

counter_2
Distance

WTEMP

STATUSTEMP

endc

CBLOCK0X0A0;Reservingspacetosavetheworking

;registerinall4banks

WTEMP1

ENDC

CBLOCK0X120

WTEMP2

ENDC
CBLOCK0X1A0

WTEMP3

ENDC

;MACROASSIGNMENTS
;PUSHMACRO:USEDTOSAVETHEORIGINALVALUESOF
;THEWORKINGANDSTATUSREGISTERS
;POPMACRO:USEDTORETRIEVETHEORIGINALVALUES
;OFTHEWORKINGANDSTATUSREGISTERS
Page|27

;***********************************************
PUSHMACRO

MOVWFWTEMP

SWAPFSTATUS,W

BANKSELSTATUSTEMP

MOVWFSTATUSTEMP

ENDM
POPMACRO

BANKSELSTATUSTEMP

SWAPFSTATUSTEMP,W

MOVWFSTATUS

SWAPFWTEMP,F

SWAPFWTEMP,W

ENDM
;*************************************************
;Startofexecutablecode
Main org0x000

callInitial

MAINLOOP

gotoProcess
GOTOMAINLOOP

;*************************************************
;Interruptvector
org0x0004

gotoISR
;*************************************************

Initial

BankselTRISB

ClrfTRISB

comfTRISB

;defineportBasinput

ClrfTRISA

;defineportAasoutput

bsfTRISA,0

;definebit0asinput

bsfTRISA,3

;definebit3asinputthatrepresentsthesafetyswitch
clrfTRISE

;defineportEasoutput

ClrfTRISD

;defineuppernibbleofportDasoutput&lowernibbleasinput

movlw0x0f

movwfTRISD

ADConverter

movlw b'01000000'

;LeftJustified;RA0analogeinput

movwf ADCON1

bankselPORTA
Page|28


movlw b'00000001'

;SelectsChannel0;w/ADCon

movwf ADCON0

bsfPORTD,1
;thedefaultstateofLEDsistobeON.

bsfPORTD,2

bsfPORTD,3

movlw .255

movwf counter_1

movlw .217

movwf counter_2

movlw.50

movwfCapu_cost

movlw.25

movwfcoffee_cost

movlw.15

movwftea_cost

return
ADC

bsf

ADCON0,GO
wait

btfss PIR1,ADIF

goto wait

bcf
PIR1,ADIF

movf ADRESH,W

movwf Distance

return
Process

btfscPORTB,0

gotochoose_type

GOTOMAINLOOP

choose_type

movfcost,W
;movethevalueofthecoinintotheworkingregister

btfscPORTB,1

gotoquantity_test1
Page|29


btfscPORTB,2

gotoquantity_test2

btfscPORTB,3

gotoquantity_test3

quantity_test1

btfscPORTD,5

gotosugar_amount

bcfPORTD,1

movwfremaining_balance

bsfPORTE,0

GOTOMAINLOOP

quantity_test2

btfscPORTD,6

gotosugar_amount

bcfPORTD,2

movwfremaining_balance

bsfPORTE,0

GOTOMAINLOOP

quantity_test3

btfscPORTD,7

gotosugar_amount

bcfPORTD,3

movwfremaining_balance

bsfPORTE,0

GOTOMAINLOOP

sugar_amount

btfscPORTB,4

gototwo_sugar

btfscPORTB,5

gotoone_sugar

btfscPORTB,6

gotocup_holder

;LEDisoff

;rejectthemoney
;outputthemoney

;restart

;LEDisoff

;rejectthemoney
;outputthemoney

;restart

;LEDisoff

;rejectthemoney
;outputthemoney

;restart

;openthesugargateforaspecifictime
;openthesugargateforhalfthetime

Page|30

movwfremaining_balance

bsfPORTE,0

GOTOMAINLOOP

two_sugar

bsfPORTA,2

calldelay_small

calldelay_small

bcfPORTA,2

gotocup_holder

one_sugar

bsfPORTA,2

calldelay_small

bcfPORTA,2

gotocup_holder

cup_holder

bsfPORTD,4

gotoPump_process

Pump_process

btfscPORTB,1

gotoCapu_pump

btfscPORTB,2

gotocoffee_pump

btfscPORTB,3

gototea_pump

Capu_pump

bsfPORTE,1

calldelay_25s

bcfPORTE,1

gotofilling_machine

coffee_pump

bsfPORTE,2

calldelay_25s

bcfPORTE,2

gotofilling_machine

;rejectthemoney
;outputthemoney

;restart

;pickacupfromcupholder.

;ifuserchoosesCapuccino

;ifuserchoosesCoffee

;ifuserchoosestea

Page|31

tea_pump

bsfPORTA,1

calldelay_25s

bcfPORTA,1

gotofilling_machine

filling_machine

btfssPORTA,0

bsfPORTA,0

btfssPORTB,7

bsfPORTB,7

btfssPORTA,3

bsfPORTA,3

bsfPORTD,0

calldelay_25s

bcfPORTD,0

btfscPORTB,1

gotoCapu_remaining_money

btfscPORTB,2

gotocoffee_remaining_money

btfscPORTB,3

gototea_remaining_money

GOTOMAINLOOP

Capu_remaining_money

subwfCapu_cost

movwfremaining_balance

bsfPORTE,0

GOTOMAINLOOP

coffee_remaining_money

subwfcoffee_cost

movwfremaining_balance

;switchonthetemperaturesensor
;isthelimitswitchon

;isthesafetyswitchon?

;ifuserchoosesCapuccino

;ifuserchoosesCoffee

;ifuserchoosestea

;restart

;w=cost50

;rejectthemoney
;outputthemoney

;restart

;w=cost25

;rejectthemoney
Page|32


bsfPORTE,0

GOTOMAINLOOP

tea_remaining_money

subwftea_cost

movwfremaining_balance

bsfPORTE,0

GOTOMAINLOOP

Delay_Small

nop

nop

nop

nop

nop

nop

nop

nop

nop
nop

nop

nop

nop

nop

nop

decfsz counter_1

goto Delay_Small

goto One_Sec

One_Sec

nop

nop

nop

decfsz counter_2

goto Delay_Small

return

;outputthemoney

;restart

;w=cost15

;rejectthemoney
;outputthemoney

;restart

Page|33

delay_25s

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

callDelay_Small

return

end

Page|34

AppendixFPro/EngineerIllustrations

Figure1VendingMachine(OutsideView)

Figure2VendingMachinew/SafetyDoorOpen

Page|35


Figure3InsideViewofVendingMachine

Figure4VendingMachine(InsideView)

Page|36

References
1. Passeraub,P.A.;Besse,P.A.;deRaad,C.;Dezuari,O.;Quinet,F.;Popovic,R.S.,"Coinrecognition
usinganinductiveproximitysensormicrosystem,"SolidStateSensorsandActuators,1997.
TRANSDUCERS'97Chicago.,1997InternationalConferenceon,vol.1,no.,pp.389392vol.1,16
19Jun1997
URL:http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=613666&isnumber=13397
2. HowStuffWorks,Inc..().HowStuffWorksAutopsy:InsideaVendingMachine.Available:
http://express.howstuffworks.com/autopsyvending.htm.Lastaccessed2May,2009.
3. Nelik,Lev(1999).Centrifugal&RotaryPumps:FundamentalsWithApplications.UnitedStates:
CNCPress.p8081.
4. Wikipediacontributors.(Dateoflastrevision:5May2009).PICmicrocontroller.Available:
http://en.wikipedia.org/w/index.php?title=PIC_microcontroller&oldid=287969291.Last
accessed05May,2009.

Page|37

Você também pode gostar