41
Page | i 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

Coffee&Tea Vending Machine Report

Embed Size (px)

Citation preview

Page 1: Coffee&Tea Vending Machine Report

Page | i   

 

 

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 2: Coffee&Tea Vending Machine Report

Page | i   

Abstract   Over the years, the advancements and applications of mechatronics systems have increased and continue to experience an upward growth. These applications have continued to allow for the automation of mundane operations, whether it be a complex operation, such as arc welding of a automotive chassis or a simple task, such as preparing a cup of tea. The following paper will investigate the operation of such a machine, whose sole task is to dispense a cup of coffee or tea per the user’s request. We will look into the operation of the machine; propose a conceptual design, including hardware and software, as well as sufficient instructions on how to properly operate the system. 

   

Page 3: Coffee&Tea Vending Machine Report

Page | ii   

Table of Contents Abstract .......................................................................................................................................... i 

Introduction ................................................................................................................................... 1 

System Description ........................................................................................................................ 2 

General System Description ................................................................................................................ 2 

System Flow Charts ............................................................................................................................. 3 

Description of System Transducers..................................................................................................... 6 

Coin Detection Transducer ............................................................................................................. 6 

Fluid Level Sensor ........................................................................................................................... 6 

Temperature Sensor ....................................................................................................................... 7 

Safety Limit Switches ...................................................................................................................... 7 

Description of Systems Actuators ....................................................................................................... 8 

Rotary Micro Pump ......................................................................................................................... 8 

DC Mixing Motor ............................................................................................................................. 8 

Selection of Controller ................................................................................................................... 9 

Description of Control Algorithms ................................................................................................. 10 

Vending Machine Safety ............................................................................................................... 12 

Vending Machine Standards ......................................................................................................... 13 

IEC ‐ International Electrotechnical Commission .............................................................................. 13 

IEC 60335‐2‐75 Household and similar electrical appliances ....................................................... 13 

NAMA – National Automatic Merchandising Association ................................................................ 13 

Multi‐Drop Bus / Internal Communication Protocol..................................................................... 13 

User Instructions ........................................................................................................................... 14 

Maintenance Requirements .......................................................................................................... 15 

Appendices ................................................................................................................................... 16 

Appendix A – Fluid Level Sensor Datasheet ...................................................................................... 16 

Appendix B – Sensit Thermocouple Datasheet ................................................................................. 19 

Appendix C – Schwarzer Precision Rotary Diaphragm Pump Datasheet .......................................... 23 

Appendix D – Detailed Wiring Diagram ............................................................................................ 26 

Appendix E –Microcontroller Code ................................................................................................... 27 

Appendix F – Pro/Engineer Illustrations ........................................................................................... 35 

References .................................................................................................................................... 37 

 

   

Page 4: Coffee&Tea Vending Machine Report

Page | iii   

Table of Figures Figure 1 – Vending Machine (Outside View) .................................................................................. 35 Figure 2 – Vending Machine w/ Safety Door Open ........................................................................ 35 Figure 3 – Inside View of Vending Machine ................................................................................... 36 Figure 4 – Vending Machine (Inside View) ..................................................................................... 36  

Page 5: Coffee&Tea Vending Machine Report

Page | 1  

Introduction   Coffee and Tea vending machines, like most other vending machines, are a great example of mechatronics systems. They seamlessly incorporate sensor networks, include one or more microcontrollers, some sort of actuation, be it linear or rotational, as well as contain the ability to interact with the outside world. The origin of vending machines, which are detailed in [1] and are not the focus of this paper has been traced back to the early 1880s and has continued to evolve to this day. The concepts of the vending machines have been used in a wide range of products, such as newspaper dispensers, drinks and snacks, as well as slot machines, which utilize many similar technologies as vending machines. 

