COFFEE MACHINE
CEP Report
By
NAME Registration Number
ASIM KHAN FA19-EPE-035
MUHAMMAD HAMZA SHAUKAT FA19-EPE-009
ABDULLAH FA20-EPE-002
For the course
Microprocessor Systems and Interfacing
Semester FALL 2023
Supervised by:
Sir Muhammad Naveed Shaikh
1|Page
Department of Electrical & Computer Engineering
COMSATS University Islamabad – Abbottabad Campus
DECLARATION
We Asim khan (FA19-EPE-035), Muhammad Hamza Shaukat (FA19-EPE-009), and
Abdullah (FA20-EPE-002) hereby declare that we have produced the work presented in this
report, during the scheduled period of study. We also declare that we have not taken any
material from any source except referred to wherever due. If a violation of rules has occurred
in this report, we shall be liable to punishable action.
Date: 12/01/2023
Asim khan
(FA19-EPE-035)
Muhammad Hamza Shaukat
(FA19-EPE-009)
Abdullah
(FA20-EPE-002)
2|Page
ABSTRACT
A microcontroller also called MCUs or Microcontroller Unit is a single integrated circuit (IC)
that is used for a specific application and designed to implement certain tasks. Products and
devices that have been automatically controlled in certain situations, like appliances, power
tools, automobile engine control systems, medical equipment, high-end consumer electronics,
rugged industrial devices, and computers are great examples, but microcontrollers reach
much higher than these applications. Essentially, a microcontroller works to gather input,
process the information, and output a particular action based on the information gathered.
Microcontrollers or MCUs can operate at lower speeds, for example, it can operate at around
in 1MHz to 200 MHz of range, and is designed to consume less power because they’re
embedded inside the other devices, which have greater power consumptions in other areas.
But our project is coffee making machine in which we will be using MPLAB for coding and
for simulation we use PROTEUS. In our project we have some basic requirements of powder
and water. If these requirements are enough then the sensor will detect it and coffee making
process will start and green led will glow if requirements are not enough then it will return to
basic requirements portion and red led will glow.
3|Page
TABLE OF CONTENTS
1. Introduction……………………………………………………………………………………...5
1.1 Explanation.…………………………………………………………………………………5
1.2 Objective …………………………………………………………………………………….6
2. Literature Survey……………………………………………………………………………….6
3. Proposed Methodology……………………………………………………………………..6
3.1 Block diagram………………………………………………………………………………8
4. Code……………………………………………………………………………………..…………..9
4.1 Software Simulation Results………………………………………………….……19
4.2 Simulation parameter…………………………………………………………..…….19
5. Conclusion………………………………………………………………………………………..20
6. References…………….………………………………………………………………………...20
LIST OF FIGURES
Fig: 1.1 coffee Machine …………5
Fig: 3.1 Circuit Diagram…………7
Fig: 3.2 Flow chart ……….……..8
Fig: 4.1 simulation results1…….19
Fig: 4.1 simulation results2 ……19
4|Page
1.I NTRODUCTION:
A microcontroller is a solitary chip microcomputer fabricated from VLSI fabrication. There
are many microcontrollers with different word lengths such as 4bit, 8bit, 64bit and 128bit
microcontrollers. Microcontroller is a compressed microcomputer manufactured to control
the functions of embedded systems in office machines, robots, home appliances, motor
vehicles, and a number of other gadgets. A microcontroller is comprises components like-
memory, peripherals and most importantly a processor. Microcontrollers are basically
employed in devices that need a degree of control to be applied by the user of the device. Any
electric appliance that stores, measures, displays information or calculates comprise of a
microcontroller chip inside it.
1.1 Explanation:
But our project is coffee making machine in which we have some basic requirements of
powder and water. If these requirements are enough then the sensor will detect it and coffee
making process will start and green led will glow if requirements are not enough then it will
return to basic requirements portion and red led will glow.
Diagram:
Figure 1.1
5|Page
1.2 Objective:
We are using microcontroller in its practical implementation by making the coffee machine
where its input and output are controlled by the programmable logic of microcontroller.
Cost Estimate of our Project:
Components Costs
PIC18F452 2500
LCD 500
LEDS 30
Switches 50
Breadboard 200
Resistor 30
Total 3310
2. Literature Survey:
Shepard, T., & Choi, J., & Holmes, T. D., & Carlin, B. W. (2015, June), The Effect of Project
Constraints and Choice on First-year Microcontroller Projects Paper presented at 2015
ASEE Annual Conference & Exposition, Seattle, Washington.
Choi, C. (2008, June), A Microcontroller Applications Course And The Free scale’s
Microcontroller Student Learning Kit Paper presented at 2008 Annual Conference &
Exposition, Pittsburgh, Pennsylvania.
3. Proposed Methodology:
We are using the previous knowledge of our course how to make input and output how to do
Lcd interfacing how to generate delay how to apply loop and sub loop how to apply branch in
programming logic. In our project we have some basic requirements of powder and water. If
these requirements are enough then the sensor will detect it and coffee making process will
start and green led will glow if requirements are not enough then it will return to basic
requirements portion and red led will glow. For this purpose we are using MPLAB for
6|Page
software coding and PROTEUS simulation. After software implementation, we implemented
the system in hardware.
Circuit Diagram 3.1
7|Page
3.1 BLOCK DIAGRAM:
Flow chart 3.2
8|Page
4.Code:
LIST P=PIC18F452,F=INHX32,N=0,ST=OFF,R=HEX
#include<p18f452.inc>
config
OSC=HS,OSCS=OFF,WDT=OFF,BORV=45,PWRT=ON,BOR=ON,DEBUG=OFF,LVP=O
FF,STVR=OFF
org 0x2A
BSF TRISB,0 ;CHECK FOR WATER LEVEL
BSF TRISB,1 ;CHECK FOR C0FFEE POWDER
BSF TRISB,2 ; CHECK PRESENCE OF GLASS
BCF TRISB,4 ;WATER TAB
BCF TRISB,5 ;COFFEE TAB
BCF TRISB,6 ;MIXER
BCF TRISB,7 ;HEATING COIL
BCF TRISC,0 ;green LED
BCF TRISC,1 ;red LED
BCF TRISC,5 ;RS
BCF TRISC,6 ;RW
BCF TRISC,7 ;E
CLRF TRISD
CALL LCD_CONFIGURATION
QWE
9|Page
BTFSS PORTB,0 ;WATER LEVEL
BRA ABD
BTFSS PORTB,1 ;COFFEE POWDER
BRA ABD
;CHECK FOR GREEN LED
BSF PORTC,0
BCF PORTC,1
BRA QWER
ABD
BSF PORTC,1
BCF PORTC,0
BRA QWE
QWER
BTFSS PORTB,2 ;PRESENCE OF GLASS
BRA QWE
BSF PORTB,7 ;HEATING COIL
CALL DELAY5 ;5 SEC DELAY
BCF PORTB,7
BSF PORTB,4 ;SET WATER TAP
BSF PORTB,5 ;SET COFFEE TAP
BSF PORTB,6 ;SET MIXER
CALL DELAY2
CALL DELAY2
BCF PORTB,4 ;CLEAR WATER TAP
BCF PORTB,5 ;CLEAR COFFEE TAP
BCF PORTB,6 ;CLEAR MIXER
10 | P a g e
BCF PORTB,2
CALL LCD_CODE
BRA QWE
DELAY5 ;DELAY FOR 5 SEC
MOVLW 07H
MOVWF T0CON
MOVLW 067H
MOVWF TMR0H
MOVLW 069H
MOVWF TMR0L
BCF INTCON,TMR0IF
BSF T0CON,7
ABC
BTFSS INTCON,TMR0IF
BRA ABC
RETURN
DELAY2 ;DELAY FOR 2 SEC
MOVLW 05H
MOVWF T0CON
MOVLW 0BH
MOVWF TMR0H
MOVLW 0DCH
MOVWF TMR0L
BCF INTCON,TMR0IF
BSF T0CON,7
11 | P a g e
ABC1
BTFSS INTCON,TMR0IF
BRA ABC1
RETURN
LCD_CODE ;WE PRINT ASCII IN DISPLAY
CALL DELAY
MOVLW A'Y'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'O'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'U'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'R'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW 014H
12 | P a g e
CALL COMNWRT
CALL DELAY
MOVLW A'C'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'O'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'F'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'F'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'E'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'E'
MOVWF PORTD
CALL DATAWRT
13 | P a g e
CALL DELAY
MOVLW 0C3H
CALL COMNWRT
CALL DELAY
MOVLW A'I'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'S'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW 014H
CALL COMNWRT
MOVLW 0C6H
CALL COMNWRT
CALL DELAY
MOVLW A'P'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'R'
MOVWF PORTD
CALL DATAWRT
14 | P a g e
CALL DELAY
MOVLW A'E'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'P'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'A'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'R'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'E'
MOVWF PORTD
CALL DATAWRT
CALL DELAY
MOVLW A'D'
MOVWF PORTD
CALL DATAWRT
15 | P a g e
RETURN
LCD_CONFIGURATION
CALL LDELAY
MOVLW 38H
CALL COMNWRT
CALL LDELAY
MOVLW 0EH
CALL COMNWRT
CALL DELAY
MOVLW 01H
CALL COMNWRT
CALL DELAY
MOVLW 06H
CALL COMNWRT
CALL DELAY
MOVLW 84H
CALL COMNWRT
RETURN
COMNWRT ;WE GIVE A COMMAND TO DISPLAY
MOVWF PORTD
BCF PORTC,5
BCF PORTC ,6
BSF PORTC ,7
16 | P a g e
CALL SDELAY
BCF PORTC,7
RETURN
DATAWRT ;DISPLAY ON LCD
BSF PORTC,5
BCF PORTC,6
BSF PORTC,7
CALL SDELAY
BCF PORTC,7
RETURN
SDELAY ;DELAY FOR 25 MICRO SEC
MOVLW 48H
MOVWF T0CON
MOVLW 0C1H
MOVWF TMR0L
BCF INTCON, TMR0IF
BSF T0CON,7
XYZ
BTFSS INTCON, TMR0IF
BRA XYZ
BCF T0CON,7
RETURN
LDELAY ;DELAY FOR 1 SEC
MOVLW 04H
17 | P a g e
MOVWF T0CON
MOVLW 67H
MOVWF TMR0H
MOVLW 69H
MOVWF TMR0L
BCF INTCON, TMR0IF
BSF T0CON,7
XYZ1
BTFSS INTCON, TMR0IF
BRA XYZ1
BCF T0CON,7
RETURN
DELAY ;DELAY FOR 1 mS
MOVLW 08H
MOVWF T0CON
MOVLW 0F6H
MOVWF TMR0H
MOVLW 3CH
MOVWF TMR0L
BCF INTCON, TMR0IF
BSF T0CON,7
XYZ2
BTFSS INTCON,TMR0IF
BRA XYZ2
BCF T0CON,7
RETURN
END
18 | P a g e
4.1 SOFTWARE SIMULATION RESULTS:
Figure 4.1
Figure 4.2
19 | P a g e
4.2 SIMULATION PARAMETERS:
Resistor
LED
LCD (16x2)
Ground
Power source
Switch
5.CONCLUSION:
Due to this project we should be able how to use microcontroller in real time application and
also understand its programming logic which are very helpful in defining its input, output.
Due to this project we know how we should do LCD interfacing how we can generate delays
how we can use different loops and branches.
6.REFERENCE:
Following are some references of the sites and papers which were studied during this CEP.
1. https://www.datasheetarchive.com/coffee%20machine%20pic-
datasheet.html
2. https://labprojectsbd.com/2021/02/24/make-your-own-coffee-vending-
machine-control-circuit/
3. https://www.ijesrt.com/issues%20pdf%20file/TECHNOPHILIA-
2016%20-%20Jaihind%20Polytechhnic,%20Kuran,%20February,
%202016/3_COFFEE%20VENDING%20MACHINE%20USING
%20MICROCONTROLLER.pdf
20 | P a g e
21 | P a g e