Final Design Paper Automated Beverage Dispenser ECE 4007 Senior Design Project Section L04, Keezer Mike Fojas Katrina Kumm Nick Migliaccio Mark Peterson Nick White Submitted April 30, 2009 TABLE OF CONTENTS Executive Summary.................................................................................................................iv 1. Introduction......................................................................................................................... 1 1.1 Objective......................................................................................................................... 1 1.2 Motivation....................................................................................................................... 2 1.3 Background..................................................................................................................... 2 2. Project Description and Goals ............................................................................................ 3 3. Technical Specifications...................................................................................................... 5 3.1 Hardware......................................................................................................................... 5 3.2 Software.......................................................................................................................... 5 4. Design Approach and Details ............................................................................................. 6 4.1 4.2 4.2 4.3 Design Approach............................................................................................................ 6 Design Details ................................................................................................................ 9 Codes and Standards .................................................................................................... 16 Constraints, Alternatives, and Tradeoffs ....................................................................... 17 5. Schedule, Tasks, and Milestones....................................................................................... 17 6. Project Demonstration ...................................................................................................... 19 7. Marketing and Cost Analysis ........................................................................................... 19 7.1 7.2 Marketing Analysis ...................................................................................................... 19 Cost Analysis ............................................................................................................... 20 8. Summary ........................................................................................................................... 22 9. References.......................................................................................................................... 23 Appendix A ............................................................................................................................. 25 Appendix B.............................................................................................................................. 27 Appendix C ............................................................................................................................. 28 Appendix D ............................................................................................................................. 29 Automated Beverage Dispenser (ECE4007L04) ii Appendix E.............................................................................................................................. 30 Appendix F.............................................................................................................................. 31 Appendix G ............................................................................................................................. 32 Appendix H ............................................................................................................................. 33 Appendix I............................................................................................................................... 34 Appendix J .............................................................................................................................. 35 Appendix K ............................................................................................................................. 36 Appendix L.............................................................................................................................. 37 Appendix M............................................................................................................................. 38 Appendix N ............................................................................................................................. 39 Appendix O ............................................................................................................................. 40 Appendix P.............................................................................................................................. 41 Appendix Q ............................................................................................................................. 42 Appendix R ............................................................................................................................. 55 Appendix S .............................................................................................................................. 56 Appendix T.............................................................................................................................. 57 Appendix U ............................................................................................................................. 58 Appendix V ............................................................................................................................. 59 Appendix W ............................................................................................................................ 60 Appendix X ............................................................................................................................. 61 Appendix Y ............................................................................................................................. 62 Automated Beverage Dispenser (ECE4007L04) iii EXECUTIVE SUMMARY The Automated Beverage Dispenser (ABD) is a machine that allows restaurants and bars to cost-effectively and efficiently dispense mixed drinks for their customers without additional personnel. A touch screen computer allows the user, a waiter or bartender, to input a desired drink and the ABD will dispense the specified amounts of liquid that make up the drink recipe. Using the device will allow waiters or bartenders to remotely places 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. Also, the ABD controls employee cost by allowing current staff to place orders without additional bartenders working. The ABD consists of a touch screen programmable logic computer (PLC), an I/O block, a relay control circuit board, power supply, receptacles, pumps solenoid valves and coils, and liquid containers. The PLC sends control signals to the I/O block. From there, the control signals are dispersed to the relay circuit board to power the outlets and the solenoid valves to open them. The relay board and the outlets where the simplest way to control and AC powered pump with a DC control signal. The pumps and coils turn on and open in synchronous to dispense the specified amounts of liquids. The PLC, I/O block, power supply, and relay circuit board are contained in one housing unit. On the side of the control housing unit, the receptacles are mounted. The pumps, valves, coils and liquid containers are in another housing unit. The two are connected by a bundle of control wires. The unit will cost approximately $3,000 base price. The outcome at the end of the specified design period was a working prototype. Automated Beverage Dispenser (ECE4007L04) iv AUTOMATED BEVERAGE DISPENSER 1. INTRODUCTION Restaurant and bar businesses are always looking for ways to reduce cost and increase efficiency. One way to achieve both is to reduce human error and human cost. The Automated Beverage Dispenser (ABD) is a product that can assist chain restaurants and bars to achieve both efficiency and cost effectiveness when dispensing drinks. The ABD design provides restaurants and bars with a machine that will precisely dispense mixed drinks also while reducing the required human labor to perform it. 1.1 Objective The purpose of the ABD is to expedite the mixing and serving of drinks at restaurants and bars. The ABD was engineered with three main systems in consideration: the control system, the dispensing system and the memory allocation system. The control system consists of the programmable logic computer (PLC), the I/O block, relay circuit and the receptacles. The dispensing system consists of the pumps, solenoid coils, valves, and the liquid containers. Finally, the memory allocation system consists of the PLC, and the software designed with Automation Studio. All of these components together allow a user to make a mixed drink without ever touching a bottle. The product size is approximately 1’L x 1.5’H x 2’W allowing the unit to fit easily under the bar. The allocated memory can hold up to 20 recipes. Each recipe is allowed a maximum of five different ingredients, which is the total number of liquid containers in the dispensing unit. Each container can hold up to 64 ounces of fluid. The dispensing rate for each pump is 0.85 ounces per second, allowing a 12 ounce drink to be made in 14.04 seconds. The accuracy of the Automated Beverage Dispenser (ECE4007L04) 1 desired amount compared to the actual amount is +/- 2%. All of the technical specifications determined during the design process were met and even exceeded. 1.2 Motivation In most restaurants that contain bars, the bartenders are responsible for filling orders of not only the customers at the bar, but also those seated elsewhere in the restaurant. On nights that the restaurant is very busy, the only current solution is to hire more staff to assist the bartender in making drinks. No commercially available product exists to automatically mix, dispense, and serve drinks. However, products do exist to automatically mix drinks, such as the Computerized Liquor Control System (CLCS) by Easybar [1]. The CLCS looks similar to a soda gun and mixes correctly proportional drinks at the touch of a button. However, unlike the ABD, it only mixes the drinks it does not dispense or serve it without the bartender’s involvement. Also, because the bartender dispenses the drink, he can give a customer a 12 ounce drink for the 6 ounce price or give it for free. The ABD would allow the waiters or bartender to input the ordered drink and serve it without having to mix and pour the required liquids. Also, the ABD assists in liquid control by dispensing the precise amounts and portions of the liquids. By controlling the liquid dispensing, product costs are reduced, allowing the restaurant to increase cost to profit ratios on each drink sold. Also, labor costs are reduced because the extra employees are not required. 1.3 Background Although there are no products currently commercially available that have all the features of the ABD, there are several products similar to it. One example is the I-Matic Dispenser series by Auper [2]. Auper is a electronic controls company out of Montreal, Canada. Auper specializes in electronic controls specifically for alcoholic beverages. The I-Matic series Automated Beverage Dispenser (ECE4007L04) 2 dispenses portioned amounts of beer or wine with a touch of a button. The bartender pushes the pour size of his or her choice. The glass then fills to the specified amount. The I-Matic allows for beer or wine to be poured hands free while allowing the bartender to increase service speed. As mentioned previously, the CLCS is quite similar to the ABD. Easybar is a company that specializes in beverage management systems. They are located in Tualatin, Oregon. The CLCS looks similar to a soda gun. Each gun allows up to 16 different recipes or single liquids to be programmed into the system’s control center. Each recipe is allowed to have up to five ingredients. The main system control center can control up to a total of 128 brands of liquor and multiple guns. Like the I-Matic system, only the bartenders can dispense the drinks and are still responsible for the entire restaurant or bar. 2. PROJECT DESCRIPTION AND GOALS The goal of the ABD project is to completely automate the process of beverage mixing and dispensing. The target market for the ABD will be restaurants and bars because no commercial product is currently available with all the features. The target price is $4,000, so it becomes a reasonable investment for the overall cost reduction and increase in efficiency. The ABD is made up of three separate systems; the memory allocation system, the controller, and the dispenser. Each system has its own objective and target specifications. Controller The controller was engineered with the following goals: Easy-to-use interface with touch screen and menu system Display drink list Display recipe list Automated Beverage Dispenser (ECE4007L04) 3 Display recipe details Help menu Home screen Configuration and setup assistance of unit Dispenser The dispenser was engineered with the following goals: Make a drink with user-defined recipe Control amount of dispensed liquids Keep track of levels of liquids and alert when running low Memory Allocation The memory allocation system was engineered with the following goals: Add or remove an available liquid in the memory Add or remove recipe in the memory Change the contents of a recipe in the memory Automated Beverage Dispenser (ECE4007L04) 4 3. TECHNICAL SPECIFICATIONS 3.1 Software Table 1. Proposed Versus Implemented Software Features Attribute / Feature Touch Screen Navigated User Interface Database of Recipes and Liquids Statically Allocated Memory of Recipes and Liquids Add / Remove / Modify Liquids by Manipulating Statically Allocated Memory Add / Remove / Modify Recipes by Manipulating Statically Allocated Memory Help Menu Home Screen Display Recipes / Liquids List Display Recipe / Liquid Details (picture, rating, etc.) Navigation Buttons (home, next, back, etc.) Configuration / Setup Menu Visual Liquid Level Reading in Setup Menu Software-Controller I/O Signals Make Recipe Button / Menu Proposed Feature X X Implemented Feature X X X X X X X X X X X X X X X X X X X X X X X Appendix A contains further information about software features described in Table 1. The vast majority of proposed software features were implemented; however, a dynamically allocated database was not used to manage recipes and liquids. Instead, memory was allocated statically for a set number of recipes and liquids. 3.2 Hardware The hardware system is divided into two separate units: a dispensing unit and a control unit. The dispensing unit contains the fluid pumps, coils, valves, and liquid containers. The control unit is separate from the dispensing unit, and houses the B&R Power Panel, relay board, B&R I/O Module, and receptacles and 24 VDC power supply. This design allows as much of Automated Beverage Dispenser (ECE4007L04) 5 the electrical portion of the machine to be positioned far away from the fluids. The technical capabilities are shown in Table 2. Table 2. Automated Beverage Dispenser technical specifications. Description Recipes Ingredients Per Recipe Ingredients (Liquids) Dispensing Rate Container Capacity Dispensing Accuracy Concurrent Liquid Dispensing Maximum Drink Size for a Single Recipe Minimum Drink Size Time to Dispense 12 oz Drink Power Requirements (PLC, I/O, Valves) Power Requirements for Pumps Ranges - Actual 20 5 5 0.85 oz/sec 64 oz +/- 2 % Ranges - Proposed 100 5 5 0.4 oz/sec 64 oz +/- 10 % Up to 2 liquids Up to 5 liquids 320 oz (64 oz x 5 liquids) 320 oz (64 oz x 5 liquids) 0.009 oz 0.009 oz 14.04 sec 30 sec 24VDC @ 11.7 A (minimum) for 5 liquid dispensing pumps 24VDC @ 4.5 A for 5 liquid dispensing pumps 24VDC @ 3 A for each pump 120VAC @ 2.5 A for 5 pumps 4. 4.1 DESIGN APPROACH AND DETAILS Design Approach While designing the ABD, few major changes were made. The first major change was how to allocate the recipe and liquid information. The proposed design was to use a dynamically allocated database to manage all of the recipes and liquids. However, it was more efficient and easier to maintain using statically allocated memory. The PLC has programmable and removable memory with it. Also, in the future, a commercial product would be easier to update using a flash card or drive instead of a dynamic database. The second major change was the pumps being used. After a long selection process, pumps supplied by Alcohol Controls Inc. were order. These pumps were designed specifically Automated Beverage Dispenser (ECE4007L04) 6 for controlling the flow of liquids. Unfortunately, Alcohol Controls’ supplier is located in Canada. The pumps were stopped in customs. Due to time constraints, the order was cancelled and new pumps were obtained. The actual pump used was an aquarium water pump made by AquaClear. Since the pump was made to be plugged into a wall, additional equipment was required to implement our design. A relay control circuit was designed to allow the DC control signal from the I/O block to control and AC pump. Also, it was submersible so no valve was present to control the flow of water. Solenoid valves and coils were purchased to control the backflow of the liquids. Control System Touch Screen Programmable Logic Computer Using a touch screen computer to control the ABD allows easy access and saves on space by not having a keyboard. A programmable logic computer provides a user interface to control equipment with minimal human interaction. A touch screen PLC is the most efficient way for the user to automatically control the equipment of the ABD. A company called B&R Industrial Automations supplied the touch screen PLC that was used. The computer can be easily interfaced with the Input/Output controller also supplied by B&R Industrial Automations. Input/Output Modules An input/output module is used in conjunction with the touch screen PLC to use the user’s input to control the ABD output. Also, the I/O module can be used to gather information about the ABD by reading the outputs of sensors, such as temperature sensors and level sensors. B&R Industrial Automations also supplied the I/O module that communicates with the PLC, liquid dispenser system and the relay circuit. Finally, an Ethernet Powerlink platform was used in conjunction with the I/O module to make it remote. The Ethernet Powerlink allows the I/O Automated Beverage Dispenser (ECE4007L04) 7 module to be remotely controlled by the PLC. Designing the I/O controller to be remote allows the ABD to be installed in or near the bar while the PLC can be placed anywhere in the restaurant [3]. Also, the modules can operate ten times the speed of current Fast Ethernet protocols [4]. Dispenser System 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 the AquaClear pumps used allowed for easy measurement and calibration of the flow rate with the software. Once the flow rate was determined, the software could be programmed to determine the amount of time the pumps needed to be on for the specific amount of liquid in the recipe. Once the pumps were stopped, all liquid flow needed to stop as well. The solenoid valves and coils immediately stop all liquid from flowing. Also, the liquid in the tubing was stopped from flowing out as well. Allocated Memory System The PLC used in the design of the control system was also used for the allocated memory system. The PLC supports a flash memory card. The memory card allows for all programming software to be downloaded onto it either through Ethernet or directly from a computer. The flash memory also allows for recipe and liquid information to be changed directly from the PLC when the design program is running. Automated Beverage Dispenser (ECE4007L04) 8 4.2 Design Details Figure 1. Wiring diagram for electrical controls of the ABD. Control System The B&R Power Panel (4PP220.1043-75) is the Programmable Logic Controller (PLC) that controls the flow rate of each dispensing pump on the machine. To accomplish this task, the PLC uses an X20 digital output module. The X20 system is modular and expandable, which Automated Beverage Dispenser (ECE4007L04) 9 allows the system the versatility to control as many pumps and valves as are required by a particular customer. Figure 2. X20BR9300 bus receiver module made by B&R Industrial Automations. To further achieve the accuracy requirements for this machine, the digital output module also controls the valves. This is connected to the PLC using an X2X Link, a proprietary 3-wire interface protocol capable of real time operation, which means that there is a predictable time between inputs to a system and the desired outputs. Using a real time operating system, VXWorks, the PLC is able to open and close a valve with a minimum resolution of 10 ms. Through experimentation, it was determined that the pumps flow fluid at a rate of 0.85 ounces per second, leading to a minimum dispensing resolution of 0.009 ounces. Automated Beverage Dispenser (ECE4007L04) 10 Figure 3. X20DO9322 12x Digital Output Module Figure 4 is the circuit schematic for the relay controls. A larger version is referenced in Appendix B. Each relay is connected to the voltage regulator, which regulates the voltage coming in from the 24 VDC power supply to 5 VDC, the rated voltage for the relays. Each relay is then connected to a 2N4148 switching transistor. Also, the relay has120 VAC coming into its input pin. The 120 VAC is supplied by a connection from the wall. When the relay switches open, the 120 VAC will be the output voltage. The transistor’s input voltage is coming from the I/O block output controlling the designated pump. When the I/O block sends a signal through the transistor, turning it on, the normally closed relay switch opens. Each relay’s outlet pin is connected to a standard NEMA 5-15 receptacle. Each receptacle has one pump plugged into it. Automated Beverage Dispenser (ECE4007L04) 11 Figure 4. PSpice circuit schematic for the switching relay circuit. Figure 5 illustrates the logic flow of the software. The proposed logic flow and the implemented logic flow can be found in Appendices C and D, respectively. At each interface screen, such as the Main Menu, the user can select various options in the form of buttons. The appropriate controller signals and their directionality are shown as well. Each interface screen is represented by a rectangular box, button choices by octagons, and I/O signals by diamonds. Automated Beverage Dispenser (ECE4007L04) 12 Help Home Add Liquid Add Recipe Button Button View Liquids Button View Recipes Button Setup Button View Liquid List View Recipe List Add Recipe Setup Liquid Selected Recipe Selected * Help Layer * Located on every screen Off Confirm Shutdown Shutdown Screen Add Liquid Confirm Delete Save * Home Button Confirm Delete Save Edit Edit View Liquid Delete Back * Welcome / Startup View Recipe Next Delete Back Next Make Signals To Controller Figure 5. Logic flow of the software. Figure 6 is an example user interface screen. Specifically, the Home Screen interface is shown. From the Home Screen, users can perform every major function. Note that Appendices E through O contain all interface screens and documentation. Note: This information can be found in real time by toggling ‘ ?’ on the interface . PROJ .. ABD DWN. 28 Apr 09 / M . Peterson Peterson Automated Beverage Dispenser Figure 6. Example of one of the user interface screens. ENGR. Mark GU I – H ome Screen TITLE . Memory Allocation System Figure 7 is a visual representation of the prototype’s software structure, also found in Appendix P. B&R’s Visualization Component’s object references the file control.c to execute all major functions. The file control.c is documented in entirety in Appendix Q. Automated Beverage Dispenser (ECE4007L04) 13 Each data structure consists of a recipe name, recipe description, and a list of integer values representing the amount of each ingredient the recipe calls for. Each liquid data structure includes a name and description. Dynamic memory allocation is not often employed in real time environments due to the inherent uncertainty involved. For this reason, a set of 20 recipes and 10 liquids were allocated to static remnant memory in the RAM on the PLC. This memory is backed up by the CMOS battery and will retain information through power cycles. For the final commercially available product, flash memory would be employed, either by USB memory drives or by using a larger compact flash card for program memory. This change allows the user to easily update recipes without the aid of the Power Panel. HMI (Visualization Components*) Load (control.c ) Save (control.c ) Add (control.c ) Make (control.c ) Setup (control.c ) *Note: Visualization Components is a proprietary data type of B&R’s Automation Studio. Figure 7. Software structure diagram. The first important function is called to load a recipe from memory. This would read a single recipe from the memory area to a temporary data structure and display it on the screen. The user can make any modifications to this temporary copy and call the save function to commit the changes back to memory. This is the basic operation of the recipe system for our prototype. Similarly, the user can add a recipe to the end of the list of recipes. Automated Beverage Dispenser (ECE4007L04) 14 The program also called a function to make the currently viewed recipe. This would take values loaded into the temporary data structure and create a drink based on the values. After the recipe is finished dispensing, it will once again load the currently viewed recipe. The prototype was not capable of making different quantities of the same recipe; however, for a commercial version it is essential that this feature be available. This improved aspect of the commercial version allows the server to select the drink, followed by the number of drinks to make, thus dispensing the entire recipe in greater quantities while keeping the proportions constant. Finally, the setup function allowed the user to manage the liquids currently loaded into each bay. The setup function tracks how much fluid was dispensed and how much is remaining in each bay. Since the prototype had no way of determining the fluid level in each bay, the user directly input the amount of fluid in each bay manually, with no error checking involved. A commercialized version improves upon this design by including a simple sensor array to monitor fluid levels in each bay. This will prevent users from incorrectly entering the amount of fluid in each bay. Dispensing Unit When the controlling unit was complete, the dispensing unit could be constructed. Figure 8 shows the mechanical layout of the dispensing unit. Additional mechanical layouts can be found in Appendices R through W. Attached to the output of the pumps, is a ½” plastic tube going into a ½” intake nozzle. The nozzle is the input for the solenoid coil and valve combination. The coil is the power unit, which opens the normally closed valve. The I/O block controls each coil in conjunction with a pump receptacle. However, the receptacle and coil are not controlled by the same I/O output because a delay is needed to pressurize the pump before Automated Beverage Dispenser (ECE4007L04) 15 dispensing the liquid. The outlet of the valve is a ¼” nozzle attached to ¼” tubing. The tubing then leaves the dispensing unit’s housing to a spout attached to the outside of the housing unit. Figure 8. Single dispensing bay assembly. 4.3 Codes and Standards Human-machine interface (HMI) codes and standards defining graphical user symbols are specified by ISO/IEC 11581 [5]. A finished consumer product would fully comply with ISO/IEC 11581; however, the feasibility of prototype compliance was determined to be out of the scope of this project. Also, manufacturing codes and regulations are specified by NAICS 3133 [6]. A finished consumer product would fully comply with NAICS 31-39; however, the feasibility of prototype compliance was determined to be out of the scope of this project. Also, once the product is in use, there are local government health and safety regulations that must be followed for the safety of the public. A cleaning cycle function was created in the software to maintain a clean ABD. Automated Beverage Dispenser (ECE4007L04) 16 4.4 Constraints, Alternatives, and Tradeoffs While designing and constructing the ABD, there were a few constraints that were dealt with when designing the ABD. The first and largest issue was finding appropriate pumps to use. The first pump type considered was a stepper motor pump from Fluid Metering Inc. [7]. It was both too expensive for the allocated budget and an over kill on accuracy. Next, pumps made for waterworks applications were located through a project sponsor, Dakota Supply Group [8]. Unfortunately, they were too large in size and flow rate for the application. Finally, alcohol grade pumps were located through a local, Alcohol Controls [9]. However, none were in stock, so they were ordered from the manufacturer, Auper, in Montreal, Canada. After waiting several weeks while the pumps were in US Customs, the order was cancelled due to time constraints. The chosen pump was an AquaClear 30 [10]. Since the aquarium pump was not the original pump chosen for the design, an extra circuit board was required to have the 24 VDC output control a 110 VAC pump. Also solenoid valves were required to make the pumps work with gravity fed containers and also to reduce back flow in the tubing. Unfortunately, both the circuit board and the valves created a problem with the 4.5 A power supply. It was now too small to power all the relays, pumps, coils and I/O block at once. Because of the limited budget supplied to construct the ABD, a larger, 7.2 A, but still insufficient power supply was purchased. Since the larger power supply could not power all of the components at once, the software was changed to turn on the pumps and valves consecutively instead of concurrently. 5. SCHEDULE, TASKS, AND MILESTONES Below is the list of tasks divided into responsibility and duration. The list compares the proposed task durations and compares them to the actual durations. The group and project was Automated Beverage Dispenser (ECE4007L04) 17 divided into a software group and a hardware group. Those writing the software designed the interface and programming behind the ABD. The hardware group designed and constructed the project. The difficulty of each task was never categorized by the group. Instead, work loads were determined based on skills and time. Notice in Appendix X the full Gantt chart comparing proposed durations of tasks with actual. Figure 9. Task assignments. Automated Beverage Dispenser (ECE4007L04) 18 6. PROJECT DEMONSTRATION 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 a 12oz. drink within 30 seconds, and the pumps had to be accurate to within 10%. After extensive testing and calibrating of each of the five pumps, the ABD successfully accomplished its goals. On average, the pumps dispensed 1oz. per second with an accuracy of around 2%. The acceptance testing was proven by the successful demonstration to Dr. Keezer. 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. First 2oz. was measured from each pump and then 10oz. with slight calibrations until the pump could dispense within 2% of the desired amount of liquid. Since each pump is slightly different, the time it takes the pump to dispense 1oz. in 1 second differs. Simple software changes were made so that between 1.15 and 1.19 seconds of dispensing a liquid would equate to 1oz. per second. After these calibrations, the ABD successfully met its acceptance testing. 7. MARKETING AND COST ANALYSIS 7.1 Marketing Analysis There are many restaurants that serve drinks to all tables in the establishment as well as run a bar. The ABD is proposed to help the wait staff fill drink orders with speed and accuracy. The interface is designed to be flexible and easily programmable with the offerings of the business. In addition, implementing scalability to the design would allow great flexibility in the amount and type of source fluids further adding to the functionality of the dispenser. A similar product is available from Giles & Posner called the Automatic Cocktail Bartender [11]. This product goes above and beyond our design, but I was unable to acquire a price to compare it Automated Beverage Dispenser (ECE4007L04) 19 with. Another similar device is the Super SideBar by SideBar Beverage Systems [12]. The SideBar system is nowhere near as versatile as the ABD, it has 5 pumps that require priming, but it has five buttons that pump from one ounce to continuous flow from their specific containers. The SideBar system is price at $499. 7.2 Cost Analysis The parts cost of a single unit was $1,780.00 with labor costs of $300.00, but has adjusted to $2,278.50 plus labor costs. This adjusts the base cost of each dispenser to $2,578.50. Scalability up to eight fluids was $110.00 per fluid and is adjusted to $126.70. Table 3 shows equipment costs for the prototype. Table 3. Parts and Hardware Item B&R 10” Power Panel 4PP220.1024-xx B&R X20 Powerlink Bus Receiver Automation Studio v3.0 License B&R X20 Digital Output Module B&R X20 Digital Input Module Fluid Pumps Weight Sensors/Level Sensors Containers Solenoid Coil/Valve Tubing/Brass Fittings Relays/Inverter Circuits for Pumps 7.2 amp Power Supply Total Automated Beverage Dispenser (ECE4007L04) Quantity 1 1 2 1 1 5 0 5 5 1 Cost Total Budget Difference $400.00 $400.00 $400.00 $0.00 $500.00 $500.00 $500.00 $0.00 $800.00 $1,600.00 $1,600.00 $0.00 $200.00 $200.00 $200.00 $0.00 $200.00 $200.00 $200.00 $0.00 $42.00 $210.00 $250.00 $40.00 $0.00 $0.00 $180.00 $180.00 $1.50 $7.50 $50.00 $42.50 $83.20 $416.00 $0.00 -$416.00 $75.00 $0.00 -$75.00 $75.00 $75.00 $0.00 -$75.00 $195.00 $195.00 $0.00 -$195.00 $3,878.50 $3,380.00 -$498.50 20 Table 4. Parts and Hardware from ECE. Item B&R 10” Power Panel 4PP220.1024-xx B&R X20 Powerlink Bus Receiver Automation Studio v3.0 License B&R X20 Digital Output Module B&R X20 Digital Input Module Fluid Pumps Weight Sensors/Level Sensors Containers Solenoid Coil/Valve Tubing/Brass Fittings Relays/Inverter Circuits for Pumps 7.2 amp Power Supply Total Quantity 1 1 2 1 1 2/3 0 5 5 1 Cost Total Donated Donated Donated Donated Donated Donated Donated Donated Donated Donated Donated/$42.00 Donated/$126.00 Donated Donated Donated Donated Donated Donated Donated Donated Donated Donated $195.00 $195.00 $321.00 Labor is the bulk of the cost in development. Table 5 shows the detailed breakdown of labor and equipment costs based on an average wage of $30 per hour per engineer. A detailed calculation of project overhead is available in Appendix Y. Our labor estimates followed actual time spent well, but was concentrated around the later days as opposed to spread out as the original Gantt Chart indicated. Table 5. Project Costs Project Component Software Development Hardware Development Lectures/Meetings Total Labor Total Parts Cost Total Overhead Project Total Labor Hours Labor Cost Equipment Cost Total Component Cost 134 $4,020.00 $1,600.00 $5,620.00 225 $6,750.00 $2,278.00 $9,028.00 240 599 $7,200.00 $17,970.00 $7,200.00 $3,878.00 -$498.00* $10,456.00 $32,304.00 * Adjustment to overhead used to cover additional equipment costs. A detailed assessment of product pricing is also in Appendix Y. I assumed a reasonable markup of 20% over fixed costs for creation of an additional device. Automated Beverage Dispenser (ECE4007L04) 21 8. SUMMARY A working prototype of the ABD was demonstrated successfully. The specs are shown in Table 6. Table 6. Automated Beverage Dispenser technical specifications. Description Recipes Ingredients Per Recipe Ingredients (Liquids) Dispensing Rate Container Capacity Dispensing Accuracy Concurrent Liquid Dispensing Maximum Drink Size for a Single Recipe Minimum Drink Size Time to Dispense 12 oz Drink Power Requirements (PLC, I/O, Valves) Power Requirements for Pumps Ranges - Actual 20 5 5 0.85 oz/sec 64 oz +/- 2 % Ranges - Proposed 100 5 5 0.4 oz/sec 64 oz +/- 10 % Up to 2 liquids Up to 5 liquids 320 oz (64 oz x 5 liquids) 320 oz (64 oz x 5 liquids) 0.009 oz 0.009 oz 14.04 sec 30 sec 24VDC @ 11.7 A (minimum) for 5 liquid dispensing pumps 24VDC @ 4.5 A for 5 liquid dispensing pumps 24VDC @ 3 A for each pump 120VAC @ 2.5 A for 5 pumps Automated Beverage Dispenser (ECE4007L04) 22 9 REFERENCES [1] “Computerized Liquor Control System,” 2008. [Online]. Avaliable: http://www.easybar.com/clcs.html. [Accessed: Apr. 15, 2009] [2] “I-Matic Overview,” 2006. [Online] Avaliable: http://www.auper.com/pages/imaticoverviewpag.html. [Accessed: Feb. 17, 2009] [3] W. Roberts, “Powerlink Revolutionizes Real-Time Ethernet”, Automation, vol. 47, pp.1314, Sept. 2008. [4] M. Sandhoefner, “X2X Distribution I/O”, Automation Letter, vol. 38, pp. 4, Nov. 2008 [5] UsabilityNet. (2006). International Standards for HCI and Usability. usabilitynet.org. [Online]. Available: http://usabilitynet.org/tools/r_international.htm#11581 [6] “Industry Statistics Sampler: 31-33,” 2008. [Online]. Available: http://www.census.gov/econ/census02/data/industry/E31-33.HTM. [Accessed: Apr. 20, 2009] [7] Fluid Metering, Inc., “Fluid Metering CeramPump Operation, Valveless Piston Pump Automation,” Fluid Metering, Inc. Dispensers and Metering Pumps, 2008. [Online]. Available: http://www.fmipump.com/99pumpop.html. [Accessed: Jan. 19, 2009]. [8] “Dakota Supply Group,” 2009. [Online]. Available: http://www.dsginc.biz. [Accessed: Mar. 15, 2009] [9] “Alcohol Controls – Loss Prevention Products for the Bar Industry,” 2008. [Online]. Available: http://www.alcoholcontrols.com. [Accessed: Mar. 1, 2009] [10] “A-600 AquaClear 30 Power Filter - 110 V,” 2008. [Online]. Available: http://www.hagen.com/usa/aquatic/product.cfm?CAT=1&SUBCAT=107&PROD_ID=0 1006000020101. [Accessed: Apr. 2. 2009] Automated Beverage Dispenser (ECE4007L04) 23 [11] “Automatic Cocktail Bartender.” www.gilesandposner.com. 2006. Giles & Posner. 29 Apr 2009 <http://www.drinksmediawire.com/upload/pdfs/cdp/Auto%20bartender%20system.pdf>. [12] “Super SideBar.” www.sidebarbeverage.com. 2009. SideBar Beverage Systems. 29 Apr 2009 <http://www.sidebarbeverage.com/features.html>. Automated Beverage Dispenser (ECE4007L04) 24 APPENDIX A – DEFINITONS OF SOFTWARE FEATURES Touch screen Navigated User Interface – Otherwise known as a human-machine interface (HMI), this feature was required to facilitate operation of the final device. Database of Recipes and Liquids – A database was proposed for storage of information pertaining to liquids and recipes. Due to software limitations, no dynamic memory manipulation was achievable; thus, a static memory block of recipe and liquid data types was established instead. See Appendix X CONTROL.C for source code. Add / Remove / Modify Liquids and Recipes – A database was proposed for storage of information pertaining to liquids and recipes. Due to software limitations, no dynamic memory manipulation was achievable; thus, a static memory block of recipe and liquid data types was established instead. See Appendix Q for source code. Help Menu – An interactive manual was established to aid end users with operation of the device. This attribute also served as a form of software documentation. See Appendices E through O for examples of on-screen help documentation. Home Screen – A home screen functions as a ‘root’ location for user navigation. All software functionality was accessible through this interface screen. Display Recipes / Liquids List – The end user is able to view a complete list of recipes and liquids that can make recipes that are stored in the database. Display Recipe / Liquid Details – The end user is able to view specific information about a particular recipe or liquid such as ingredients, name, and rating. Configuration / Setup Menu – The software package must be configured such that it knows what liquids are present in the device’s fluid bays. A cleaning routine was added to the setup Automated Beverage Dispenser (ECE4007L04) 25 menu. A visual bar-graph representation of liquid level in each bay was added to the setup menu. Software-Controller I/O Signals – The software package achieved the capability to receive signals from the controller and send signals to the controller; however, only outgoing signals to the controller were used during implementation. Make Recipe Button / Menu – The end functionality of the user interface has provided the user with an option to create a specified recipe. Automated Beverage Dispenser (ECE4007L04) 26 APPENDIX B – RELAY CIRCUIT Automated Beverage Dispenser (ECE4007L04) 27 APPENDIX C – PROPOSED SOFTWARE FUNCTIONALITY DIAGRAM Automated Beverage Dispenser (ECE4007L04) 28 APPENDIX D – IMPLEMENTED SOFTWARE FUNCTIONALITY DIAGRAM KEY: Interface Screen Button I/O Signal s Direction of Flow Contr oller Help Home Add Liquid Add Recipe Button Button View Liquids Button View Recipes Button Setup Button View Liquid List View Recipe List Add Recipe Setup Liquid Selected Recipe Selected * Help Layer * Located on every screen Off Confirm Shutdown Shutdown Screen Confirm Delete Add Liquid Save * Home Button Edit View Liquid Delete View Recipe Next Delete Back Make Automated Beverage Dispenser (ECE4007L04) Confirm Delete Save Edit Back * Welcome / Startup Next Signals To Controller 29 APPENDIX E – GUI, STARTUP SCREEN To progress, user ‘clicks’ the screen by touching it . PROJ.. ABD DWN. 28 Apr 09 / M . Peterson ENGR. Mark Peterson Automated Beverage Dispenser (ECE4007L04) Automated Beverage Dispenser GU I – Startup Screen TITLE . 30 APPENDIX F – GUI, HOME SCREEN Note: This information can be found in real time by toggling ‘ ?’ on the interface . PROJ.. ABD DWN. 28 Apr 09 / M . Peterson ENGR. Mark Peterson Automated Beverage Dispenser (ECE4007L04) Automated Beverage Dispenser GU I – H ome Screen TITLE . 31 APPENDIX G - GUI, VIEW LIQUID SCREEN Note: This information can be found in real time by toggling ‘ ?’ on the interface . PROJ .. ABD 28 Apr 09 / M. Peterson ENGR . Mark Peterson DWN. Automated Beverage Dispenser (ECE4007L04) Automated Beverage Dispenser GU I – View Liquid Screen TITLE . 32 APPENDIX H – GUI, VIEW RECIPE SCREEN Note: This information can be found in real time by toggling ‘ ?’ on the interface . ABD DWN. 28 Apr 09 / M . Peterson Mark Peterson ENGR. PROJ .. Automated Beverage Dispenser (ECE4007L04) Automated Beverage Dispenser GU I – View R ecipe Screen TITLE . 33 APPENDIX I – GUI, ADD LIQUID SCREEN Note: This information can be found in real time by toggling ‘ ?’ on the interface . PROJ .. ABD DWN. 28 Apr 09 / M . Peterson ENGR. Automated Beverage Dispenser (ECE4007L04) Mark Peterson Automated Beverage Dispenser GU I – Add Liquid Screen TITLE . 34 APPENDIX J – GUI, ADD RECIPE SCREEN Note: This information can be found in real time by toggling ‘ ?’ on the interface . PROJ.. ABD 28 Apr 09 / M. Peterson ENGR . Mark Peterson DWN. Automated Beverage Dispenser (ECE4007L04) Automated Beverage Dispenser GU I – Add R ecipe Screen TITLE . 35 APPENDIX K – GUI, VIEW LIQUID LIST SCREEN Note: This information can be found in real time by toggling ‘ ?’ on the interface . PROJ .. ABD DWN. 28 Apr 09 / M . Peterson ENGR. Mark Peterson Automated Beverage Dispenser (ECE4007L04) Automated Beverage Dispenser GU I – View Liquid List Screen TITLE . 36 APPENDIX L – GUI, VIEW RECIPE LIST SCREEN Note: This information can be found in real time by toggling ‘ ?’ on the interface . Automated Beverage Dispenser (ECE4007L04) PROJ .. ABD DWN. 28 Apr 09 / M . Peterson ENGR. Mark Peterson Automated Beverage Dispenser GU I – View R ecipe List Screen TITLE . 37 APPENDIX M – GUI, SETUP SCREEN At the time of installation the user enters the amount of liquid being placed in the bay . , Depending on how much liquid the user is loading into the bay , the status bar (showing green) will indicate liquid level . ( Green = full , Red = critically low , etc .) Press D 1-D5 in order to fire a pump and relay individually for test purposes . Note: This information can be found in real time by toggling ‘ ?’ on the interface . PROJ .. ABD DWN. 28 Apr 09 / M. Peterson ENGR . Automated Beverage Dispenser (ECE4007L04) Mark Peterson Automated Beverage Dispenser GU I – Setup Screen TITLE . 38 APPENDIX N – GUI, CONFIRM SHUTDOWN SCREEN To continue the shutdown processes click ‘Ok’ . To cancel the shutdown process click ‘Cancel’ . PROJ.. ABD 28 Apr 09 / M. Peterson Mark Peterson ENGR. DWN. Automated Beverage Dispenser (ECE4007L04) Automated Beverage Dispenser GU I – C onfirm Shutdow n Screen TITLE . 39 APPENDIX O – GUI, POWER DOWN SCREEN Now is the time when the user can unplug the ABD . PROJ .. ABD 28 Apr 09 / M. Peterson Mark Peterson ENGR . DWN. Automated Beverage Dispenser (ECE4007L04) Automated Beverage Dispenser GU I – Pow er D ow n Screen TITLE . 40 APPENDIX P – IMPLEMENTED SOFTWARE STRUCTURE DIAGRAM HMI (Visualization Components*) Load (control.c ) Save (control.c ) Add (control.c ) Make (control.c ) Setup (control.c ) *Note: Visualization Components is a proprietary data type of B&R’s Automation Studio. Automated Beverage Dispenser (ECE4007L04) 41 APPENDIX Q – SOURCE CODE, CONTROL.C /*'**************************************************************************** ********** '* Author: Michael Fojas '* History: * '* 3.21.2009: First Version * * '* 4.16.2009: Recipe Management * * '* * '***************************************************************************** **********/ #include <bur/plc.h> #include <bur/plctypes.h> /***************************************************** *** Scaling Factor *****************************************************/ #define SCALE 120 /***************************************************** *** Function Prototypes *****************************************************/ void dispense(); /***************************************************** *** Global Variables *****************************************************/ _GLOBAL BOOL input[12], pump[5], valve[5], d[5]; typedef struct Liquid_typ{ STRING liquidName[50]; STRING liquidDescription[250]; Automated Beverage Dispenser (ECE4007L04) /* Dispense */ /* Liquid type */ 42 USINT picIndex; } Liquid_typ; typedef struct Recipe_typ { STRING recipeName[50]; STRING recipeDescription[250]; /* Set Status of digital Inputs via Force function */ /* Name of drink */ /* Description of drink */ USINT picIndex; UINT units1; ingredient 1 (in units) */ UINT units2; UINT units3; ingredient 1 (in units) */ UINT units4; UINT units5; ingredient 1 (in units) */ /* Amount of USINT rating; } Recipe_typ; /* Rating */ /* Amount of /* Amount of _GLOBAL Recipe_typ Recipes[21]; _GLOBAL Liquid_typ Liquids[10]; descriptions*/ /* List of liquid names and _GLOBAL STRING recipeNames[21][50]; Recipe List Page */ _GLOBAL STRING liquidNames[10][50]; Recipe List Page */ /* List of names for View _GLOBAL Recipe_typ CurrentRecipe; displaying/loading/saving recipes */ _GLOBAL Liquid_typ CurrentLiquid; /* Temp variable for _GLOBAL BOOL /* Emergency Stop */ /* Make Recipe */ /* Load Recipe */ /* Save Recipe */ /* Save Liquid */ /* Load Liquid */ /* Delete Recipe */ /* Clean Machine */ /* Single Ingredient is eStop, makeRecipe, loadRecipe, saveRecipe, saveLiquid, loadLiquid, deleteRecipe, cleanCycle, drinkDone, /* List of names for View finished dispensing */ recipeComplete, /* Entire Recipe is finished dispensing */ Automated Beverage Dispenser (ECE4007L04) 43 lowLevel; _GLOBAL USINT */ addLiquidHelp, /* Help screen flags for HMI addRecipeHelp, homeHelp, setupHelp, viewLiquidHelp, viewRecipeHelp, viewLiquidListHelp, viewRecipeListHelp, confirmDelete, cleanDialog, dispensingDrink, liquidWarn, liquidWarnHotSpot, count, /* Warn user that liquid level is low */ notEnoughIngredients, are insufficient ingredients to make the drink */ cascade; _GLOBAL UINT recipeNumber, liquidNumber, delayConstant, delay, liquidLevels[5]; _GLOBAL UINT i; _INIT void init(void) { eStop = 1; loadLiquid = 1; loadRecipe = 1; makeRecipe = 0; saveRecipe = 0; confirmDelete = 1; cleanDialog = 1; deleteRecipe = 0; cleanCycle = 0; recipeComplete = 1; dispensingDrink = 1; notEnoughIngredients = 1; liquidWarn = 1; if(!delayConstant) Automated Beverage Dispenser (ECE4007L04) /* Error on make, signals ths there /* Reset flags */ /* Hide delete window */ /* Hide dispensing drink dialog */ /* Hide dialog box */ 44 { delayConstant = 50; } recipeNumber = 1; liquidNumber = 1; Recipes[0].units1 = 0; Recipes[0].units2 = 0; Recipes[0].units3 = 0; Recipes[0].units4 = 0; Recipes[0].units5 = 0; for(i = 0; i < 5; i++) { strcpy(Liquids[i].liquidName, " "); strcpy(Liquids[i].liquidDescription, " "); } /* Hide help dialog boxes at startup */ addLiquidHelp = 1; addRecipeHelp = 1; homeHelp = 1; setupHelp = 1; viewLiquidHelp = 1; viewRecipeHelp = 1; viewLiquidListHelp = 1; viewRecipeListHelp = 1; strcpy(Recipes[0].recipeName, "Vodka"); strcpy(Recipes[0].recipeDescription, "Vodka"); Recipes[0].units1 = 100; millisecond cycles */ /* # of ten strcpy(Liquids[0].liquidName, "Vodka"); strcpy(Liquids[0].liquidDescription, "Vodka"); } _CYCLIC void cyclic(void) { /* Emergency Stop ************************ * Automated Beverage Dispenser (ECE4007L04) 45 * Stops everything!! * ***************************************/ if(eStop) { makeRecipe = 0; loadRecipe = 1; cleanDialog = 1; /* Stop making recipes */ /* Hide cleaning dialog box */ for(i = 0; i < 5; i++) { pump[i] = 0; valve[i] = 0; } eStop = 0; } /* Load Recipe ************************ * * Moves data from selected recipe to currentRecipe * ***************************************/ if(loadRecipe) { if(recipeNumber <= 20) { strcpy(CurrentRecipe.recipeName, Recipes[recipeNumber].recipeName); strcpy(CurrentRecipe.recipeDescription, Recipes[recipeNumber].recipeDescription); CurrentRecipe.rating = Recipes[recipeNumber].rating; CurrentRecipe.picIndex = Recipes[recipeNumber].picIndex; CurrentRecipe.units1 = Recipes[recipeNumber].units1; CurrentRecipe.units2 = Recipes[recipeNumber].units2; CurrentRecipe.units3 = Recipes[recipeNumber].units3; CurrentRecipe.units4 = Recipes[recipeNumber].units4; CurrentRecipe.units5 = Recipes[recipeNumber].units5; } loadRecipe = 0; /* Reset recipe flag*/ } /* Save Recipe ************************ Automated Beverage Dispenser (ECE4007L04) 46 * * Saves a recipe * ***************************************/ if(saveRecipe) { if(recipeNumber <= 20) { strcpy(Recipes[recipeNumber].recipeName, CurrentRecipe.recipeName); strcpy(recipeNames[recipeNumber], CurrentRecipe.recipeName); strcpy(Recipes[recipeNumber].recipeDescription, CurrentRecipe.recipeDescription); Recipes[recipeNumber].rating = CurrentRecipe.rating; Recipes[recipeNumber].picIndex = CurrentRecipe.picIndex; Recipes[recipeNumber].units1 = CurrentRecipe.units1; Recipes[recipeNumber].units2 = CurrentRecipe.units2; Recipes[recipeNumber].units3 = CurrentRecipe.units3; Recipes[recipeNumber].units4 = CurrentRecipe.units4; Recipes[recipeNumber].units5 = CurrentRecipe.units5; } saveRecipe = 0; /* Reset recipe flag*/ } /* Delete Recipe ************************ * * Deletes whatever recipe is selected at the moment (blanks out name, description, and unit values * ***************************************/ if(deleteRecipe) { if(recipeNumber <= 20) { strcpy(Recipes[recipeNumber].recipeName, " "); strcpy(recipeNames[recipeNumber], " "); strcpy(Recipes[recipeNumber].recipeDescription, " "); Recipes[recipeNumber].rating = 0; Automated Beverage Dispenser (ECE4007L04) 47 Recipes[recipeNumber].picIndex = 0; Recipes[recipeNumber].units1 = 0; Recipes[recipeNumber].units2 = 0; Recipes[recipeNumber].units3 = 0; Recipes[recipeNumber].units4 = 0; Recipes[recipeNumber].units5 = 0; } deleteRecipe = 0; /* Reset recipe flag*/ } /* Load Liquid ************************ * * Loads Liquid * ***************************************/ if(loadLiquid) { if(liquidNumber <= 10) { strcpy(CurrentLiquid.liquidName, Liquids[liquidNumber].liquidName); strcpy(CurrentLiquid.liquidDescription, Liquids[liquidNumber].liquidDescription); CurrentLiquid.picIndex = Liquids[liquidNumber].picIndex; } loadLiquid = 0; /* Reset recipe flag*/ } /* Save Liquid ************************ * * Saves a recipe * ***************************************/ if(saveLiquid) { if(liquidNumber < 10) { strcpy(Liquids[liquidNumber].liquidName,CurrentLiquid.liquidName); strcpy(liquidNames[liquidNumber],CurrentLiquid.liquidName); strcpy(Liquids[liquidNumber].liquidDescription, CurrentLiquid.liquidDescription); Liquids[liquidNumber].picIndex = CurrentLiquid.picIndex; } Automated Beverage Dispenser (ECE4007L04) 48 saveLiquid = 0; /* Reset recipe flag*/ } /* Make Recipe ************************ * * Makes a recipe when makeRecipe is set to one * ***************************************/ if(makeRecipe) { recipeComplete = 1; if( /* Set recipe to complete */ (CurrentRecipe.units1 <= liquidLevels[0]) && (CurrentRecipe.units2 <= liquidLevels[1]) && (CurrentRecipe.units3 <= liquidLevels[2]) && (CurrentRecipe.units4 <= liquidLevels[3]) && (CurrentRecipe.units5 <= liquidLevels[4])) { dispensingDrink = 0; /* Show dispensing drink dialog */ if((++delay) > delayConstant) { delay = delayConstant + 1; counting all the way up */ /* Keep delay constant from dispense(); if(!drinkDone) { recipeComplete = 0; /* Recipe is not complete */ } if(recipeComplete) /* if all drinkdone flags are 1 */ { makeRecipe = 0; /* Reset Recipe Flag */ dispensingDrink = 1; /* Hide cleanDialog = 1; /* Hide dispensing drink dialog box */ cleaning dialog box */ loadRecipe = 1; drinkDone = 0; } } Automated Beverage Dispenser (ECE4007L04) 49 else /* Turn on pumps (DelayConstant * cycles) before openin valves */ { if((CurrentRecipe.units1 > 0) && (cascade == 1)) pump[0] = 1; /* Prime pumps that are used in recipe*/ if((CurrentRecipe.units2 > 0) && (cascade == 2)) pump[1] = 1; /* Prime pumps that are used in recipe*/ if((CurrentRecipe.units3 > 0) && (cascade == 3)) pump[2] = 1; /* Prime pumps that are used in recipe*/ if((CurrentRecipe.units4 > 0) && (cascade == 4)) pump[3] = 1; /* Prime pumps that are used in recipe*/ if((CurrentRecipe.units5 > 0) && (cascade == 5)) pump[4] = 1; /* Prime pumps that are used in recipe*/ } } else { dispensingDrink = 1; notEnoughIngredients = 0; makeRecipe = 0; cleanDialog = 1; /* Hide cleaning dialog box */ } } else { cascade = 1; if(!(d[0]) && !(d[1]) && !(d[2]) && !(d[3]) && !(d[4])) { delay = 0; } for(i = 0; i < 5; i++) { if(d[i] && liquidLevels[i]) { pump[i] = 1; if((++delay) > delayConstant) { delay = delayConstant + 1; /* Keep delay constant from counting all the way up */ valve[i] = 1; liquidLevels[i]--; /* Change total liquid level */ } } else { Automated Beverage Dispenser (ECE4007L04) 50 pump[i] = 0; valve[i] = 0; } } } /* Clean******************************* * * Turns on all pumps for 10 seconds. * ***************************************/ if(cleanCycle) { cleanDialog = 0; CurrentRecipe.units1 = 12 * SCALE; CurrentRecipe.units2 = 12 * SCALE; CurrentRecipe.units3 = 12 * SCALE; CurrentRecipe.units4 = 12 * SCALE; CurrentRecipe.units5 = 12 * SCALE; makeRecipe = 1; cleanCycle = 0; } /* Check Levels ******************************* * * * ***************************************/ lowLevel = 0; for(i = 0; i < 5; i++) { if(liquidLevels[i] < (SCALE * 12)) /* If */ { lowLevel = 1; break; } } if(lowLevel) { liquidWarnHotSpot = 0; if((count++) > 50) { Automated Beverage Dispenser (ECE4007L04) 51 count = 0; liquidWarn = !liquidWarn; } } else { count = 0; liquidWarnHotSpot = 1; liquidWarn = 1; } } /* Dispense *************************** * * Opens valve for time specified, then closes valve and turns off pump. * ***************************************/ void dispense() { switch(cascade) { case 1: if(CurrentRecipe.units1 == 0) /* Units are out */ { pump[0] = 0; /* Turn off pump */ valve[0] = 0; /* Turn off valve */ delay = 0; cascade = 2; } else /* Turn on the pump */ { valve[0] = 1; /* Open valve */ CurrentRecipe.units1--; /* Decrement time to keep valve open */ liquidLevels[0]--; /* Change total liquid level */ } break; case 2: if(CurrentRecipe.units2 == 0) /* Units are out */ { pump[1] = 0; /* Turn off pump */ valve[1] = 0; /* Turn off valve */ delay = 0; Automated Beverage Dispenser (ECE4007L04) 52 cascade = 3; } else /* Turn on the pump */ { valve[1] = 1; /* Open valve */ CurrentRecipe.units2--; /* Decrement time to keep valve open */ liquidLevels[1]--; /* Change total liquid level */ } break; case 3: if(CurrentRecipe.units3 == 0) /* Units are out */ { pump[2] = 0; /* Turn off pump */ valve[2] = 0; /* Turn off valve */ delay = 0; cascade = 4; } else /* Turn on the pump */ { valve[2] = 1; /* Open valve */ CurrentRecipe.units3--; /* Decrement time to keep valve open */ liquidLevels[2]--; /* Change total liquid level */ } break; case 4: if(CurrentRecipe.units4 == 0) /* Units are out */ { pump[3] = 0; /* Turn off pump */ valve[3] = 0; /* Turn off valve */ delay = 0; cascade = 5; } else /* Turn on the pump */ { valve[3] = 1; /* Open valve */ CurrentRecipe.units4--; /* Decrement time to keep valve open */ liquidLevels[3]--; /* Change total liquid level */ } break; case 5: if(CurrentRecipe.units5 == 0) /* Units are out */ { pump[4] = 0; /* Turn off pump */ valve[4] = 0; /* Turn off valve */ delay = 0; drinkDone = 1; Automated Beverage Dispenser (ECE4007L04) 53 } else /* Turn on the pump */ { valve[4] = 1; /* Open valve */ CurrentRecipe.units5--; /* Decrement time to keep valve open */ liquidLevels[4]--; /* Change total liquid level */ } break; } } Automated Beverage Dispenser (ECE4007L04) 54