The main idea behind a coffee and tea vending machine is to offer piping hot coffee or tea, or any other liquid drink for that matter, at the touch of a button without the need to manually prepare the drink. The vending machine itself usually contains one or more insulated containers to hold the drink of choice. Furthermore, each container has its own independent electric heating element which can either be used to maintain the temperature of the drink all day or to instantly heat the drink upon order.  

  In addition to this, numerous safety features are built into the system to ensure that the hot drink is not dispensed in the absence of a cup and may also contain some sort of safety mechanism which prevents the user from accessing the dispensing area if the hot drink is being dispensed to prevent any harm.  

   

Page 6: Coffee&Tea Vending Machine Report

Page | 2   

System Description 

General System Description   As indicated by the title, this section will focus on the general workings of the vending machine design as proposed by this paper. The vending machine, as designed, will only accept coins of certain denominations, which include the 5, 10, 25 and 50 piaster coins. Upon inserting the coin(s) into the system, the user is then instructed to select the drink of his choice by pressing one of the three buttons available on the left side of the front face of the machine. Once the user selects his/her desired drink, the system then checks to ensure that there is enough of that drink, be it coffee, tea, etc. If there is in fact sufficient quantity to fulfill the request, the user is then prompted to select the amount of sugar. The system has three sugar settings, either “No Sugar”, “One Sugar” or “Two Sugars”. In the event that there is insufficient quantity of the selected drink, the user is the informed that “The Option is Not Available” and prompted to select another drink. 

  Assuming the drink is available, and the amount of sugar is selected, the appropriate amount of the drink is pumped into the mixing chamber. The amount of liquid, which is equal to the volume of the cup, is determined by multiplying the volumetric flow rate of the pump used by the amount of time the pump is turned on ;. At the same time, the sugar requested by the user is also placed into the mixing chamber. At this point the mixing chamber is violently shaken back and forth in order to completely mix the sugar into the drink. 

  While the drink is being prepared, a Styrofoam cup is released from the cup dispenser. The user is then prompted to place the cup directly underneath the spout of the vending machine. Two limit switches will ensure that the cup is properly placed resting on the platform as well as located directly underneath the spout. This ensures that the user has removed his hands from the vicinity of the hot drink as well as ensuring that all of the dispensed drink will be pumped into the cup and not spill. A further limit switch will be employed to monitor the status of the guard screen, which must be shut for the drink to dispense. The role of the guard screen is explained in detail in the section titled “Vending Machine Safety”. 

  Once the mixing chamber has been agitated for a certain amount of time, and the cup is properly placed in position, the opening of the mixing chamber is released and the drink is emptied into the cup. At this point, if the user did not enter the exact amount of change, his remaining balance is calculated and returned to him via the change collector. This marks the end of the user’s transaction and the machine prepares itself for another request.  

   

Page 7: Coffee&Tea Vending Machine Report

Page | 3   

System Flow Charts 

    

Page 8: Coffee&Tea Vending Machine Report

Page | 4   

    

Page 9: Coffee&Tea Vending Machine Report

Page | 5   

    

Page 10: Coffee&Tea Vending Machine Report

Page | 6   

Description of System Transducers   A vending machine, especially one which distributes drinks, relies heavily on a wide range of transducers to function properly. The reason for this is the fact that there are numerous parameters, such as fluid height and drink temperature, which must be measured and/or maintained at a certain level. In this section we will discuss the numerous transducers used in the proposed design as well as a brief description of their theory of operation. 

Coin Detection Transducer   The first transducer we will discuss is chronologically the first transducer used in the machine, and that is the coin detection transducer. In our system we will utilize an inductive coin sensor to help the system distinguish between different coin denominations, the second benefit of using an inductive coin sensor is that it provides the system with the ability to detect and reject fake coins. The basis of this sensor is built on the idea that each coin denomination has its own diameter, thickness, and metallic composition. These properties provide for an ideal use of a magnetic pick up coil, such as a fluxgate magnetometer, which is capable of detecting variations in magnetic fields.  

