BeAM Prototype & Final Report José David González Martinez A00749946 Jorge Quintana Juarez A00756482 Juan Carlos Rangel Saldivar A00756292 Technological Institute of Superior Studies Campus Chihuahua Dr. Rodolfo J. Castelló Zetina
Jan 30, 2016
BeAM Prototype & Final Report
José David González Martinez A00749946
Jorge Quintana Juarez A00756482
Juan Carlos Rangel Saldivar A00756292
Technological Institute of Superior Studies Campus Chihuahua
Dr. Rodolfo J. Castelló Zetina
Microcontrollers Prototype & Final Report 2015
Page 1
Microcontrollers
Dr. Rodolfo J. Castelló Zetina
Subject’s Final Report: Product
Requirements & Specifications
Engineering School Project
Technological Institute of Superior Studies of Monterrey Chihuahua, Chihuahua, Mexico
Finished on November 30, 2015 IEEE Stud 830-1993
Abstract: The contents and the problem analysis of the product are described in the
following text, as well as a detailed description of the software and hardware created and implemented to develop the final aspects of the project. It also describes the implementation of the final code and the tests that were taken in order to deliver the final
product. Included in this report, a user’s manual can be found, detailing all the functionalities and the instructions that must be followed to enjoy the automated mixer
machine. Keywords: automation, technology, mixer, beverages, bartender, solenoid, LCD, matrix keyboard, microcontroller.
_________________________
ITESM, Campus Chihuahua, Mexico. Av. Heroico Colegio Militar 4700, Col Nombre de Dios, Chihuahua, CUU, MEX.
2015. Jorge Quintana, José Gonzales, Juan Rangel.
Microcontrollers Prototype & Final Report 2015
Page 2
Introduction
Summary
BeAM is a project directed to the automation and mass production of mixed
beverages with the option to create different drinks thanks to its capability to use any bottle with standard design. A product controlled by a microcontroller and with a perfect interface for users who desire to make beverages at their own house or for places where you can
serve drinks such as pubs or special events.
Purpose
Nowadays, the industry sector and big companies are functioning with the use of technologies, principally automated machines, whether by creating their products or by selling them as their products. But in the lower sectors, there are still many different
processes which form part of our daily life and that have deficiencies that could be corrected through automation. We could take on account the food area where there are
processes where it would be useful to control the exact portions and the preparation method. Because of these problems, we have proposed the creation of an automatic beverage dispenser machine. This project will have the final purpose of creating different
combinations of beverages, in a totally automatized form, having a desired market of common places like houses, restaurants and bars for social interaction.
Scope
The project’s final aim is to build and automate a drink mixer that can comply with the specifications proposed in this report. The criteria that BeAM, the Beverage Automated
Machine is going to be based on, is the one that defines and combines the quality and functionality of the service and of the product per se, compelling with the standards that the industry defines.
The stakeholders of BeAM (Table 1) have also been taken on account, as they serve
as the project motor, as they impulse the project termination and seek that it is delivered on time.
Stakeholders Interest
Dr. Rodolfo J. Castelló Z. Supervisor
José D. González M. Developer
Jorge Quintana J. Developer
Juan C. Rangel S. Developer
Project Developers Clients Table 1: Stakeholder management
Microcontrollers Prototype & Final Report 2015
Page 3
As the owners of BeAM and developers, we seek to deliver the project as a school
deliverable. This means that we are considered as the clients, as there is no intention of selling it or obtaining monetary gain at the moment.
For organizational purposes and a better development of BeAM, it was decided to
assign roles and administrate the capacities that each developer has, in order to deliver a
better product, as described in Table 2.
Resource Name Task
Jorge Quintana Software supervisor
Software developer Designer
Time Administrator
José González Software developer Hardware constructor Circuitry supervisor
Design supervisor
Juan Rangel Software developer Material administrator
Document administrator Circuitry supervisor
Table 2: Resource management
With BeAM, the user is able to prepare a beverage by selecting a set of pre-established combinations with different characteristics, so the user can finally have a
refreshing beverage at the end of the process. With the use of alcoholic beverages and mixers, users have the possibility of using the predefined option modes for the beverages, or change to a desired set of bottles and mixers, by changing them and play with the
combinations.
Its design is perfect to be used on pubs, households, and events, to serve as an “automatized bartender” because of its simplicity and functionality.
Figure 1: BeAM proposed model.
Microcontrollers Prototype & Final Report 2015
Page 4
BeAM can be directed to the mass production of mixed beverages and can be
modified to be able create different drinks. The principal benefit of the design, shown in Figure 1, is the cost, which is less, compared with a design implemented with electronic
valves. It is also very modifiable in the sense that it’s possible to add more serving hoses to improve the production. Another advantage is that the drink containers can be easily changed.
Document description
1. General descriptions: This section revises the perspective that the users have on the
product so it can compete with different models that can be found on the market. It also provides a brief but detailed description of the product, the features that relate with the user and the reasons behind its development.
2. Specific Requirements: A detailed description of all the product’s functional
requirements as well as any required constraint for its implementation (non-functional requirements). It provides a formal specification of the functional requirements through the usage of the state chart notation.
3. Design: Phase based on the information provided by the analysis phase. Composed
by two sections: software design and hardware design. The state chart notation is used as the foundation for the software design. It provides a detailed description and justification of the software structure. For hardware design, each and every device
that was used to develop the project is listed and described. A detailed description of the hardware design that was used is provided; it includes design and
construction of subcomponents. This section shows the design phase in a clear, complete, and correct manner.
4. Implementation: Provides a well-documented and complete code, so that any embedded software engineer can easily understand the program through the usage
of the corresponding documents. The code described in this section is able to correctly compile without the necessity of making any change.
5. Testing: A wide and complete description as well as the expected and corresponding results of all the tests that were implemented in order to guarantee the functionality
of the product. The degree of reliability for the delivered version of the product is established, as well as any future test case. Not satisfactory tests are shown and describe how these results affected the development process.
6. User’s Manual: It is the main guide in order to use and handle the delivered
prototype version of the product. It describes the way to work with the product, the valid data or information to be introduced, as well as the expected results. This section is supported by snapshots of the complete interaction between the user and
the product.
Microcontrollers Prototype & Final Report 2015
Page 5
7. Final Considerations: It describes all the proper information that was produced as
result of the product development. It presents the results, its correctness estimation, and its application and interpretation. This section shows the results that were
obtained with respect to the original problem. It also states the success that was achieved with the project, i.e., what was the development process that was followed, which were its advantages and obstacles that were had to sort, and a synthesis of the
knowledge, skills, and competencies that the team developed in order to achieve the goal. It establishes the recommendations regarding the aspects that need to be
developed in the future, extendedly describing the functional and nonfunctional requirements recommended for a future version of the project, as well as the implications in the scope of the problem.
Developing Tools
For the developing and control of the project’s automatic response, a CASE tool
was needed in order to use a microcontroller. The tool that was implemented was MPLAB X IDE v3.05, as it was designed specifically to work with the microcontroller implemented in this project.
MPLAB X IDE is a software program that runs on a PC to develop applications for
Microchip microcontrollers and digital signal controllers. It is called an Integrated Development Environment (IDE), because it provides a single integrated "environment" to develop code for embedded microcontrollers.[11]
Definitions, acronyms y abbreviates
Solenoid: Is a coil of insulated or enameled wire wound on a rod-shaped form made of solid iron, solid steel, or powdered iron. This device can be used as
electromagnet or inductor. [1] When it detects the electrical signal, it is activated and performs and action.
LCD: (Liquid Crystal Display) It’s an user interface, that consists of rod-shaped
molecules in between the plates align into two different physical positions based on
the electric charge applied to them. When the electric charge is applied, they align to block the light entering through them, whereas, when no-charge is applied, they
became transparent. They are simple but with a lot of possibilities. [2]
Matrix Keyboard: This is the user interface to control the system. Keyboards use a
matrix with rows and columns made up of wires that on each key acts like a switch. The Matrix Keyboard implemented on this project has a matrix of 4x4. [3]
Infrared Sensor: This is an electrical sensor that detects light. Infrared Sensors work
by using a specific light sensor to detect a select light wavelength in the Infra-Red
spectrum. By using a LED which produces light at the same wavelength as what the sensor is looking. When an object is close to the sensor, the light from the LED
Microcontrollers Prototype & Final Report 2015
Page 6
bounces off the object and into the light sensor. This results in a large jump in the
intensity, which we already know can be detected using a threshold. [4]
Microcontroller: Embedded systems or real time systems configured to perform a dedicated and specific application. This is a computer with all its components, and it allows us to create a project with programming. [5]
Microcontrollers Prototype & Final Report 2015
Page 7
Contents
1. General Descriptions............................................................................................................ 9 1.1 Product Perspective............................................................................................................. 9 1.2 Product Functionalities .......................................................................................................10 1.2.1 Option modes................................................................................................................10 1.3 User Features.....................................................................................................................11 1.4 Predispositions and Dependencies .......................................................................................11
2. Specific Requirements........................................................................................................ 12 2.1 Informal Description ..........................................................................................................12 2.1.1 Functional Requirements ...............................................................................................12 2.1.1.1 Text Description .......................................................................................................12 2.1.1.2 Inputs.......................................................................................................................13 2.1.1.3 Processing ................................................................................................................13 2.1.1.4 Outputs ....................................................................................................................14 2.1.2 Design Constraints ........................................................................................................16 2.1.2.1 Material ...................................................................................................................16 2.1.3 Quality aspects of the product ........................................................................................16 2.2 Formal Description ............................................................................................................17 2.2.1 Explanation...................................................................................................................18
3. Design ................................................................................................................................ 19 3.1 Software............................................................................................................................19 3.1.1 Pseudocode ...................................................................................................................20 3.2 Hardware ..........................................................................................................................22 4. Implementation.................................................................................................................. 43
5. Verification and Validation................................................................................................ 43 5.1 Test 1 ................................................................................................................................44 5.2 Test 2 ................................................................................................................................44 5.3 Test 3 ................................................................................................................................45 5.4 Test 4 ................................................................................................................................46
6. User’s Manual.................................................................................................................... 49 7. Prototype & Final Considerations...................................................................................... 52
8. References.......................................................................................................................... 54
Microcontrollers Prototype & Final Report 2015
Page 8
List of Tables
Table 1: Stakeholder management .............................................................................................. 2
Table 2: Resource management .................................................................................................. 3
Table 3: Competitive Products ................................................................................................... 9
Table 4: Mixing Method ...........................................................................................................11
Table 5: Informal specification ..................................................................................................15
Table 6: Hardware Implementation............................................................................................23
Table 7: Tests error corrections .................................................................................................47
Table 8: Accomplished Specifications .......................................................................................52
List of Figures
Figure 1: BeAM proposed model. ............................................................................................... 3
Figure 2: Beverage Mixing Process ............................................................................................ 9
Figure 3: Bottle administration system .......................................................................................10
Figure 4: Serving mechanism. ...................................................................................................13
Figure 5: State chart..................................................................................................................17
Figure 6: I/O Ports Configuration ..............................................................................................19
Figure 7: First Code Compilation ..............................................................................................43
Figure 8: Matrix Keyboard and LCD testing Figure 9: Instruction Testing ...........................44
Figure 10: Microcontroller assembly .........................................................................................45
Figure 11: Soldering boards testing............................................................................................45
Figure 12: LCD welcoming message .........................................................................................45
Figure 13: Working Solenoids ...................................................................................................46
Figure 14: Proximity Sensor......................................................................................................46
Figure 15: Conveyor Belt ..........................................................................................................46
Figure 16: Control Panel ...........................................................................................................48
Figure 17: Bottle accommodation Figure 18: Glass at start position .....................................49
Figure 19: Power button Figure 20: Initial message display ..........................................50
Figure 21: Selection Menu ........................................................................................................50
Figure 22: Mixing process.........................................................................................................51
Microcontrollers Prototype & Final Report 2015
Page 9
1. General Descriptions
1.1 Product Perspective
BeAM, after the previous installation, is independent and self-sufficient, as it only
needs correct maintenance to work properly. We can find a lot of examples that are similar and do the same task, but with different techniques as shown in the table below (Table 3).
Product Functionalities
MyFountain An automated drink-pouring machine. It’s built on top of a mini fridge, and is filled with 12 kinds of liquor. Drinks recipes can be programmed
through a touch screen or loaded online. The machine pours your drink into a glass, and then uses water to clean the nozzle for the next cocktail.[6]
Bartendro This crowdfunded machine is made by Party Robotics. It works with a
tablet or smartphone, comes with an open-source cocktail menu, and can serve more than 200 drinks in an evening. It also cleans up in as little as 5
minutes. They key to Bartendro are Pumps. Elaborate pumps, software, food-grade plastic tubing, and the brain that is the Raspberry Pi all combine with a user-supplied array of liquor to make a machine that
dispenses cocktails. Given the open nature of the programming, it’s customizable.[6]
Table 3: Competitive Products
BeAM has some differences, because some products have a system (Figure 2) in which all the beverages go to the same funnel, and in other cases the glass go to each bottle
to receive the portion of beverage. Another difference that it is found is the different types of valves that exist on market. BeAM uses normal water valves that are pressed with the
action of a solenoid.
Figure 2: Beverage Mixing Process
Microcontrollers Prototype & Final Report 2015
Page 10
1.2 Product Functionalities
This product is simple, because it has the single objective of making and mixing
drinks. It doesn’t have product functionalities as interfaces on any part of the project. It only has different operational modes that allow making the 4 pre-established types of
mixing combinations.
1.2.1 Option modes:
BeAM has different operational modes; because it depends of the type of beverages
that the user wants and because the bottles can be easily changed (Figure 3). The system works in a pre-established set of 4 different combinations that give the user the possibility
of mixing two or three different bottles, depending on the selected mode:
Mix A: Mixes bottle 1 and 3
Mix B: Mixes bottles 1 and 5. Mix C: Mixes bottles 2 and 3.
Mix D: Mixes bottles 2, 4, and 5.
These pre-established combinations, that are selected with the implemented matrix keyboard, allow the users to play with their own combinations, as the bottles can be easily
exchanged whenever is needed, and it is recommended to use the first two spaces to place alcoholic beverages, as the combinations are arranged so slots 1 and 2 pour 45 ml of liquid into the glass, instead of the 310ml, 155ml and 100ml that slots 3, 4 and 5 can pour
respectively. The mixing method is completely described in Table 4:
Figure 3: Bottle administration system
1
2
3
4
5
Microcontrollers Prototype & Final Report 2015
Page 11
Slot
Combination 1 2 3 4 5
A Pours 45ml - Mix 310ml - -
B Pours 45ml - - - Pours 100ml
C - Pours 45ml Pours 310ml - -
D - Pours 45ml - Pours 155ml Mix 100ml
Table 4: Mixing Method
1.3 User Features
Users only need to be familiarized with the process of beverage mixing. The user
has to put the glass on the right position, and then select the desired type of mix and BeAM and its automatized system can prepare the drink, so the user can take his drink and enjoy.
Users don’t need to have “bartender’s knowledge”, as the machine will display the name of the combination, which can be selected through the matrix keyboard.
1.4 Predispositions and Dependencies
The prototype for mixed drinks consists of a conveyor belt that runs through a motor to bring vessels into the filling area. When the vessel arrives at the filling location,
the drinks are mixed with different proportions that are previously selected (taking into account the size of the glass and drink to be prepared).Then, the various ingredients are mixed in the funnel to finally serve the drink, (this will depend on the taste of the person
and each will have a combination of different beverages as described in Table 4), opening the valves depending on the amount selected and previously calculated. Drinks that are
used for mixing will be used in their original containers, with the addition of a nozzle; this in order to adapt the prototype so that almost any bottle can be easily implemented by the user.
To create the program that is going to control BeAM, tests are going to be
implemented so the time in which different beverages take to fill the glass is the correct time and quantity. This way the different mixes can be calculated.
Microcontrollers Prototype & Final Report 2015
Page 12
2. Specific Requirements
2.1 Informal Description
2.1.1 Functional Requirements
2.1.1.1 Text Description
1. Initialize all the system when the ON Button is pressed. At this
time the Matrix Keyboard is enabled, the bottle and the Conveyor
belt LEDs can be turned on with the light switch and the LCD displays the message: “Welcome to BeAM”.
2. The LCD displays the four different selection modes, the user puts
a glass on the start position and selects the “Optional Mode” (see
page 10).
3. After the user writes the instructions on the Matrix Keyboard, the LCD puts the message “Making Beverage” and powers on the Conveyor belt Motor to move the glass to the service position.
4. The service sensor detects the glass and the Conveyor belt motor
is powered off. The solenoids are activated one by one, depending
on the selected configuration (Table 4). When a Solenoid is activated a specific amount of Beverage is served to the glass and
on this way the mix is done; when the Beverage is done, the system waits 3 seconds to take care about the drip, and then the Conveyor belt Motor is powered on again to move the glass to the
delivery position. The timer is reset.
5. The delivery sensor detects the glass and the Conveyor belt motor is powered off. The LCD displays the message: “Take your Beverage”.
6. When the user takes the beverage, the cycle initializes again and
the system is ready to make another beverage.
7. The Conveyor belt light switch can be activated by the user at any
time, and it powers on/off the Conveyor belt LEDs.
8. The Off button deactivates the complete system, including the LCD, Matrix Keyboard and the bottle and Conveyor belt LEDs.
9. The system has 5 solenoids for the bottles, these solenoids are Solenoid0, Solenoid1, Solenoid2, Solenoid3 and Solenoid4, the
Microcontrollers Prototype & Final Report 2015
Page 13
number of the solenoid is represented by the variable X on the
state chart (Figure 5).
2.1.1.2 Inputs 1. On/off button.
2. Infrared sensor of presence at the service position. 3. Infrared sensor of presence at the delivery position.
4. Matrix Keyboard. 5. Alcoholic beverages 6. Glasses.
2.1.1.3 Processing (Figure 4)
Figure 4: Serving mechanism.
2.1.1.4 Outputs
1. 5 Solenoids 2. LEDs to illuminate the Conveyor belt.
3. LEDs to illuminate each bottle. 4. LCD with Hatachi HD44780 driver.
5. Conveyor belt Motor (DC Motor 90V).
Microcontrollers Prototype & Final Report 2015
Page 14
An informal specification of the product functions is provided below
in Table 5:
Introduction Inputs Processing Outputs
1 Detect the signal of the
user by the Power On
Button.
Power on Button.
Initialize the whole system.
LCD turns on. Matrix Keyboard
Enables. Bottles LEDs
power on. Conveyor belt
LEDs are
energized
2 Receive the
values for the beverage.
Matrix
Keyboard.
The LCD puts the
message “Making Beverage” and power on the Conveyor belt
Motor to move the glass.
Type of mix.
LCD messages. Conveyor belt
Motor turns on.
3 Detect the signal of the Service
Sensor by the glass.
Service Sensor.
Type of
beverage. Variable “X”
Stop the Conveyor belt Motor and activate the Solenoids previously
selected on the type of beverage. The variable
X can have the values of 0-4, on this way the five solenoids can be
selected.
Conveyor belt Motor turns off.
Activate
SolenoidX (one by one).
4 Counting
seconds.
Timer. Accumulate number of
seconds.
Amount of
seconds.
5 All Solenoid previously
selected (depends of
the type of beverage) put the kind
of beverage for the mix.
Sequence of activating
Solenoid finished.
Amount of seconds.
Variable “X”
The Solenoids served the mixed beverage
during the amount of seconds previously
programmed; Wait an amount of seconds (3s); the Conveyor belt
Motor turns on to move the glass to the delivery
place and the Timer is Reset.
Deactivate SolenoidX (one
by one). Conveyor belt
Motor turn on. Reset Timer.
6 Detect the Delivery The Conveyor belt Conveyor belt
Microcontrollers Prototype & Final Report 2015
Page 15
signal of the
Delivery Sensor by the
glass.
Sensor. Motor powers off and
the LCD displays the message to the user that
the beverage is ready
Motor turns off.
LCD messages.
7 Detect the signal of the
Delivery Sensor when
the user takes the glass.
Delivery Sensor.
The cycle initializes again and the system is
ready to make another beverage. The LCD put
the message to put another glass and press the Start Button.
LCD messages.
8 Detect the signal of turn
on the Conveyor belt Light
Switch.
Conveyor belt Light
Switch. Conveyor
belt LEDs
energized.
Turn on the light for the Conveyor belt.
Conveyor belt LEDs turn on.
9 Detect the
power off signal of the Conveyor
belt Light Switch.
Conveyor
belt Light Switch.
Conveyor
belt LEDs energized.
Power off the light for
the Conveyor belt.
*Conveyor belt
LEDs power off.
10 Detect the off button signal.
Off Button. Power off the complete system.
LCD powers off.
Matrix
Keyboard disables.
Bottles LEDs power off.
Conveyor belt LEDs
not energized.
Table 5: Informal specification
Microcontrollers Prototype & Final Report 2015
Page 16
2.1.2 Design Constraints
2.1.2.1 Material
1. Buttons. 2. Two Infrared sensors.
3. Matrix Keyboard 4x4. 4. Five Solenoids with his faucet system.
5. White LEDs to illuminate the Conveyor belt. 6. Color LEDs to illuminate each bottle. 7. LCD with Hatachi HD44780 driver.
8. Conveyor belt Motor (DC Motor 90V). 9. Voltage Sources.
2.1.3 Quality aspects of the product (Non-Functional Requirements)
Safety. - After the user puts the glass and starts the process, the system
is completely automated and doesn’t need that the user takes the glass or
move it to other position, BeAM is going to do everything.
Maintainability. - This product only accepts five different kinds of
bottles at the same time, and for using, BeAM, the user only needs to
concern about the bottles having sufficient beverage, because the system
can’t measure the level of the bottle liquid.
Portability. - This product has a big size, but has sufficient portability if
the user takes off the bottles. So the user can move BeAM to the desired
place.
User Friendliness.- This product has different constraints about his use:
a) The bottles need a preparation before they can be used on the
system. If the user wants to use a plastic bottle on this system it
only needs a little hole on the bottom of the bottle before turning it
over and adapting it to the dispenser on BeAM because this system
uses gravity and needs breathing. In case that the user wants to use
a crystal bottle (like on alcohol bottles), it is necessary to use the
special dispenser that this system includes to provide the breathing
to this kind of bottle.
Microcontrollers Prototype & Final Report 2015
Page 17
b) This product uses standard dispensers to adapt the bottles. The
dispensers are the most common using nozzles on the pub industry
by the bartenders, so they can be used with almost any kind of
bottle of alcohol or soda.
2.2 Formal Description
Figure 5: State chart
2.2.1 Explanation
This system (Figure 5) starts working when the on button is pressed by the user, this transition also energizes the system and initializes the variable X=0. The On State Starts the subcomponents of the system: The LCD, Matrix Keyboard, Solenoids, Conveyor
belt Motor, Timer and Conveyor belt Legs. The LCD is going to print the processes of the
Microcontrollers Prototype & Final Report 2015
Page 18
realization of the drink. First print the welcome message to the user, then is going to ask for
the optional modes, and then while the system is making the drink is going to display the print message “Making Beverage”, when the drink is ready, the LCD prints the instruction
to the user to take his beverage. The Matrix Keyboard is enabled always on the process, and when a button is pressed it sends the signal.
The Solenoid powers off, and when the glass is on the service position, the service sensor detects the glass and powers on the solenoid, first the Solenoid0, because the
value of X is 0, the solenoid powers on while the timer is counting, depending of the programming , and then powers off and the variable adds 1 to the variable X, so next time the Solenoid1 is on, after the 5 solenoids do their work, the variable X is 5 and that
represents when the solenoid sequence is finished and the drink is ready.
The Conveyor belt motor powers off and powers on in two cases, when the required values are ready or, when the variable X is equal to 5 and the counting finished to count 3 seconds. And the Conveyor belt motor powers off when the delivery sensor detects
the glass or, when the service sensor detects the glass and the variable X is equal to 0 (This represent that the process is on the first part).
The Timer powers off and starts counting when a solenoid is on or when the
variable X is equal to 5, and finishes its counting depends on the programming, always
when the counting finishes it resets this value.
The Conveyor belt LEDs are always enabled, and these LEDs are powered on when the user activates the Conveyor belt Light switch, and are powered off when the user deactivates the Conveyor belt Light switch.
Microcontrollers Prototype & Final Report 2015
Page 19
3. Design
3.1 Software
The Software is going to be implemented by the program MPLAB X. This software
needs some configurations to compile and run a code. The clock oscillation configuration that is going to be used is the internal at 4MHz (default configuration); because the project doesn’t need a specific time to perform his objective. The 4MHz provided by the
PIC18F4585 are ideal for this program. The first step is configuring the PIC18 to work with all digital I/O. For this project
we are going to use all the PORTB pins for the matrix keyboard and all the PORTD along with the first three pins of PORTC for the LCD. The other ports are going to be implemented to declare the inputs and outputs (Figure 6) for BeAM. [8] [9] [10]
Figure 6: I/O Ports Configuration
Microcontrollers Prototype & Final Report 2015
Page 20
Then when the initial configuration is ready and all the ports and variables are
declared, the process of serving and mixing are going to start, as we can see on the next Pseudocode:
3.1.1 Pseudocode
Include .inc file Configure to work with an internal clock oscillator of 4MHz.
Configure all Ports as Digital I/O. Configuration of Matrix Keyboard.
Configuration of LCD. Initialize all Ports.
Determine the function of each individual pin as input or output. Declare variable X = 0
Main: If on button is pressed:
Welcome message on LCD. When the user put a glass, select the type of beverage, optional modes:
Conveyor belt Motor = ON
When the Service sensor is activated: Conveyor belt Motor = OFF SolenoidX = ON (depends of variable X)
Timer = ON
When Timer finishes counting: SolenoidX = OFF Timer = Reset
Next SolenoidX+1 = ON
Timer = ON When Timer finishes counting:
SolenoidX+1 = OFF
Timer = Reset On last Solenoid the Variable X is reset.
When the beverage process is ended activating the selected solenoids (Beverage ready):
Conveyor belt Motor = ON
When delivery sensor is activated: Conveyor belt Motor = OFF LCD: Take your Beverage
Microcontrollers Prototype & Final Report 2015
Page 21
When delivery sensor is deactivated:
Reset main
While (1): (The Conveyor belt light can be activated on any time) When the Conveyor belt light switch turn on:
Conveyor belt LEDs = ON
When the Conveyor belt light switch turn off:
Conveyor belt LEDs = OFF If off button is pressed:
All = OFF
END
3.2 Hardware
BeAM is developed thanks to the Microcontroller PIC18F4585 which has a 12 bits address bus which allows a 4KB memory space, 2MB of data RAM memory, 31 levels of stack, 20 sources of interruptions, four 16 bits-timers, five I/O ports and work at 40 MHz of
frequency, so is perfect for the performance of this project. [7]
The project is going to be implemented to work by itself, only needing the hardware configuration that was previously mentioned which needs to put the selected bottles on BeAM and follow the instructions to make the beverage process working correctly (The
user only needs to put a glass and take it at the end of the process).
For the project two types of LEDs are going to be used, both of them are high intensity LEDs. Each bottle is going to have one color of high intensity LEDs (blue, green,
red, yellow and white). These LEDs work with 2.2V (red and yellow) and 3.3V (blue, green and white), so each LED is going to use a 330ohm resistor. The other kind of LEDs are also of high intensity, and are going to be used to illuminate the conveyor belt, these LEDs
include their own resistors.
The conveyor belt motor is going to be a DC Motor of 90V that is going to be activated with the usage of some Power supplies, and the MCU is going to activate the
corresponding relay to turn on this Motor.
For the Service and Delivery sensors, two infrared sensors are going to be implemented, these also are going to be activated by the MCU using the corresponding relay.
To activate the flow of the five bottles the actuator is going to be an Electric Solenoid that can activate a mechanical valve. All the valves are going to be connected to a spider connection through water hoses. This way all the beverages are going to the same
place and the mix is going to be ready.
The keyboard is going to be a common matrix keyboard and the LCD can be any that include the Hitachi HD44780 driver.
All the circuitry and the PIC18F4585 are going to be activated by a Power Supply.
Microcontrollers Prototype & Final Report 2015
Page 22
The implementation of the hardware, in order of activation is described in Table 6,
taking on account the elements described in Figure 6.
Device Function Model I/O Configuration
Microcontroller
Interprets all the inputs
with the help of the developed code to send
signal to the outputs, creating thus the functionality of the
project.
PIC18F4585 N/A
Power On/Off Button Powers on/off the entire
system. KDC4 RA0
LCD Displays the welcoming, instruction and finishing messages to the user.
PC 1602 - F RD0 – RD7 &
RC0 – RC2
LED Switch Powers on/off the
illumination system KDC2 N/A
Conveyor LEDs
Illuminate the bottle
slots and the conveyor belt area.
OSPW5111P RA4
Matrix Keyboard
Writes the instructions into the microcontroller,
so it can interpret them and send the output signals to the
corresponding elements for the mixing process.
HC - 543 RB0 – RB7
Conveyor Motor
Moves the conveyor belt with the signal of the
microcontroller, and stops whit a signal of a proximity sensor
90 V DC Motor RA1
Service Sensor
Stops the conveyor belt
in order to star the mixing process with the help of the solenoids
E18 – D8NK RA2
Microcontrollers Prototype & Final Report 2015
Page 23
Solenoids They activate depending
on the selected combination (Table 4) in order to pour the
liquid into the glass
AUT - 90 RC3 – RC7
Delivery Sensor
Stops the conveyor belt
in order to finish the serving and mixing
cycle. Once this sensor is activated, the process goes back to the
selection mode.
E18 – D8NK RA3
Table 6: Hardware Implementation
Microcontrollers Prototype & Final Report 2015
Page 24
4. Implementation
The code that was implemented and used in the final prototype is shown below, along with comments regarding some specifications and detailing how it was created, so it can be easily understood by a programmer.
#include <stdio.h>
#include <stdlib.h> #include <xc.h> #include <p18f4585.h>
//OSCILLATOR SOURCE AND DIGITAL I/O CONFIGURATION BITS
//==================================================== #pragma config OSC = IRCIO67 // CONFIG1H (0-3) = 0010: INTIO2 oscillator, Internal oscillator block, port function on RA6 and RA7.
#pragma config MCLRE = ON // CONFIG3H.7 = 1: Pin de RESET habilitado y Entrada RE3 desactivado.
#pragma config PBADEN = OFF // CONFIG3H.1 = 0: PORTB.0 -- PORTB.4 as Digital I/O. #pragma config LVP = OFF // CONFIG3H.2 = 0: Single-Supply ICSP disabled so
that PORTB.5 works as Digital I/O. //PICIT-3 DEBUGGER SETUP CONFIGURATION BITS
//========================================= #pragma config WDT = OFF // CONFIG2H (0) = 0: Watchdog Timer Disabled. //GLOBAL VARIABLES
//================ unsigned char ons = 0;
unsigned char ons1 = 0; // One-shot flag. unsigned char ons2 = 0; // One-shot flag. unsigned char ons3 = 0; // One-shot flag.
unsigned char ons4 = 0; // One-shot flag. unsigned char ons5 = 0; // One-shot flag.
int pinRow = 0; int pinCol = 0;
int del = 0; unsigned int c1=0;
unsigned int c2=0; unsigned int x=0; // GLOBAL COMPILER?S CONSTANTS
//============================= // Puertos para el teclado Matricial
#define Col1 PORTBbits.RB4 #define Col2 PORTBbits.RB5 #define Col3 PORTBbits.RB6
#define Col4 PORTBbits.RB7
Microcontrollers Prototype & Final Report 2015
Page 25
#define Row1 PORTBbits.RB0
#define Row2 PORTBbits.RB1 #define Row3 PORTBbits.RB2
#define Row4 PORTBbits.RB3 //Puertos de Config del LCD #define RS PORTCbits.RC0
#define RW PORTCbits.RC1 #define E PORTCbits.RC2
// Solenoides #define Sole1 PORTCbits.RC3 #define Sole2 PORTCbits.RC4
#define Sole3 PORTCbits.RC5 #define Sole4 PORTCbits.RC6
#define Sole5 PORTCbits.RC7 #define Band PORTAbits.RA1
#define Sensor_M PORTAbits.RA2 #define Sensor_E PORTAbits.RA3
//FUNCTION' PROTOTYPE //===================
void One_ShotDef(void); void One_Shot1(void); void One_Shot2(void);
void One_Shot3(void); void One_Shot4(void);
void Reset_One_Shot(void); void Delay(void);
void DelayBanda(void); char CheckCols(void); //Returns 1 if Columns are pressed and 0 if free
void ColSelected (void); //Search for Column selected void RowSelected (void); //Search for Row selected void DataLCD (void);
void InitLCD (void); void DelayLCD (void);
void Ready (void); void wMessage(void); void gWrite(unsigned char x);
void erase_lcd(void); void Config (void){
OSCCON = 0x60; // 4 MHz internal oscillator CMCON = 0xFF; // Comparators OFF, to use PORT_Ds LSN
CVRCONbits.CVREN = 0; // Comparator Voltge Reference Module OFF
Microcontrollers Prototype & Final Report 2015
Page 26
ADCON1 = 0x0F; // All PORTS to Digital I/O
INTCON2 = 0x00;
PORTA = 0x00; LATA = 0x00;
TRISAbits.RA1=0; //RA1 as Output. BAND MOTOR TRISAbits.RA2=1; //RA2 SENSOR DE INICIO
TRISAbits.RA3=1; //RA3 as Input DELIVERY SENSOR TRISAbits.RA4=0; //RA4 as Leds
PORTB = 0x00; // Initialize PORTB LATB = 0x00; // Clear PORTB
TRISB = 0xFF; // PORTB as Inputs PORTC = 0x00; // Initialize PORTC
LATC = 0x00; // Clear PORTC TRISC = 0x00; // PORTC as Outputs
PORTD = 0x00; // Initialize PORTD LATD = 0x00; // Clear PORTD
TRISD = 0x00; // PORTD as Outputs
RCONbits.IPEN = 1; // Priority Feature Enabled, RCON.7 = 1. INTCONbits.GIEH = 1; // High Priorities Enabled, INTCON.7 = 1. INTCON2bits.RBIP = 1; // INT1 as High Priority, INTCON3.6 = 0.
INTCONbits.RBIF = 0; INTCONbits.RBIE = 1; // Enables INT1, INTCON3.3 = 1.
//Pins 0-3 as outputs TRISBbits.TRISB0 = 0;
TRISBbits.TRISB1 = 0; TRISBbits.TRISB2 = 0; TRISBbits.TRISB3 = 0;
//Pins 4-7 as inputs
TRISBbits.TRISB4 = 1; TRISBbits.TRISB5 = 1; TRISBbits.TRISB6 = 1;
TRISBbits.TRISB7 = 1;
Col1 = 1; Col2 = 1; Col3 = 1;
Col4 = 1;
Microcontrollers Prototype & Final Report 2015
Page 27
} void interrupt RB (void);
void interrupt; // High Priority ISR declaration. void main(void){
Config(); InitLCD();
if (c2 == 0){ wMessage(); }
while (1){ }
} void InitLCD() { E = 0;
DelayLCD(); DelayLCD();
LATD = 0x38; RS = 0; RW = 0;
E = 1; del++;
E = 0; DelayLCD(); DelayLCD();
LATD = 0x0F; RS = 0;
RW = 0; E = 1; del++;
E = 0; Ready();
LATD = 0x80; RS = 0; RW = 0;
E = 1; del++;
E = 0; Ready(); }
void Ready() { LATD = 0x00;
RS = 0x00; RW = 0x00;
while(PORTDbits.RD7 != 0) {
Microcontrollers Prototype & Final Report 2015
Page 28
E = 0xFF;
del++; E = 0x00;
} LATC = 0x00; }
void wMessage(){ while(c2 ==0){
if(c1 == 0){ erase_lcd(); char *MsgWel = "Bienvenido a BeAM";
while(*MsgWel) gWrite(*MsgWel++);
for (unsigned int x = 0; x<175; x++){ Delay();
Delay(); }
// } c1++; }else {
erase_lcd();
char *MsgWel2 = "Seleccione A,B,C o D"; while(*MsgWel2) gWrite(*MsgWel2++);
for (unsigned int x = 0; x<175; x++){ Delay();
Delay(); } c1--;
} }
} void interrupt RB () { if (CheckCols() == 1){
One_ShotDef(); }else if (ons == 1){
Reset_One_Shot(); } INTCONbits.RBIF = 0;
} void One_ShotDef(){
if (ons == 0){ Delay(); if (CheckCols() == 1){
ons = 1;
Microcontrollers Prototype & Final Report 2015
Page 29
ColSelected();
RowSelected(); DataLCD();
} }
return; }
void One_Shot1(){ if (ons1 == 0){ ons1 =1;
// unsigned char SeleW [] = {'S','e','l','e'}; Delay();
Delay(); Delay(); //Prueba banda y circito
x=1; Band = 1;
while (x==1){ if (Sensor_M == 0){ Band = 0;
DelayBanda();
unsigned int x2 = 0; while(x2 == 0){ Sole1 = 1;
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
Sole1 = 0;
Microcontrollers Prototype & Final Report 2015
Page 30
x2= 1;
} while(x2 == 1){
Sole3 = 1; DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
Sole3 = 0; x2= 0;
} x=0;
Band=1;
Microcontrollers Prototype & Final Report 2015
Page 31
}
} while (Band == 1){
if (Sensor_E==0){ Band =0;
} }
} Delay();
if (ons1 == 1){ ons1 = 0;
} return; }
void One_Shot2(){ if (ons2 == 0){
Delay(); Delay(); Delay();
//Prueba banda y circito x=1;
Band = 1; while (x==1){ if (Sensor_M == 0){
Band = 0;
DelayBanda(); unsigned int x2 = 0; while(x2 == 0){
Sole1 = 1; DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda();
Microcontrollers Prototype & Final Report 2015
Page 32
DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); Sole1 = 0;
x2= 1; }
while(x2 == 1){ Sole4 = 1;
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda();
Microcontrollers Prototype & Final Report 2015
Page 33
Sole4 = 0;
x2= 0; }
x=0; Band=1;
} }
while (Band == 1){ if (Sensor_E==0){
Band =0; }
} }
} void One_Shot3(){
if (ons3 == 0){ Delay(); Delay();
Delay(); //Prueba banda y circito
x=1; Band = 1; while (x==1){
if (Sensor_M == 0){ Band = 0;
DelayBanda(); unsigned int x2 = 0;
while(x2 == 0){ Sole2 = 1;
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda();
Microcontrollers Prototype & Final Report 2015
Page 34
DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
Sole2 = 0; x2= 1;
} while(x2 == 1){ Sole3 = 1;
DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda();
Microcontrollers Prototype & Final Report 2015
Page 35
DelayBanda();
Sole3 = 0; x2= 0;
} x=0;
Band=1; }
} while (Band == 1){
if (Sensor_E==0){ Band =0;
} }
} }
void One_Shot4(){ if (ons3 == 0){ Delay();
Delay(); Delay();
//Prueba banda y circito x=1; Band = 1;
while (x==1){ if (Sensor_M == 0){
Band = 0; DelayBanda();
unsigned int x2 = 0; while(x2 == 0){
Sole2 = 1; DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda();
Microcontrollers Prototype & Final Report 2015
Page 36
DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); Sole2 = 0;
x2= 1; } while(x2 == 1){
Sole3 = 1;
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda();
Microcontrollers Prototype & Final Report 2015
Page 37
DelayBanda();
DelayBanda(); Sole3 = 0;
x2= 2; } while(x2 == 2){
Sole4 = 1;
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda(); DelayBanda();
DelayBanda(); DelayBanda();
DelayBanda(); Sole4 = 0; x2= 0;
}
Microcontrollers Prototype & Final Report 2015
Page 38
x=0; Band=1;
} } while (Band == 1){
if (Sensor_E==0){
Band =0; } }
}
} char CheckCols(){ if (Col1 == 0){
return 1; }else if (Col2 == 0){
return 1; }else if (Col3 == 0){ return 1;
}else if (Col4 == 0){ return 1;
} return 0;
} void ColSelected(){
if (Col1 == 0){ pinCol = 1; }else if (Col2 == 0){
pinCol = 2; }else if (Col3 == 0){
pinCol = 3; }else if (Col4 == 0){ pinCol = 4;
} }
void RowSelected(){ for(int i = 0; i < 4; i++){
Row1 = 1; Row2 = 1;
Row3 = 1; Row4 = 1;
switch (i){
Microcontrollers Prototype & Final Report 2015
Page 39
case 0:
Row1 = 0; if (CheckCols() == 1){
pinRow = 1; } break;
case 1: Row2 = 0;
if (CheckCols() == 1){ pinRow = 2; }
break; case 2:
Row3 = 0; if (CheckCols() == 1){ pinRow = 3;
} break;
case 3: Row4 = 0; if (CheckCols() == 1){
pinRow = 4; }
break; } }
Row1 = 0; Row2 = 0;
Row3 = 0; Row4 = 0; }
char wait(unsigned char x){ int t;
for(t=500*x; t>0; t--); return (1); }
void gWrite(unsigned char x){ LATCbits.LATC1 = 0; // Modo escritura
LATCbits.LATC0 = 1; // Registro de datos LATD = x ; // El caracter a escribir LATCbits.LATC2 = 1; // Esribir...
wait(1); LATCbits.LATC2 = 0; // ... escrito
} void DataLCD(){ if (pinCol == 1){
if (pinRow == 1){
Microcontrollers Prototype & Final Report 2015
Page 40
//LATD = 0x031;
}else if (pinRow == 2){
LATD = 0x034; }else if (pinRow == 3){ LATD = 0x037;
}else{ LATD = 0x02A;
} }else if (pinCol == 2){ if (pinRow == 1){
LATD = 0x032; }else if (pinRow == 2){
LATD = 0x035; }else if (pinRow == 3){ LATD = 0x038;
}else{ LATD = 0x030;
} }else if (pinCol == 3){ if (pinRow == 1){
LATD = 0x033; }else if (pinRow == 2){
LATD = 0x036; }else if (pinRow == 3){ LATD = 0x039;
}else{ LATD = 0x023;
} }else{ if (pinRow == 1){
erase_lcd(); char *MsgElcc1 = "Su Eleccion A)Combinacion 1";
while(*MsgElcc1) gWrite(*MsgElcc1++);
One_Shot1(); c2++;
}else if (pinRow == 2){ erase_lcd(); char *MsgElcc1 = "Su Eleccion B)Combinacion 2";
while(*MsgElcc1) gWrite(*MsgElcc1++);
}else if (pinRow == 3){ erase_lcd(); char *MsgElcc1 = "Su Eleccion C)Combinacion 3";
while(*MsgElcc1)
Microcontrollers Prototype & Final Report 2015
Page 41
gWrite(*MsgElcc1++);
}else{ erase_lcd();
char *MsgElcc1 = "Su Eleccion D)Combinacion 4"; while(*MsgElcc1) gWrite(*MsgElcc1++);
} }
PORTCbits.RC0 = 0xFF; PORTCbits.RC1 = 0x00;
PORTCbits.RC2 = 0xFF; del++;
PORTCbits.RC2 = 0x00;
}
void Reset_One_Shot(){ if (CheckCols() == 0){
Delay(); if (CheckCols() == 0){
ons = 0; } }
} void Delay(){
unsigned char L1REG = 0; unsigned char L2REG; while(L1REG++ < 13){
L2REG = 0; while(L2REG++ < 255);
} } void DelayBanda(){
unsigned char L1REG = 0; unsigned char L2REG;
while(L1REG++ < 80){ L2REG = 0; while(L2REG++ < 255);
} }
void DelayLCD(){ unsigned char L1REG = 0; unsigned char L2REG;
while(L1REG++ < 163){
Microcontrollers Prototype & Final Report 2015
Page 42
L2REG = 0;
while(L2REG++ < 255); }
} void erase_lcd(){ LATD = 0x01;
RS = 0; RW = 0;
E = 1; Delay(); E = 0;
Ready(); }
This report will be submitted alongside with a CD containing the code written
above, so it can be revised thoroughly and compiled if it is desired.
Microcontrollers Prototype & Final Report 2015
Page 43
5. Verification and Validation In order to guaranty the functionality of the product, a description as well as the
expected and corresponding results of all the tests that were implemented is provided in the this section:
5.1 Test 1
The initial state of the test phase was purely code related(Figure 7), as it was needed to compile without errors, so it could later be downloaded to the microcontroller and
advance to the next test.
Figure 7: First Code Compilation
The failures relating to his test were mainly made because of syntax errors in the
code, preventing the code to compile.
Microcontrollers Prototype & Final Report 2015
Page 44
5.2 Test 2
The second test was made in order to prove the code with simple hardware
connections, as it was tested in a Protoboard using LEDs instead of the solenoids and the
conveyor belt motor that is required for the final prototype (Table 6).
The matrix keyboard and the LCD were used, expecting to obtain the desired results
stated in Table 6, which were to select the desired combination and display the welcoming
message respectively.
Figure 8: Matrix Keyboard and LCD testing Figure 9: Instruction Testing
As the implementation of the code was realized in a Protoboard (Figure 9 & Figure 8), there
were some wiring malfunctions, as the LCD and the matrix keyboard were displaying and inputting
undesired errors.
Microcontrollers Prototype & Final Report 2015
Page 45
5.3 Test 3
After the testing in the Protoboard, the circuits were assembled in soldering boards
(Figures 10 & 11) in order to test them in the prototype model, activating each piece of the
hardware one by one (Table 6).
The results of these tests were very satisfactory, as the welcoming message was
displayed on the LCD and the instruction was sent with the matrix keyboard (Figure 12).
Figure 12: LCD welcoming message
Figure 11: Soldering boards testing Figure 10: Microcontroller assembly
Microcontrollers Prototype & Final Report 2015
Page 46
5.4 Test 4
For this step, two solenoids, the proximity sensors and the conveyor belt motor were
added to the tests, as shown in Figures 13, 14 and 15 respectively.
Figure 13: Working Solenoids
Figure 14: Proximity Sensor
Figure 15: Conveyor Belt
Microcontrollers Prototype & Final Report 2015
Page 47
These results of this test were successful, so it was decided to follow the path that
was already taken and continue by adding the rest of the solenoids and testing the times for
the liquid pouring.
The listing of the tests errors and success can be found on Table 7:
Test Errors Success
1 Syntax errors The code compiled after the
correction of the code
2 Wiring Malfunction After wiring for a second time, with the use of better
connections and wires, the test was successful
3 Several problems with the
current of the Hardware
After connecting the
solenoids, the sensors and the motor to a different ground, the test succeeded.
4 Delay errors on the band and
the solenoids
The delays were corrected
and the final test was made.
Table 7: Tests error corrections
Microcontrollers Prototype & Final Report 2015
Page 48
6. User’s Manual
The next sections contains a set of steps in order to use BeAm properly without
having any problems and at the same time, enjoying the user interaction
Figure 16: Control Panel
1. Place the desired bottles in the slots (Figure 18), taking on account the statements made in Table 4, so the desired level of liquid is poured into the
glass.
2. Switch the power button to the ON position (Figure 20) on the control panel (Figure 16): The display will show a welcoming message (Figure 19), followed by a selection menu. (Figure 21)
3. Place a glass in the start section of the conveyor belt (Figure 17)
4. Select your type of mixing. The selection is made with the Matrix Keyboard,
creating the pre-established combinations that are displayed and described next to the control Panel and described below:
a. Mix A: Mixes bottle 1 and 3 b. Mix B: Mixes bottles 1 and 5.
c. Mix C: Mixes bottles 2 and 3. d. Mix D: Mixes bottles 2, 4, and 5.
Power ON/OFF Button
LCD
Matrix
Keyboard
Light Switch
Microcontrollers Prototype & Final Report 2015
Page 49
5. The conveyor belt will start to move on direction to the mixer and start
pouring the beverages into the glass.
6. After it finishes pouring the beverages, the conveyor belt will start automatically and stop at the end of the road.
7. Take your glass
8. Enjoy, and drink responsibly.
The previous set of instructions is detailed below with a set of images for
illustrative purposes.
Figure 17: Bottle accommodation Figure 18: Glass at start position
Microcontrollers Prototype & Final Report 2015
Page 50
Figure 19: Power button Figure 20: Initial message display
Figure 21: Selection Menu
Microcontrollers Prototype & Final Report 2015
Page 51
Figure 22: Mixing process
Microcontrollers Prototype & Final Report 2015
Page 52
7. Prototype & Final Considerations
With the development of BeAM, the developers were able to gather their
knowledges and combine them to create a project that was delivered on time and that complied with the specifications and the scope that was desired at the beginning of the
developing process.
The code that was implemented in this project took time and complete knowledge of what the developers were trying to create. The understanding of the code and the knowledge regarding the microcontroller was of decisive importance.
The project’s final aim was to build and automate a drink mixer that could comply
with the specifications proposed at the beginning of this report. The Table 7 describes the specifications that were met at the end of the development.
Specifications Status Comments
Automatization Complete The mixing process was
successfully automated
User Friendly Complete The LCD and the matrix keyboard aided in the user
friendliness of the project, but the bottle exchange added an extra to the
interaction.
Quality 90% reliable As the product is a prototype, it still has some
leaks at the moment of pouring the liquid
Functionality 90% complete The conveyor belt runs
slowly as the motor needs more power.
Table 8: Accomplished Specifications
The criteria that BeAM was based on, was the one that defined and combined the quality and functionality of the service and of the product per se, compelling with the
standards that the industry defines.
In order to achieve these statuses, several decisions were made, so the final deliverable was complete and working at full capacity.
1. Usage of C code 2. The developing of a simple but effective design
3. The usage of more than 1 power supply 4. Testing before the implementation
Microcontrollers Prototype & Final Report 2015
Page 53
By following these simple rules, the developers were able to deliver a product that
surpassed the project’s aim and scope.
The specific requirements were met and satisfied, with a few exceptions listed below:
Maintainability. – The usage and exchange of bottles still depends on
the user, as BeAM doesn’t have an automated system for this feature.
Portability. - This product has a big size, and can be hard to transport
from one place to another, but the materials used on the prototype make
it light enough to carry.
User Friendliness. – The bottle exchanging and the preparation for its
usage can be tedious
BeAM is a project that was developed at school level, but it can be easily presented
as a quality and formidable project. In its development BeAM proved to be a strong
competitor with those products that are already on the market, and can easily compete with
them if it goes out as a selling product.
Microcontrollers Prototype & Final Report 2015
Page 54
8. References
1. Margaret Rouse, Definition Solenoid. [on-line] (April 2005, accessed 3 September 2015); available from: http://whatis.techtarget.com/definition/solenoid/; Internet.
2. EeHerald, Basics of a LCD and his interface to Microcontroller. [guide on-line]
(Bangalore, accessed 3 September 2015); available from:
http://www.eeherald.com/section/design-guide/esmod17.html; Internet.
3. Dribin Dave, Keyboard Matrix Help. [guide on-line] (June 23, 2000, accessed 3 September 2015); available from: http://www.dribin.org/dave/keyboard/one_html/; Internet.
4. Education.re, What is an IR Sensor? [guide on-line] (accessed 3 September 2015);
available from: http://www.education.rec.ri.cmu.edu/content/electronics/boe/ir_sensor/1.html; Internet.
5. Rodolfo Castello, Introduction to Microcontrollers [lecture on-line] (2013, accessed
3 September 2015); available from: http://miscursos.itesm.mx/bbcswebdav/pid-12927729-dt-content-rid-25620113_1/courses/CHI.TE2023.1.1413.7594/CHI.CS00002.2.1411.15184_Impor
tedContent_20140108104221/MC_MR2010_Chapter_2_Introduction.pdf; Internet.
6. Kelsey D. Atherto. “ROBOT BARTENDERS.” [on-line] (Popular Science, 2013,
accessed 28.11.15) available from http://goo.gl/xK57mQ; Internet
7. Microchip Technology Inc., PIC18F4585 Datasheet. [book on-line] (U.S.A., 2007, accessed 15 October 2015); available from: http://www.microchip.com/wwwproducts/Devices.aspx?product=PIC18F4585;
Internet.
8. JPM, Micro.[guide on-line] (2015, accessed 14 October 2015); available from: http://www.microjpm.com/. http://www.microjpm.com/products/hc-543-teclado-membrana-matriz-4x4-/; Internet
9. Preciod, Sensor de proximidad infrarojo. [on-line store] (2015, accessed 15 October
2015); available from: http://preciod.com/mx/sensor-de-proximidad- infrarojo-mi-mega-mercado-md201190-Y5uyJ.precio.; Internet
10. Powertip, PC 1602-F Datasheet [on-line datasheet] (2014, accessed 15 October 2015); available from: http://www.powertipusa.com/pdf/pc1602f.pdf; Internet
11. Microchip, MPLAB X Integrated Development Environment (IDE). [on-line]
(2015, accessed 30 November 2015); available from: http://goo.gl/RGLxOf;
Internet