Date post: | 05-Apr-2018 |
Category: |
Documents |
Upload: | joshua-john |
View: | 218 times |
Download: | 0 times |
of 14
7/31/2019 6)Chapter 3 Updt
1/14
14
CHAPTER 3
METHODOLOGY
3.1 Basic Operation of the Magnetic Door Lock System using the Electronic
Combination Lock Based on PIC16F877A.
In building this project, there were several steps taken. This project is a combination of
different phases in completing of the project due to requirement.
3.2 Circuit Analysis
Figure 3.1
Referring to figure 3.1, this EMF door lock is operated only when the correct combination is
keyed in on the Key-Pad. If wrong combination is keyed, the EMF lock does not operate. The
system will activate the relay and buzzer if the password keyed in which is preset in the
program is correct. The whole system is connected to the Peripheral Interface Controller
also known as PIC. Whereby, the PIC is programmed with HEX code which is converted
from a simple C-language programming to function. Based on this project completed, the PIC
used was PIC16F877A which is a 40 pin PIC as mentioned in the Literature review. The
whole project was initially built on a breadboard before connecting it to the Printed Circuit
Board (PCB).
7/31/2019 6)Chapter 3 Updt
2/14
15
The process of connecting to the components onto the Breadboard is to troubleshoot
problems by simply disconnecting and reconnecting the component without going through
hassle. P-Spice was also used to simulate the circuit to check for errors.
3.2.1 Methods taken in Connecting the Circuit
Powering it
Electronic parts mostly all use 5V. 5V is obtained by using the LM7805 voltage
regulator chip. What the 7805 chip does, it takes a higher DC voltage, between 6V and 30V,
and turns it into almost 5V on the output. The measured value and the theoretical measure
vary. It is also important to put a capacitor between the output and ground to make the
voltage smooth. Otherwise there will be small high-frequency oscillations in the power,
which can mess up circuits. For building and testing a circuit, a DC power supply is used.
The EMF lock requires a 12V supply. Therefore, a 12V supply will be supplied to the whole
circuit whereby the voltage regulator regulates at almost a constant 5V to its components and
the EMF lock will receive a 12V supply.
As shown in figure 3.2, user can choose either use the AC to DC adaptor or 12V
battery to power up the circuit. Higher input voltage will produce more heat at LM7805voltage regulator, therefore a heat sink can be used. Typical voltage is 12V. Anyhow,
LM7805 will still generate some heat at 12V. There are two type of power connector for the
circuit, DC plug (J1) and 2510-02 (JP1). Normally AC to DC adaptor can be plugged to J1
type connector. Shown in Figure 3.2, the diode D3 is use to protect the circuit from wrong
polarity supply. Capacitors C1 and C7 is use to stabilize the voltage at the input side of the
LM7805 voltage regulator, while the capacitors C2 and C8 is use to stabilize the voltage at
the output side of the LM7805 voltage supply. DS4 is green LED to indicate the power status
of the circuit. R2 is resistor to protect DS4 from over current that will burn the DS4.
Figure 3.2
7/31/2019 6)Chapter 3 Updt
3/14
16
Interface PIC with Keypad
In this project, the keypad consists of 8 pins as shown in figure 3.3. The 8 pins
remaining are separated into 2 groups, 4 pins (K1- K4 in the Figure below) connect to the
input of microcontroller and 4 pins (K5-K8 in Figure 7) connect to the output. User can
decide any digital I/O pin for the input and output. Input must be pull high to 5V using a
resistor and this configuration will result an active-low input.
Figure 3.3
Push Button as input for PIC microcontroller
One I/O pin is needed for one push button as input of PIC microcontroller. The
connection of the push button to the I/O pin is shown in Figure 3.4. The I/O pin should be
pull up to 5V using a resistor (with value range 1K-10K) and
this configuration will result an active-low input. When the
button is being pressed, reading of I/O pin will be in logic 0,
while when the button is not pressed, reading of that I/O pin
will be logic 1.
Figure 3.4
7/31/2019 6)Chapter 3 Updt
4/14
17
Interface PIC16F877A with LCD (2 X 16 character)
In Figure 3.5, it is a 2X16 character LCD. LCD connection pins and function of each pin are
shown in table below:
Figure 3.5
Table 3.1 shows the description of the LCDs pins.
Table 3.1
Pin Name Pin function Connection
1 VSS Ground
2 VCC Positive supply for LCD
3 VEE Brightness adjust Connected to a preset to
adjust brightness
4 RS Select register, select instruction or data
register
RC0
5 R/W Select read or write GND
6 E Start data read or write RC1
7 DB0 Data bus pin RD0
8 DB1 Data bus pin RD1
9 DB2 Data bus pin RD2
10 DB3 Data bus pin RD3
11 DB4 Data bus pin RD4
12 DB5 Data bus pin RD5
13 DB6 Data bus pin RD6
14 DB7 Data bus pin RD7
15 LED + Backlight positive input VCC
16 LED - Backlight negative input GND
7/31/2019 6)Chapter 3 Updt
5/14
18
LED as output for PIC microcontroller
Figure 3.6
One I/O pin is needed for one LED as output of PIC microcontroller. The connection
for a LED to I/O pin is shown in figure 3.6. The function of R10 is to protect the LED from
over current that will burn the LED. When the output is in logic 1, the LED will ON,
while when the output is in logic 0, the LED will OFF.
Relay as output of PIC microcontroller
Figure 3.7
The relay used for the project consists of 5 pins, 2 pins is the 2 end of the coil, 1 is
COM, 1 is NO and 1 is NC as shown in Figure 3.7. One end of the coil is connected to 9V
and another end is connected to an NPN transistor to amplify the small IC current to larger
value required for the relay coil. COM pin is connected to 9V and NO is connected to a 2510
2-pin connector which is provided to locate the door magnetic lock.
9VDC
7/31/2019 6)Chapter 3 Updt
6/14
19
ICSP for loading program
ICSP stands for In Circuit Serial Programming and describes the serial programming
interface for PIC microcontroller. ICSP gives user a convenient way of programming PIC
Microcontroller without removing the chip from the development or production board. User
needs a programmer that provides the ICSP connector.
Figure 3.8
Referring to figure 3.8, MCLR, PGC and PGD needs to be connected to the ICSP box header
to program the PIC microcontroller. At the same time, RB3 need to be pull down to 0V to
disable low voltage programming, because the programmer is using high voltage
programming.
Buzzer as output of PIC microcontroller
Figure 3.9
Buzzer can be connected to any I/O pin as output.
7/31/2019 6)Chapter 3 Updt
7/14
20
3.3 Overall Schematics
Figure 3.10
7/31/2019 6)Chapter 3 Updt
8/14
21
3.4 Breadboard Construction
The circuit was built on the breadboard as a trial board to test the connectivity of the
components as shown in figure 3.11.
Figure 3.11
3.5 Programming the PIC
An ICSP port was installed, as it has been stated, to program the PIC without removing it.
The PIC needs to be program in order to activate the combination circuit before testing the
project. The software used to program the PIC is WinPIC 8000 or PICkit2 using MPLab.
The process of programming the PIC16F877A using WinPIC 8000 as shown below.
Figure 3.12
7/31/2019 6)Chapter 3 Updt
9/14
22
The initial process is by doing a hardware test as shown in figure 3.12.
Figure 3.13
A prompt on the Hardware is ok will appear as shown in figure 3.13.
Figure 3.14
Insert the microcontroller into the ZIF socket of the USB programmer. Click on
the Detect Pic icon to detect the microcontroller shown in figure 3.14.
Then select the source code which is in HEX format.
Figure 3.15
7/31/2019 6)Chapter 3 Updt
10/14
23
Click on the Erase button to erase any remaining program in the microcontroller. As
shown in figure 3.15
Figure 3.16
Click on the Program All button to program the select hex file into the microcontroller.
After finish downloading the hex file, click on Accept button. Refer to figure 3.16.
Figure 3.17
To read back the program which is downloaded into the microcontroller, click on the Read
All button as shown in figure 3.17.
7/31/2019 6)Chapter 3 Updt
11/14
24
3.6 RIMU and GERB TOOL Artwork
After completing the experimental test, the circuit was drawn by using software
named RIMU. From there, it will be transferred to GERB TOOL software to produce a
printed circuit board (PCB) for the circuit as shown in figure 3.18.
Figure 3.19
7/31/2019 6)Chapter 3 Updt
12/14
25
3.7 PCB Lab Work
At this stage, the GERB TOOL printed artwork is laminated together with copper
board using a film and kept under a UV machine. To avoid the damage of the film, the
laminating and UV process needs to be done in a special room. Then, the board is transferred
to two machines. First machine is to develop the circuit and strip off the film from the board
as shown in figure 3.20. This process is called developing. The second machine is to etch
copper from the board and the process is called etching, refer to figure 3.21. After all this is
done, the board is cleaned with water and lastly placed into a container filled with a required
chemical to strip off the remaining copper. The final step is the drilling process as shown in
figure 3.22.
Figure 3.20: Developing process Figure 3.21: Etching process
7/31/2019 6)Chapter 3 Updt
13/14
7/31/2019 6)Chapter 3 Updt
14/14
27
3.9 The Prototype
The prototype is built with a simply, mobile and cost efficient material. At the outer
part of the casing, some holes was drilled according to the required size to fit in the Key-pad,
the LEDs, Push button, and the LCD as shown in figure 3.24. The PCB was placed inside the
casing. The PCB is shown in figure 3.25.
Figure 3.24
Figure 3.25