Now, as described in [1] and [2], the presence of a certain coin will affect a magnetic field in such a manner that is unique to that denomination, which means that a 5 piaster coin will affect a magnetic field differently, then a 10 piaster, 25 piaster or a 50 piaster coin. This difference in magnetic field is directly related to the coin’s thickness, diameter, and metallic composition. The difference in magnetic field is then sensed by the magnetic pick‐up coil, conditioned and compared to stored values. If the variation in magnetic field does not have a corresponding stored value in the vending machine’s controller, then the coin is deemed fake and rejected. Further information on the signal conditioning circuit is described in [1] but is outside the scope of this paper. 

Fluid Level Sensor   The next transducer which will be discussed is the fluid level transducer. Once the user has inserted the appropriate amount of change, he is prompted by the system to select his/her drink of choice. Once the user has selected his/her drink of choice the system must check to see if there is a sufficient amount of that drink left. In order to do this we will use Honeywell’s LLE Series Liquid Level Switch. This transducer utilizes optical technology to accurately measure for the presence of liquid. This works by emitting a light from an LED onto a plastic dome. When no liquid is present, this light is reflected back onto a photo‐transistor providing a logic 1 signal. When the liquid covers the dome the amount of light which is reflected back to the photo‐transistor is reduced, causing the output to switch to logic 0. 

  One benefit of this sensor is that it provides precise and repeatable switching point, which allows for accurate and reliable use. Furthermore, as the sensor is microprocessor compatible, it allows for easy interface with the PIC microcontroller. 

   

Page 11: Coffee&Tea Vending Machine Report

Page | 7   

Temperature Sensor   The third sensor which will be discussed is the fluid temperature sensor. This sensor is of great importance as the whole basis of our vending machine is to be able to provide a selection of hot drinks at the press of a button. This sensor will be placed in the mixing container which is responsible for mixing the sugar into the customers drink prior to serving. The mixing container also contains an electric heating element which will be used to heat the liquid. To achieve this, we will use Sensit’s K‐type thermocouple to facilitate quick and accurate measurement of the drink’s temperature. As the temperature range of the sensor is from ‐30°C ‐ 150°C it is more then suitable to measure the maximum temperature of the drink, which will be limited to 90°C, which will ensure customer satisfaction and more importantly customer safety.  

  Since the accuracy of the fluid is not of grave importance, the sensor and the heating element will be connected via a P controller circuit. This will allow the heating element to maintain the temperature while limiting the overshoot to an acceptable value. For more information regarding the sensor, refer to appendix B for the sensor’s data sheet. 

Safety Limit Switches   The final sensor we will utilize in our system is a pair of limit switches. The first limit switch will be placed on the base of the vending machine directly beneath the delivery spout. The second limit switch will be placed on the glass door stopper. These two limit switches will ensure that the drink is not delivered to the cup unless the cup is placed directly beneath the delivery spout and the customer has removed his hands from the delivery compartment. This will guarantee the coffee is delivered to the cup and in the event that splashing occurs, none of the hot drink comes in contact with the customer, avoiding any possible injury. More information regarding the safety features of the proposed vending machine design is available in the Vending Machine Safety section. 

   

Page 12: Coffee&Tea Vending Machine Report

Page | 8   

Description of Systems Actuators 

Rotary Micro Pump   The coffee machine system relies heavily on actuators, as well as sensors, to achieve its goal of delivering hot coffee at the press of a button. The proposed design will rely mainly on two actuators, both of which are rotary. The first, and most evident, is a centrifugal pump, which will be responsible for transporting the drink of choice from their respective containers to the mixing chamber. The centrifugal pump used is a Schwarzer Precision rotary diaphragm pump, which supplies a flow rate of 600 mL/min which is ideal for our application as the cup holds 0.31 L of fluid. As such, simple calculation will show that the pump will be on for exactly 25 seconds in order to fill the cup to an acceptable level, while leaving enough room in the cup to prevent spilling during handling.  

  The operation of rotary diaphragm pumps is similar to vane pumps, in the sense that they rely on an eccentric shaft to actuate the suction of the fluid. According to [3], a rotary diaphragm pumps is comprised of a diaphragm actuated by a shaft or eccentric cam. It is designed such that the diaphragm changes the volume of the chamber during rotation which creates alternate suction and pressure conditions in the chamber which eventually causes flow. More information on the selected pump can be found in Appendix C. 

