TABLE OF CONTENTS 1 Introduction 1.1 Introduction ................................................................................. 1 1.2 Objective…………….................................................................. 1 2 Project Design 2.1 Project Description...................................................................... 2 2.2 Design Specifications.................................................................. 2 2.3 Design Iterations ......................................................................... 3 3 Final Product 3.1 Hardware Components ............................................................... 4 3.2 Programming............................................................................... 5 4 Difficulties Encountered 4.1 Problems/Difficulties.................................................................. 5 4.2 Trade-offs.................................................................................... 6 5 Improvements and Recommendations 5.1 Improvements ............................................................................. 7 5.2 Recommendations ....................................................................... 8 6 Conclusions .............................................................................................. 9 Appendix A – Product Sketch (July 7)........................................................ 10 Appendix B – C Code .................................................................................. 11 PRETTY BOY PROJECTS Creators of the Vendor 38-0 1 Introduction 1.1 Introduction In partial fulfillment of the course requirements for Electromechanical Systems 4933, the group of Nathan Cooke, Nicholas Croke, Mark Lynch and Mark Sutton successfully constructed a small-scale vending machine. The group advertised their functional prototype as the “Pretty Boy Vendor 38-0” and the incorporation of a number of “mechatronic” components in the machine’s design made the Pretty Boy Vendor a suitable term project. The mechanical arrangement of the Pretty Boy 38-0 and the use of actuators, microcontrollers, and additional electrical components will be discussed in the following report. The Pretty Boy Projects Team would also like to draw attention to the evolution of the Vendor 38-0’s design and possible improvements should the team decide to continue the project in the future. 1.2 Objective The purpose of the Pretty Boy Vendor 38-0 project is to demonstrate the mechatronic equipment and techniques included in the every-day vending machine. The modern vending machine incorporates a variety of different functions and the internal mechanics of a conventional machine are more complicated than most people realize. The group visited several vending machine suppliers including Kool-Rite Ltd. and Avalon Vending Services before deciding upon the Vendor 38-0’s final design. The most significant difference between the Pretty Boy Vendor and the convention machine is the power of the dispensing motors. The stepper motors used in the Vendor 38-0 were much -1- PRETTY BOY PROJECTS Creators of the Vendor 38-0 smaller than those used in larger machines. For this reason, the capacity of the Pretty Boy Vendor was reduced to ensure that the smaller motor still has sufficient power to rotate a can out from the bottom of the stack. A more detailed description of the design is available in the next section. 2 Project Design 2.1 Project Description The team at Pretty Boy Projects created the Pretty Boy Vendor 38-0. This is your typical drink vending machine scaled down. Basically this vending machine contains all the essentials to dispense a can plus a few novelties (ex. LCD display), however, it does not contain a money slot or a refrigeration system as they are not necessary for this course. On one side of the Pretty Boy Vendor 38-0 are the electrical components, where the machine takes the input from the buttons and outputs signals to the motors and the LCD display. On the other side of the vending machine are the mechanical components. This is where the cans are placed and the motors operate in order to dispense a can. Since Pretty Boy Projects created this machine for demonstrational purposes, the front was made from lexan in order to allow viewers to see in real time how the insides of the Pretty Boy Vendor 38-0 functions. 2.2 Design Specifications Each cam is powered by one stepper motor connected to a 12V battery source. The cans are placed in columns which can hold four cans, however, the size of the -2- PRETTY BOY PROJECTS Creators of the Vendor 38-0 stepper motor limits our capacity to three cans for each column. The vending machine is 16” long by 16” wide by 19” high. The cams are 6.5” long. From the time a button is pressed, it takes three seconds to dispense a can. 2.3 Design Iterations The objectives for Pretty Boy Projects were to build a vending machine and there were many ways to execute this task. With little knowledge about vending machines the team decided to seek answers from the experts. After visiting Avalon Vending and KoolRite Ltd., Pretty Boy Projects had a few options for their vending machine. The early day machines did not use any electronics and over time they became more complex. Today the machines take a lot of engineering and design and can become extremely complicated. One specific problem the team had to deal with was how to get the motors to stop at right time in order to dispense one can at a time. The first idea was to put notches in the cams so that after the motor passes each notch it would stop, this however did not meet the course requirements and was too simple. The next two ideas were to either have the cams spin 360 degrees each time or to have a sensor in the vending machine that would stop the motor when the dispensed can would fall on it. After much contemplation the team went with spinning the motors 360 degrees each time in order to provide a constant and predictable vending machine. There was one other idea to solve this problem; it was a laser sensor that would stop the motor as the can passed through the laser. This was outside the scope of the Pretty Boy Vendor 38-0 and was not given much thought. This vending machine is based on today’s conventional vending machine. -3- PRETTY BOY PROJECTS Creators of the Vendor 38-0 It has a good mixture of electrical and mechanical components and meets the requirements of the course Electromechanical Systems 4933. 3 Final Product 3.1 Hardware Components Mechanical The vending machine consists of a 19” x 16” x 16” (height/width/depth) wooden box acting as the supporting frame. The drink columns (2) are made up of three pieces of sheet metal mounted to the back of the box. These extend three quarters of the way out to the front, and are supported at the free end by two pieces of sheet metal running from the sides to improve stability. At the base of the frame is a sheet metal catch pan, angled towards the front of the box. Two ‘U’ shaped cams made from rolled sheet metal lie underneath the columns and above the catch pan, acting as the dispensing mechanism. These were mated to two stepper motors attached to the back wall, using machined aluminum cylinders. Three normally open buttons were used in the operation of the vending machine. The two responsible for controlling the stepper motors were mounted into lexan glass at the front, while the other was mounted in front of the catch pan. The latter was used for the detection of a can, and was protected by a spring and lever mechanism. Electrical A single PIC16F877 microcontroller was used to relay the input information to the motors and LCD screen, and was placed in a blocked off compartment. An additional -4- PRETTY BOY PROJECTS Creators of the Vendor 38-0 H-Bridge was incorporated off of Port C to run the second stepper motor. The board and motors were powered by a 12 volt battery. The 2 x 16 LCD display required only an AC adapter to display greetings and vend status. 3.2 Programming The main function of our code was to continuously sweep through a loop looking for inputs from the two stepper motor buttons while displaying a scrolling greeting on an LCD display. Once either button was pressed, the respective stepper motor would make one full rotation, and the status would be updated on the display. Before stepping back into the original loop, the controller would look for the third button to be pressed, to determine whether to display a sold out or thank you message. See Appendix B for the complete C code. 4 Difficulties Encountered 4.1 Problems/Difficulties The majority of problems encountered by the Pretty Boy Team related to the sensitivity of the electrical components used. Transportation of the machine frequently resulted in loose connections and damage to fragile hardware such as the LCD display. Loose connections were often difficult to find due to the PIC controller’s orientation within the box and diagnosing such problems often resulted in substantial disassembly and troubleshooting. Although the group had the electrical components working as -5- PRETTY BOY PROJECTS Creators of the Vendor 38-0 planned a week prior to the presentation, damage to components required the replacement of the LCD and the PIC board before the final presentation could be made. Additional difficulties were also discovered when implementing the “sold-out” switch. The force from a can rolling down the catch pan proved to be too large for the switch to resist and occasionally the epoxy securing the switch in place would let go. To correct the problem a spring was added to the trip switch assembly which effectively dampens the force from the can while still allowing the switch to be pressed. The spring also aids in the rebound of the switch (back to the open position) when the weight of the can is removed. Some of our less significant design problems included the effective orientation of components within the vending cabinet (box) since we had limited lexan to use for the front face and had to maximize the usage of interior space. Furthermore, getting the “please make a selection” command to scroll across the LCD required trial and error and some ingenuity from the group members. 4.2 Trade-offs The original Pretty Boy Vendor proposal specified a vending machine with three different selections. This original plan had to be scaled back to only two columns (i.e. two selections) due to confined space within the cabinet and accessibility to electrical components. Powering a third stepper motor would have required an additional H-bridge and the Technical Services Department did not have any extra H-bridges available at the time of construction. Nonetheless, the use of two stepper motors effectively demonstrated -6- PRETTY BOY PROJECTS Creators of the Vendor 38-0 that the group was capable of implementing multiple independent operating stepper motors. The common trade-off between stepper motor torque and stepper motor speed was also analyzed by the Pretty Boy Team. Speed of vending is an obvious design consideration but increasing speed decreases torque to a point where the motor can no longer successfully rotate the weight of a can. After experimentation the group decided upon a delay of ten milliseconds for each motor which resulted in a total vending time of approximately three seconds. 5 Improvements and Recommendations 5.1 Improvements Although the finished prototype of the Pretty Boy Vendor 38-0 was a successful product that served its purpose for this project, there is still room for improvement. In terms of performance, the vending machine functioned very well. But, when considering producing the machine as a commercial item, the team realizes that improvements can be made in cost efficiency and in the overall sustainability of the machine. The cams, the component that dispensed the beverage from the column down to the catch pan for retrieval, could have been made sturdier. The vending machine was designed to hold four cans of beer in each of the two columns. While performing tests, the cams occasionally struggled to complete their required revolution and dispense a beer while there were four cans stacked in the column. Reinforced cams could be a possible solution for this problem. Also, larger stepper motors would help to enable the cams to -7- PRETTY BOY PROJECTS Creators of the Vendor 38-0 rotate while under greater amounts of force. In the typical modern day vending machine, larger steeper motors are used that require greater power input than that of the prototype vendor. Another area for improvement would be to minimize all open space. The Pretty Boy Vendor 38-0 was designed to be a smaller representation of a conventional vending machine. Even though the machine is fairly portable and light weight, it can be made more cost efficient by making the cabinet more compact. Empty space between the column and the cabinet wall could be reduced which in turn would reduce significant amount of sheet metal, wood and lexan needed to build the vending machine. 5.2 Recommendations If the Pretty Boy Projects team were to turn the Pretty Boy Vendor 38-0 into a viable commercial product, several recommendations would have to be considered. The purpose of the vending machine is to give the consumer access to the beverage that they choose. For a typical beer consumer, he or she prefers that the product is cold and refreshing. To provide this quality to the cans, the Pretty Boy would recommend the insertion of a refrigeration unit which would keep the beers refreshingly cold. The refrigeration unit could be attached to the side of the cabinet facing the two columns. To turn this into a commercial product, the obvious suggestion would be to develop a coin operating mechanism for the machine. This mechanism would be a complicated addition but would still be a realistic option. For the purpose of the term project, the Pretty Boy Vendor 38-0 already demonstrated the fundamentals of electro -8- PRETTY BOY PROJECTS Creators of the Vendor 38-0 mechanics. The coin mechanism would require extra resources that were not available to the Pretty Boy team and would also be prove to be very expensive. 6 Conclusions Our final product was much like we intended it to be from the beginning. Minor changes in design and implementation were made throughout the process as obstacles were met; however this had little impact on the overall functionality of our product. From researching and examining existing vending machines we found that they all function in a similar way, and while complexity varied throughout the different models, the overall layout was the same. We felt that a smaller scale vending machine would be suitable to emulate and demonstrate all of the important components and processes found in any full size machine. The main restrictions were the torque needed from the motors and the limited number of motors that our PIC board could handle. The code required to operate the machine was fairly simple, and could easily be altered to suit a much bigger machine. -9- PRETTY BOY PROJECTS Creators of the Vendor 38-0 Appendix A - 10 - PRETTY BOY PROJECTS Creators of the Vendor 38-0 Appendix B //* This program runs a stepper motor connected to bits B1-B4. *// #include<16F877.H> //Using the PIC 16F873 #device adc=10; //Set ADC to 10 bit #fuses HS,NOWDT,NOPROTECT,NOBROWNOUT,NOPUT //Configuration Fuses #use delay(clock=20000000) //20Mhz Clock //#use i2c(Master,sda=PIN_C4,scl=PIN_C3) #use rs232(baud=9600,xmit=PIN_c6,rcv=PIN_C7,PARITY=N,BITS=8)//Use RS-232 #org 0x1F00,0x1FFF{} //Reserve Memory for Bootloader //#USE FIXED_IO(B_outputs=PIN_B4,PIN_B3,PIN_B2,PIN_B1)//Set pin B4,B3,B2,B1 for output //#USE FIXED_IO(C_outputs=PIN_C4,PIN_C3,PIN_C2,PIN_C1)//Set pin C4,C3,C2,C1 for output #include <lcd.c> //include LCD Driver // PORT B bits 1 to 4 will be connected to The L298 H-Bridge inputs // The following 8 bit words will be output to PORT B in forward or reverse // order to control the movement of the stepper motor. BYTE const step_number[4] = {0b00010100, 0b00010010, 0b00001010, 0b00001100}; int8 step = 0; //Holds current step for step_number table. int8 step2 = 0; int16 i,p=0; int16 conversion; void lcd_scroll_left(void){ lcd_send_byte(0, 0x18); } void main(){ PORT_B_PULLUPS(True); //enable_interrupts(INT_AD); enable_interrupts(global); enable_interrupts(INT_TIMER2); //Enable internal Pullup resistors on Port B setup_timer_2(T2_DIV_BY_4,254,10); //setup ADC for 20 mhz on Channel 0 setup_adc_ports(ALL_ANALOG); setup_adc(ADC_CLOCK_DIV_32); set_adc_channel(0); //initialize LCD lcd_init(); printf(lcd_putc,"\f Please make a selection. for(;;){ delay_ms(300); lcd_scroll_left(); - 11 - Pretty Boy Vendor 38-0"); PRETTY BOY PROJECTS Creators of the Vendor 38-0 OUTPUT_B(0b00000000); OUTPUT_C(0b00000000); //Motor off //Motor off //PORT B - MOLSON CANADIAN while(!input(pin_b7)){ printf(lcd_putc,"\fMolson Canadian"); delay_ms(1500); printf(lcd_putc,"\f"); for (i=0;i<200;++i){ step = ++step; //increment position in step sequence. lcd_gotoxy(1,1); printf(lcd_putc,"Vending..."); if (step > 3) step = 0; //After step four, start at step 1 again. OUTPUT_B(step_number[step]); //send step to port B. delay_ms(10); //delay 10ms to set speed at 100 steps per second. } delay_ms(1000); if(!input(pin_b5)){ printf(lcd_putc,"\f Thank You!"); delay_ms(3000);} else{ printf(lcd_putc,"\f Sold Out"); delay_ms(3000);} printf(lcd_putc,"\f Please make a selection. Pretty Boy Vendor 38-0"); } // PORT C - COORS LIGHT while(!input(pin_b6)){ printf(lcd_putc,"\fCoors Light"); delay_ms(1500); printf(lcd_putc,"\f"); for (i=0;i<200;++i){ step2 = ++step2; //increment position in step sequence. lcd_gotoxy(1,1); printf(lcd_putc,"Vending..."); if (step2 > 3) step2 = 0; //After step four, start at step 1 again. OUTPUT_C(step_number[step2]); //send step to port B. delay_ms(10); //delay 10ms to set speed at 100 steps per second. } delay_ms(1000); if(!input(pin_b5)){ printf(lcd_putc,"\f Thank You!"); delay_ms(3000);} else{ printf(lcd_putc,"\f Sold Out"); delay_ms(3000);} printf(lcd_putc,"\f Please make a selection. Pretty Boy Vendor 38-0"); } } } - 12 -