DC Mixing Motor   The second actuator in the proposed vending machine design is a DC motor, which will be responsible for mixing the desired drink and the sugar together. We have decided on the use of a DC motor, as opposed to a stepper motor, because the application does not require any form of accurate positioning. The motor will have a propeller attached to the end of its shaft which will mix the sugar and drink mixture for a specified time, ensuring that the sugar has fully dissolved, thus ensuring customer satisfaction. Since the performance of DC motors are well known, we will not expand on the theory of operation in this paper. 

   

Page 13: Coffee&Tea Vending Machine Report

Page | 9   

Selection of Controller   In the design proposed by this paper, we have decided to control the machine using a microcontroller based system. This decision was based on the fact that production of these vending machines would be on a large scale, thus making dedicated microcontrollers a much more viable option when compared to PLCs. Furthermore, as the system is designed to be small, a PC and/or laptop would not be feasible, neither from a cost point‐of‐view nor from a size point‐of‐view.  

  Furthermore, the fact that a microcontroller has a greater ability to handle signal conditioning better then a PLC is a great advantage, since the coin sensor will need some form of A/D conversion along with signal processing to determine the value of the coin inserted by the user. As the microcontroller of choice is the Microchip PIC 16F877, a description of their A/D module, as found in [4], is given below. Also the aforementioned characteristics can be summarized in the following table. 

The Analogue‐to‐Digital (A/D) Converter module has eight inputs for the PIC 16F877. The conversion of an analogue input signal results in a corresponding 10‐bit digital number. The A/D module has high and low‐voltage reference input that is software selectable to some combination of VDD, VSS, RA2 or RA3. The A/D converter has a unique feature of being able to operate while the device is in Sleep mode. To operate in Sleep, the A/D clock must be derived from the A/D’s internal RC oscillator [4]. 

  Number of Products to be Manufactured 

Signal Processing Capability 

Speed  Cost 

Microcontroller  High  Medium  High  Low 

PLC  Medium  Low  Low  Medium 

PC/laptop  Low  High  Medium  High 

  

   

Page 14: Coffee&Tea Vending Machine Report

Page | 10   

Description of Control Algorithms   In designing the proposed vending machine, there were many aspects of the machine that required a form of control to ensure the required operation. As such we have employed two methods of control in our system, On/Off control and proportional (P) control. The following table illustrates the different areas of use. 

Component  Control algorithm  Description 

Push buttons  ON/OFF  Selecting the drink 

Pump  ON/OFF  Pump the drink for a pre‐specified period of time 

Stirrer  ON/OFF  Shake the fluid for a pre‐specified period of time 

Limit switches  ON/OFF  Safety purposes 

Fluid level sensing  ON/OFF  Indicates if there is enough drinks in the tanks 

Cup dispenser  ON/OFF  Releasing a cup while the drink is being prepared 

Mixing chamber to cup dispenser 

ON/OFF  Releasing finished drink by the means of gravity to the cup 

Heater   Proportional  Negative feedback from the temperature sensor. Heating will be corresponding to the difference (error) between the actual and the desired water temperature to maintain the desired warmness of the fluids 

 Proportional Control 

  In this mode of control the actual value of the variable to be controlled is subtracted from the desired value. The result is multiplied by the proportional constant (sometimes called the gain) and sent to the output of the controller. This method ensures that the response of the controller is increased when the error increases. Also note that this method does not have any memory (i.e., there is no need to remember the last output of the controller in the last update). The main disadvantage of the proportional control is that it cannot eliminate the steady state error (it can only reduce it). Increasing the value of the proportional constant will improve the speed of response and reduce the steady state error (but cannot eliminate it). However, this could lead to overshooting of the system or even oscillation in certain cases [2]. 

   

Page 15: Coffee&Tea Vending Machine Report

Page | 11   

Proportional Control Theory  

  In the proportional control algorithm, the controller output is directly proportional to the error signal, which is the difference between the set point and the process variable. In other words, the output of a proportional controller is the multiplication product of the error signal and the proportional gain. 

This can be mathematically expressed as 

 

Where: 

Pout: Output of the proportional controller  

Kp: Proportional gain  

e(t): Instantaneous process error at time 't'. e(t) = SP − PV  

SP: Set point  

PV: Process variable  

   

Page 16: Coffee&Tea Vending Machine Report

Page | 12   

Vending Machine Safety   As with any device which involves a human‐machine interaction, there lies a risk of danger. This is due to the reason that most machines, with the exception of AI machines, are programmed to react/interact in accordance with specific inputs. When these inputs are active, the machine will react accordingly regardless of external states. The possibility of danger, or hazard risk, is not specific only to large scale, complex systems but is also available on small systems such as a coffee & tea vending machine. 

  The hazard risk in out machine comes as a result of having human interaction with steaming hot liquids, such as coffee. There have been reports that coffee served at certain fast food restaurants, which utilize coffee vending machines, caused second‐degree burns when the coffee was spilled on bare skin.  Further hazards stem from the fact that we are dealing with food items, which are consumed by humans. This means that the system must be hygienically cleans, without the possibility of rust on any metallic components which come in contact with the liquid. Furthermore, special care must be taken to ensure that the mixing chamber, as well as the cup dispenser, is periodically cleaned to remove any bacteria. 

  In order to minimize the risk in our machine, we will first address the risk of burn when the drink is being dispensed. This will be achieved through the use of a guard screen. The guard screen is simple a sliding fiberglass door which slides up and down to allow access to the dispensing area. In order for the drink to dispense the screen must be completely shut, as previously noted. This ensures that during the delivery of the drink there is no chance of harm in the even of spillage.  

  The second hazard, the health risk, will be implemented via scheduled maintenance by the machine owner. This will include the removal of the mixing chamber as well as the three drink containers, thoroughly washing and disinfecting them and returning them at regular intervals. This more then ensures that the containers remain free of bacteria and other harmful germs. 

   

Page 17: Coffee&Tea Vending Machine Report

Page | 13   

Vending Machine Standards The Following are a couple of standards which apply to vending machines. 

IEC ­ International Electrotechnical Commission 

IEC 60335­2­75 Household and similar electrical appliances   This International Standard deals with the safety of electric commercial dispensing appliances and vending machines for preparation or delivery of food, drinks and consumer products, their rated voltage being not more than 250 V for single‐phase appliances and 480 V for other appliances. 

Appliances that are within the scope of this standard are: 

• bulk tea or coffee brewing machines; 

• cigarette vending machines; 

• coffee grinders 

• commercial liquid heaters; 

• espresso coffee appliances; 

• hot and cold beverage vending machines; 

• hot water dispensers; 

• ice cream and whipped cream dispensers; 

• ice dispensers; 

• newspaper, audio or video tape or disc vending machines; 

• packaged food and drink vending machines; 

• refrigerated merchandisers 

This standard also deals with the hygiene aspects of appliances. As far as is practicable, this standard deals with the common hazards presented by appliances that are encountered by users and maintenance persons. However, in general, it does not take into account young children playing with the appliance. 

NAMA – National Automatic Merchandising Association  

Multi­Drop Bus / Internal Communication Protocol The Multi‐Drop Bus/Internal Communication Protocol is an Interface Standard that allows the various components of a vending machine to communicate to the Vending Machine Controller. It is a way for the Electronic Controller to learn what coins were accepted by the Coin Changer, what bills were accepted by the Bill Acceptor, and how much credit is available through the Card Reader. It is a way for the Controller to “tell” the Coin Changer how much change to pay out or to “tell” the card reader how much credit to return to the card. There are other devices the Controller can communicate to through this interface and, the option for even additional devices exists for the future. 

MDB is utilized in Vending machines to connect the Bill Acceptors and Coin Changer mechanisms. This evolved as the standard in vending machines after 1995. 

 

Page 18: Coffee&Tea Vending Machine Report

Page | 14   

User Instructions In order to inform the user of the vending machine how to use it, then it's required to put the instructions on front of the body of the machine, and it's contain the following: 

o  Tea cost is   0.15 JD o Coffee cost is   0.25 JD o Cappuccino cost is   0.5 JD 

Machine Operation Instructions: 1‐ Put the money on the coin entrance 2‐ Press the required drink 3‐ Press the required amount of sugar 4‐ Take the cup, and put it in its place 5‐ Close the door.

*Put a warning label:  "DO NOT ROCK OR TILT MAY CAUSE SERIOUS INJURY OR DEATH. 

 

  

Page 19: Coffee&Tea Vending Machine Report

Page | 15   

Maintenance Requirements Maintenance operation is needed in most machines, and the Maintenance operations required in the vending machine is the following: 

1‐ The machine has to be refilled with drinks when it's empty. 

2‐ The machine maybe placed outside, the safest way to clean it is by using a dry method, such as good quality paper towels or nylon brushes dedicated for this purpose. 

3‐ The drink containers and mixing container MUST be thoroughly washed and disinfected with anti‐bacterial soap at lease once a month to ensure consumer safety. 

4‐ The machine contains electrical components that may be fault, like LED's, it must be changed. 

5‐ Replenish vending machines with change and control monies and cashless systems. 

6‐ Leave at least 4 inches (10 cm) of space between the back of the vendor and any wall or obstruction for proper circulation. 

Page 20: Coffee&Tea Vending Machine Report

Page | 16  

Appendices 

Appendix A – Fluid Level Sensor Datasheet 

 

Page 21: Coffee&Tea Vending Machine Report

Page | 17   

 

   

Page 22: Coffee&Tea Vending Machine Report

Page | 18   

 

   

Page 23: Coffee&Tea Vending Machine Report

Page | 19   

Appendix B – Sensit Thermocouple Datasheet 

 

Page 24: Coffee&Tea Vending Machine Report

Page | 20   

Page 25: Coffee&Tea Vending Machine Report

Page | 21   

 

Page 26: Coffee&Tea Vending Machine Report

Page | 22   

 

Page 27: Coffee&Tea Vending Machine Report

Page | 23   

Appendix C – Schwarzer Precision Rotary Diaphragm Pump Datasheet 

 

Page 28: Coffee&Tea Vending Machine Report

Page | 24   

Page 29: Coffee&Tea Vending Machine Report

Page | 25   

Page 30: Coffee&Tea Vending Machine Report

Page | 26  

Appendix D – Detailed Wiring Diagram 

Page 31: Coffee&Tea Vending Machine Report

Page | 27  

Appendix E –Microcontroller Code  

;*********************************************** ;This code represents the vending machine process ;intputs: ;RB0: insert coin, RB1:capuccino, RB2:coffee, RB3:tea ;RB4:two sugars, RB5:one sugar, RB6:no sugar,RB7: limit switch, RD5:quantity sensor of capu(level sensor) ;RD6:quantity sensor of coffee(level sensor), RD7:quantity sensor of tea(level sensor),RA0:temperature sensor ;RA3:safety switch ; Outputs: ; RD0:(filling machine),RD1:Capuccino LED,RD2:coffee LED, ; RD3:tea LED, RD4:cup holder, RE0:coin rejection,RE1:Capu pump,RE2:coffee pump,RA1:tea pump,RA2:sugar gate ;********************************************* include "p16f877a.inc" ;********************************************* cblock 0x20      cost    ; the value of the coin inserted   Capu_cost   coffee_cost   tea_cost   remaining_balance  ;=cost‐type_cost   counter_1      counter_2         Distance   WTEMP   STATUSTEMP          endc  CBLOCK 0X0A0  ; Reserving space to save the working        ;register in all 4 banks   WTEMP1     ENDC       CBLOCK 0X120   WTEMP2    ENDC CBLOCK 0X1A0   WTEMP3    ENDC   ; MACRO ASSIGNMENTS  ; PUSH MACRO: USED TO SAVE THE ORIGINAL VALUES OF  ; THE WORKING AND STATUS REGISTERS  ; POP MACRO: USED TO RETRIEVE THE ORIGINAL VALUES   ;OF THE WORKING AND STATUS REGISTERS 

Page 32: Coffee&Tea Vending Machine Report

Page | 28   

 ;*********************************************** PUSH MACRO   MOVWF WTEMP   SWAPF STATUS,W    BANKSEL STATUSTEMP    MOVWF STATUSTEMP    ENDM POP MACRO   BANKSEL STATUSTEMP   SWAPF STATUSTEMP,W   MOVWF STATUS   SWAPF WTEMP,F   SWAPF WTEMP,W   ENDM ;************************************************* ; Start of executable code Main  org 0x000   call Initial  MAINLOOP   goto Process   GOTO MAINLOOP  ;************************************************* ; Interrupt vector   org 0x0004   goto ISR ;*************************************************  Initial   Banksel TRISB          Clrf TRISB   comf TRISB    ;define portB as input   Clrf TRISA    ;define portA as output   bsf TRISA,0    ;define bit0 as input   bsf TRISA,3    ;define bit3 as input that represents the safety switch   clrf TRISE    ;define portE as output      Clrf TRISD    ;define upper nibble of portD as output & lower nibble as input     movlw 0x0f   movwf TRISD     ADConverter   movlw  b'01000000'        ;Left Justified;RA0 analoge input   movwf  ADCON1   banksel PORTA 

Page 33: Coffee&Tea Vending Machine Report

Page | 29   

  movlw  b'00000001'        ;Selects Channel 0; w/ ADC on   movwf  ADCON0       bsf PORTD,1    ; the default state of LEDs is to be ON.   bsf PORTD,2   bsf PORTD,3                movlw  .255   movwf  counter_1        movlw  .217   movwf  counter_2       movlw   .50   movwf  Capu_cost      movlw   .25   movwf  coffee_cost      movlw   .15   movwf  tea_cost      return ADC   bsf    ADCON0,GO wait   btfss  PIR1,ADIF   goto  wait   bcf  PIR1,ADIF   movf  ADRESH,W   movwf  Distance      return Process   btfsc  PORTB,0   goto choose_type   GOTO MAINLOOP  choose_type   movf cost,W    ; move the value of the coin into the working register   btfsc PORTB,1   goto quantity_test1 

Page 34: Coffee&Tea Vending Machine Report

Page | 30   

  btfsc PORTB,2   goto quantity_test2   btfsc PORTB,3   goto quantity_test3  quantity_test1   btfsc PORTD,5   goto sugar_amount      bcf PORTD,1      ; LED is off         movwf remaining_balance    ;reject the money   bsf PORTE,0      ;output the money      GOTO MAINLOOP      ;restart  quantity_test2   btfsc PORTD,6   goto sugar_amount      bcf PORTD,2      ; LED is off      movwf remaining_balance    ;reject the money   bsf PORTE,0      ;output the money      GOTO MAINLOOP      ;restart     quantity_test3   btfsc PORTD,7   goto sugar_amount   bcf PORTD,3      ; LED is off      movwf remaining_balance    ;reject the money   bsf PORTE,0      ;output the money      GOTO MAINLOOP      ; restart    sugar_amount   btfsc PORTB,4   goto two_sugar     ;open the sugar gate for a specific time      btfsc PORTB,5      ;open the sugar gate for half the time   goto one_sugar    btfsc PORTB,6   goto cup_holder 

Page 35: Coffee&Tea Vending Machine Report

Page | 31   

     movwf remaining_balance    ;reject the money   bsf PORTE,0      ;output the money      GOTO MAINLOOP      ;restart two_sugar   bsf PORTA,2   call delay_small   call delay_small   bcf PORTA,2   goto cup_holder    one_sugar   bsf PORTA,2   call delay_small   bcf PORTA,2   goto cup_holder  cup_holder   bsf PORTD,4      ;pick a cup from cup holder.   goto Pump_process  Pump_process   btfsc PORTB,1      ;if user chooses Capuccino   goto Capu_pump      btfsc PORTB,2      ;if user chooses Coffee   goto coffee_pump      btfsc PORTB,3      ;if user chooses tea   goto tea_pump    Capu_pump         bsf PORTE,1   call delay_25s   bcf PORTE,1   goto filling_machine  coffee_pump         bsf PORTE,2   call delay_25s   bcf PORTE,2   goto filling_machine  

Page 36: Coffee&Tea Vending Machine Report

Page | 32   

tea_pump         bsf PORTA,1   call delay_25s   bcf PORTA,1   goto filling_machine    filling_machine     btfss PORTA,0      ;switch on the temperature sensor   bsf PORTA,0   btfss PORTB,7      ;is the limit switch on    bsf PORTB,7      btfss PORTA,3      ;is the safety switch on?    bsf PORTA,3   bsf PORTD,0   call delay_25s   bcf PORTD,0      btfsc PORTB,1      ;if user chooses Capuccino   goto Capu_remaining_money      btfsc PORTB,2      ;if user chooses Coffee   goto coffee_remaining_money      btfsc PORTB,3      ;if user chooses tea   goto tea_remaining_money          GOTO MAINLOOP      ;restart  Capu_remaining_money      subwf Capu_cost      ; w=cost‐50      movwf remaining_balance    ;reject the money   bsf PORTE,0      ;output the money      GOTO MAINLOOP      ;restart         coffee_remaining_money      subwf coffee_cost    ; w=cost‐25      movwf remaining_balance    ;reject the money 

Page 37: Coffee&Tea Vending Machine Report

Page | 33   

  bsf PORTE,0      ;output the money      GOTO MAINLOOP      ;restart         tea_remaining_money      subwf tea_cost      ; w=cost‐15      movwf remaining_balance    ;reject the money   bsf PORTE,0      ;output the money      GOTO MAINLOOP      ;restart         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       

Page 38: Coffee&Tea Vending Machine Report

Page | 34   

delay_25s   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small   call Delay_Small      return   end   

    

Page 39: Coffee&Tea Vending Machine Report

Page | 35   

Appendix F – Pro/Engineer Illustrations 

 Figure 1 – Vending Machine (Outside View) 

 Figure 2 – Vending Machine w/ Safety Door Open 

 

Page 40: Coffee&Tea Vending Machine Report

Page | 36   

 Figure 3 – Inside View of Vending Machine 

 

 

Figure 4 – Vending Machine (Inside View) 

 

Page 41: Coffee&Tea Vending Machine Report

Page | 37  

References 1. Passeraub, P.A.; Besse, P.‐A.; de Raad, C.; Dezuari, O.; Quinet, F.; Popovic, R.S., "Coin recognition 

using an inductive proximity sensor microsystem ," Solid State Sensors and Actuators, 1997. TRANSDUCERS '97 Chicago., 1997 International Conference on , vol.1, no., pp.389‐392 vol.1, 16‐19 Jun 1997 URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=613666&isnumber=13397 

2. How Stuff Works, Inc.. ( ). HowStuffWorks Autopsy: Inside a Vending Machine. Available: http://express.howstuffworks.com/autopsy‐vending.htm. Last accessed 2 May, 2009. 

3. Nelik, Lev (1999). Centrifugal & Rotary Pumps: Fundamentals With Applications. United States: CNC Press. p 80‐81. 

4. Wikipedia contributors. (Date of last revision: 5 May 2009). PIC microcontroller. Available: http://en.wikipedia.org/w/index.php?title=PIC_microcontroller&oldid=287969291. Last accessed 05 May, 2009.