You are on page 1of 70

AUTOMATIC DOOR LOCK SYSTEM

MOHD HELMI ALSYUKRAN BIN ABD MALIK

UNIVERSITI TEKNOLOGI MALAYSIA

AUTOMATIC DOOR LOCK SYSTEM

MOHD HELMI ALSYUKRAN B ABD MALIK

A report submitted in fulfillment of the requirements for the award of the degree of
Bachelor of Electrical Engineering (Control and Instrumentation)

Faculty of Electrical Engineering


Universiti Teknologi Malaysia

APRIL 2008

iii

ACKNOWLEDGEMENT

First of all I would like to thank a lot to my supervisor Prof. Dr. Ruzairi b Hj
Abd Rahim for his guidance and his kindness to me in order to do this project for PSM 1
and PSM 2.

Next I would like to thanks to my family members especially mom and dad
for giving me a good advice, support and idea throughout this project. Also to my
friends that helps a lot to finish this project.

iv

ABSTRACT

Nowadays people are not very concern about safety of their premises. For an
example the lecture room in the universities is not safety enough because no safety
procedures taken and the intruder easy to stole the valuable thing in the lecture room.
The project that was built consists of hardware and software development. The project
will have locking system that will activate by sending the right SMS (Short Messaging
System) to the system. The users in this case are the lecturers who will have their
priority to open the lecture room before start their lecture. Besides, this project will use
the microcontroller in order to interface or communicate between the input signal and
door lock circuit.

TABLE OF CONTENT

CHAPTER

TITLE

PAGE

Supervisor Certification

Declaration

ii

Acknowledgement

iii

Abstract

iv

Table of Content

List of Tables

vii

List of Figures

viii

INTRODUCTION
1.1

Definition of Wireless communication and mobile

Communication
1.2 Mobile Phone

1.3 SMS Definition

1.4 History of SMS

1.5 Problem statement

1.6 Objectives

1.7 Scope of the Project

1.7.1 Software

1.7.2 Hardware

II
2.0

LITERATURE REVIEW

Other Door locks System Available

vi
2.0.1 PARADOX Security System

10

2.0.2 MICROENGINE System

11

2.0.3 SUPA System

12

2.1

Nokia 3310 Connection Port

13

2.2

Sony Ericsson K700i

14

2.3 Microcontroller

2.4

III

IV

16

2.3.0 PIC16F84A Microcontroller

16

Serial Interfacing RS-232

17

METHODOLOGY
3.1 Project methodology

20

3.2 Mobile Phone Characteristics

20

3.3 Controller Circuit

21

3.4 Voltage Regulator Circuit

23

3.5 Serial Interfacing Circuit

24

3.6 Output Circuit

25

3.7 Project Prototype

25

3.8 Component Used

27

3.9 THRSim11

28

3.10 HCLOAD

32

3.11 Hyper terminal

34

3.12 How to Know the Actual Message

37

3.13 Assembly Language

39

3.14 AT-Commands

43

3.15 System Flow Chart

44

RESULT AND DISCUSSION


4.0 Result

45

4.0.1 Voltage Regulator Circuit

45

4.0.2 Microcontroller MC68HC11A1 Circuit

46

4.0.3 Serial Interfacing Circuit

47

vii
4.0.4 Relay Circuit

48

4.0.5 Project Prototype

49

4.0.6 Software Skills

50

4.1 Discussion
4.1.0 Obstacles Encountered

50
51

CONCLUSIONS AND RECOMMENDATIONS


5.1 Conclusion

52

5.2 Future Recommendations

53

References

54

Appendices

55

viii

LIST OF TABLES

TABLE NO.

TITLE

PAGE

Sony Ericsson Port Connection with Description

15

List of Components

28

RS-232 Specification

48

ix

LIST OF FIGURES

FIGURE NO.

TITLE

PAGE

System Block Diagram

2.0

Paradox Security System

10

2.1

Micro engine System

11

2.2

SUPA System

12

2.3

Nokia 3310 connection Port

13

2.4

Sony Ericsson k700i

14

2.5

PIC16F84A Microcontroller

16

2.6

RS-232 9 Pin Serial interfacing

17

3.0

Sony Ericsson K700i Phone

21

3.1

MC68HC11 Microcontroller circuit

22

3.2

MC68Hc11A1 Microcontroller Chip

23

3.3

Voltage Regulator Circuit

23

3.4

Serial Interfacing Circuit

24

3.5

Output Circuit (Relay)

25

3.6

Project Overview

26

3.7

Front View

26

3.8

Left view

27

3.9

Top View

27

3.10

THRSim11 Simulator

29

3.11

THRSim11 Simulator Windows

29

3.12

Serial Transmitter

30

3.13

Data stored in the Memory Windows

31

3.14

Led output (Represent relay)

32

3.15

HCLOAD

33

3.16

Hyper Terminal Windows

34

3.17

Com Port windows Selector

35

3.18

Baud Rate windows Selector

35

3.19

SMS Signal From the phone

36

3.20

ASCII Chart for o character

38

3.21

ASCII Chart for n Character

38

4.0

Voltage Regulator Circuit

46

4.1

Microcontroller Circuit

46

4.2

Relay circuit

49

4.3

Project Prototype

49

CHAPTER I

INTRODUCTION

1.0

INTRODUCTION

Nowadays the telecommunication technologies become wider and more new


features exist to make human life better. These help people to communicate with each
other easier than before. People can communicate by many ways. For this new era,
people are most using the wireless technology system to communicate with each other.
Wireless technology is known that the communication system is not used the wire. This
technology and services have undergone a huge development since the first cellular and
cordless telephone systems were introduced in 1980s.The first generation of cellular
phone was based on analog FM technology. This generation only has voice service
only.

Second generation cellular phone next were introduced in the early 1990.This
generation use the digital modulation and have an improvement on spectral efficiency
as well as voice quality. However this second generation still uses the same features as
first generation technologies.

Years after years, voice communication using the mobile phone was not very
economical because of the rate of the time taken to finish the conversation between two
people. New technologies coming where it only use low cost for the user when using
this technology. The technology is known short messaging system (SMS).This
technology not only provide user to communicate wit each other but short messaging
system can be implemented by many ways. One of the uses of the short messaging is to
on or locks devices using this technologies.

This project will use an SMS or text messaging to open the lecture room door.
The lecturers can open the lecture room door by sending a text messages to the system.
The system will identify and check it for the safety purposes. The system receiver will
act as a SMS receiver. Hand phone model Sony Ericsson K700i was used for the
receiver. After that, the microcontroller will read the signal and verify the signal
whether it is the right person or not to open the door. If the right person sends the SMS,
then it will activate the door lock circuit. If the SMS is not from authorized person then
it will not open the door.

The door lock circuit is design based on the electromagnetic principle. It will
have the magnetic core and change to a magnet when power supply is feed to it. This
magnet will act as a locking part of the door. Besides the safety measures is take into
account. The door will always lock at all time. It will automatic open if anyone send the
right SMS to the system. The door will open for a certain delay and the user must close
the door within this time.

Sony Ericsson
(K700i)

MICROCONTROLLER

Figure 1: System Block Diagram

Door Lock Circuit

1.1

Definition of Wireless Communication and Mobile Communication

Wireless technology nowadays becomes more advance in terms of their gadget,


way of operation and the technology behind it. There were lots of wireless
communication technologies. The wireless communication technologies are Mobile
Communication System, Bluetooth, Infrared, WirelessLan (WLAN), WiFi and
WiMax. This kind of technology allows us to communicate without using a wire.

Wireless means that the electrical and electronic operation which done without
the use of hard wired connection. Wireless communication is the transfer of information
over a distance without the use of electrical conductors or "wires". [1] (source: Wireless
communication wikipedia).Wireless communication is a part of the telecommunication.
There are many types of wireless communication such as GSM, GPRS, and EDGE, IS95, UMTS, IMT2000, DECT, IEEE 802.11, Bluetooth and several multiple access
techniques such as MC-CDMA, W-CDMA and OFDM.

Mobile communication can be classified by their degree of complexity, the level


of the offered services and their cost. Mobile communication can be list as paging
systems, wireless telephony, trunking systems, cellular telephony, satellite personal
communication systems and system of wireless access to local area networks.

1.2

Mobile Phone

Mobile phone is a small, portable communication device that enables people to


make phone calls whenever where they are. It receives and gives out signals via the
service providers transmitting towers and even by satellite. The convenience of mobile
phone is allowing people to communicate with one another without the limitation of
regions and time. It provides of two way communication and the signal transmission is
the core concept of this system. Mobile phone use the radio wave frequencies same as
the ordinary radio. However the signal is much higher in order to make clear
conversation among users. This signal transmit from device to the tower which the
service provider such as in Malaysia Maxis, Celcom and Digi. After that from the
towers the signal then transmits to other mobile phone which in this case is the
recipient. Signal of mobile phone actually are spilt into a small cells. Because of that,
mobile phone can be called a cell phone. These cells allow radio transmission enabling
the authorized signals to receive and send out among the mobile phone.

The very first mobile telephony service was in Sweden. It was a form of radio
telephony tested by the Swedish police for used in police cruisers. This form of radio
telephone is a two-way radio which is still widely used in taxi and police cruisers. The
first commercial mobile phone system (also known as network system or system
operator) was launched in Japan in 1979. The second mobile phone system was
established in 1981 later in United States. In the late 1980s, along with the
commercialized mobile phone system, the mobile phone industry started to develop
rapidly and attracting more users to use mobile phones.

1.3

SMS Definition

SMS stands for Short Messaging Service often called text messaging that is a
service for sending messages of up to 160 characters from and to mobile phones that
have the Global System of Mobile (GSM).GSM and SMS service are available in US,
Europe and Asia as well. This system is similar to paging system. The difference is
person who want to send their messages do not worry about the range and where is the
receiver is. They just send their messages through their mobile and wait for the other
person to receive the messages. The person who is received the messages can received
the message sending by the sender when he or she open the mobile phone. In other
words we do not have to activate our mobile phone and be at certain range to receive a
message. The messages will receive automatically if we activate our mobile phone.

SMS can be transmitted by using PC or mobile phone itself. As long we have


the coverage the messages can be received. Sending SMS through web site also can be
done if the web sites are equipped with PC Link. The Service Center is a center that acts
as a store and forward for short messages. The short messages are not sent directly from
sender to recipient but through an SMS Center or Service Center. The sender also will
have the message that send by this Service Center mentioned that their message are sent
to recipient or not.

1.4

History of SMS

In 1980, the idea to enhance the usage of mobile phone was suggest by the
expertise from several of those communities in the discussion which the GSM service
should be. Early in February 1985 after discussed with the subgroup of GSM, Chairman
J. Audestad state that SMS was considered in the main GSM group of a possible service
for the new digital cellular system. Also from the discussion concluded in the
recommendation GSM 02.03 TeleService supported by a GSM PLMN there are
several things that have been concluded that are Short Messaging System Terminated
(SMS-MT) is the ability of a network to transmit a short message to a mobile phone.
The message can be sent by phone or software application. Next Short Message
Originated (SMS-O) is the ability of a network to transmit a short message sent by a
mobile phone. The message also can be sent to a mobile phone and software
application.

1.5

Problem Statement

The safety in the lecture room is quite crucial because lack of safety awareness
among the student and the staff. Besides the traditional method door that used a key can
be easily open by not authorized person or burglar if they have the right key. This will
allows them to steal the entire valuable thing in the lecture room. Besides that,
sometimes students cannot enter the lecture room when they have the lecture because
the door is not open. The students also cannot open the door because they do not have
the key. They need to wait for the technician to come for opening the door. So the major
reason to build this project is to reduce usage of the key when opening the door.

1.6

Objectives

The project that was built has several objectives. These objectives describe
bellow are mainly to improve the skill of learning and it will consist of skill of hardware
and programming skills. The objectives of this project were as follows:

1.3.1

To facilitate lectures to open the lecture room door by sending an SMS


using their

mobile phone

1.3.2

To reduce usage of key to open the door

1.3.3

To learn the programming skills and generate the creative


thinking.

1.7

Scope of the Project

This project will concentrate at the short messaging system (SMS) in order to
open the door. The SMS signal coming from the mobile hand phone need to be identify
in order to connect with the controller. The project will, have software and hardware
work implementation.

1.7.1 Software

In order to work with this project, first the right of software implementation
needs to be identified. The preliminary works for software searching are:

i.

Learn the usage of the assembly language and it criteria based on the project
objectives.

ii.

Identified the memory usage require by the program that will be built whether it
suite with the microcontroller or not.

iii.

Identified the software that will be used to load the program to the chip using
boot loader techniques.

iv.

Check and explore the entire menu in the software used in order to achieve the
project objectives.

1.7.2

Hardware

For the hardware part, there are several works that has been done before proceed
to the project requirements.

i.

Design the door with the magnetic lock attached to it.

ii.

Searching for material that will be use such as wood, nail and magnetic lock.

iii.

Built the prototype according to the design and the project requirements.

1.8

Organization of this Thesis

This thesis consists of five chapters that discussed and described about the details
of the project that have been done. For chapter 1, it was the introduction part mobile
phone, short messaging system (SMS) and the history behind the technology was
clearly defines. Besides, in this chapter also the problem statement, objectives and the
scope of the project was stated on this chapter.

For chapter two it is about the literature review. This chapter discussed all the
references and material that have been studied in order to work with this project. All the
security system available in the market nowadays was surveyed and the idea for develop
this project was taken from this kind of references. Next is the details of all component
that might be used in this project will discussed in this chapter.

In chapter three, it will discuss about the methodology of how to work with this
project and all kind of measure that was taken as well as the details of the entire
component used. Basically in this chapter have two areas which are software part and
hardware part. For chapter four it will discuss about the result that was obtain and the
discussion on the obstacles when doing this project. Lastly on chapter five, the
conclusion and the recommendation that was obtain from the final result of the project
will be discuss and some references and also the appendices.

CHAPTER II

LITERATURE REVIEW

1.0 Other Door Locks System Available

There are lots of security systems in the market nowadays. These systems are
studied in order to obtain some idea for the project that was built. Although the system
in the market nowadays is suite with new technology and more advanced the idea must
still need to be obtain through the literature review.

The literature review works help to expose and generate skills of searching for
information from a various sources. These skills are very important in order to solve the
problems that encountered or will face in the future.

10

2.0.1 PARADOX Security System

Figure 2.0: Paradox Security System

This security system is from the Paradox Company. The system has many kinds
of modules. One of them is wireless expansion module that act as receiver from the
wireless sources such as mobile phone. This gives the idea for this project by using a
mobile telephone. It is quite complex system because have many ways to activate the
control panel. For this project, the idea of using a wireless communication is adapted to
build the system.

11

2.0.2

MICROENGINE System

Figure 2.1: Micro engine System

This door lock security system is from the Micro engine manufacturer. It
consists of the input part, controller part and the output part. The input is using the
smart card that use to activate the door. Next for the controller it uses the XP-M1000X
as a controller. Then for the output it haves push button, emergency break glass and the
door lock circuit. The door lock circuit is using the electromagnetic principle .So for the
project that will be builds; the concept of the electromagnetic principle will be use in the
project.

12

2.0.3

SUPA System

Figure 2.2: SUPA system

This security system is from the SUPA manufacturer. It has the GSM cellular
transmission. This act as the control panel switches to GSM Module for alarm report
transmission in case of the phone line cut. Besides it also have the voice module that act
as activation of electrical appliances using with the voice confirmation. This system
have some codes that consumer can set their selves. This gives the idea for the project
that will be built using some kind of codes to activate the system.

13

2.1 Nokia 3310 Connection Port

For the Nokia 3310 it has the connection port on the back of its cover. The port
can be seen under the battery. It has 4 pin that can enabled the connection to PC. Pin 1
was the MBUS pin. This pin is one pin bidirectional bus for both transmitting and
receiving data from the phone. It is slow (9600bps) and only half-duplex. Only two pins
on the phone are used that are ground and data. M-Bus runs at 9600bps, 8 data bits, odd
parity, and one stop bit. The data terminal ready (DTR) pin must be cleared with the
request to send (RTS).

F-Bus is the later high-speed full-duplex bus. It uses one pin for transmitting data
and one pin for receiving data plus the ground pin. Very much like a standard serial
port. It is fast 115,200bps, 8 data bits, no parity, one stop bit. For F-Bus the data
terminal ready (DTR) pin must be set and the request to send (RTS) pin cleared. The FBus is bi-directional serial type bus running at 115,200bps, 8 data bits. The serial cable
contains electronics for level conversion and therefore requires power. The first thing to
do is supply power to the cable electronics and this is done by setting the DTR (Data
Terminal Ready) pin and clearing the RTS (Request to Send) pin. To synchronize the
UART in the phone with your PC or microcontroller send a string of 0x55 or 'U' 128
times. Then the bus is ready to use.

Figure 2.3: Nokia 3310 Connection Port

14

2.2

Sony Ericsson K700i

Another phone that was survey for this project was Sony Ericsson K700i.This
phone was manufactured by Sony and it is from Japan technology. This phone has
special features which it can accept the AT Commands. This command is a special
command that used to communicate between the phone and the computer.

Figure 2.4: Sony Ericsson K700i Connection Port

This phone has a port which enables user to connect the data cable. This data
cable act as the connection between the phones to other sources such as computer. For
this project, it is need to study the useful port in order to connect the phone to the
microcontroller chip. The table below shows the meaning and the purpose each of the
port of the phone.

15

Table 1: Sony Ericsson Port Connection with Description


PIN

NAME

DESCRIPTION

ATMS

Audio to mobile

AFMS/RTS

Audio from mobile/RTS

CTS/ONREQ

CTS/Mobile Station On Request

DATA IN

Data to mobile (Rx)

DATA OUT

Data from mobile (Tx)

ACC IN

Accessory control to mobile. Used as Rx in


some models for flashing.

ACC OUT

Accessory control from mobile/hands free


sense. Used as Tx in some models for flashing

AGND

Audio signal ground +0V reference

FLASH

Flash memory voltage +service(shorted to pin


11 in service cable)

10

DGND

Digital ground

11

VCC

DC+ for battery charging + external accessory


powering

16

2.3 PIC16F84A Microcontroller

Figure 2.5: PIC16F48A Microcontroller

This microcontroller is from the PIC manufacturer. The PIC16F84A is


categorized on the medium range among this type of microcontroller. The PIC is an 8
bit microcontroller based on Harvard architecture that is internal busses is separate for
memory and data. The throughput rate is therefore increased due to simultaneous access
to both data and program memory. It is conventional controllers tend to have one
internal bus handling both data and program. Besides the instructions fit into a 12 or 14
bit program memory word. For the instruction set are based on registers and each
instruction is executes in one clock cycle.

It has an internal divide by 4 connected between the oscillator and internal


clock bus. This make instruction times easy to calculate. The operation of this
microcontroller is fully static. This means that if the clock stop all the register contents
are maintained. For the drive capability, it has high output drive capability and can
directly drive LED. For the input output pins it can sink 25mA, has an 8 bit port
100mA.The instruction only have 35 instructions.

17

2.4 Serial Interfacing RS-232

Figure 2.6: RS-232 9 pin Serial Interfacing

The electronic data communication can be divided into two categories that are
single ended and differential.RS-22 is categorize into single ended that was introduced
in 1962 and until now it is widely use in the industry. Independent channels are
established for two-way (full-duplex) communications. The RS232 signals are
represented by voltage levels with respect to a system common (power / logic ground).
The "idle" state (MARK) has the signal level negative with respect to common, and the
"active" state (SPACE) has the signal level positive with respect to common. RS232 has
numerous handshaking lines (primarily used with modems), and also specifies a
communications protocol.

The data of RS-22 is bi-polar and the range is between +3V to +12V.This
voltage indicate for ON or O (SPACE) state condition. The voltage between -3V to
-12V indicates of an OFF or 1 state (MARK) condition. Nowadays modern computer
equipments ignore the negative voltage levels and accept zero voltage as a OFF state.
Also the ON state can be operating with the lesser positive voltage. This means that
+5V can capable to driving this RS-232 interfacing. The output signal level usually

18
swings between +12V and -12V. The "dead area" between +3v and -3v is designed to
absorb line noise. In the various RS-232-like definitions this dead area may vary. For

instance, the definition for V.10 has a dead area from +0.3v to -0.3v. Many receivers
designed for RS-232 are sensitive to differentials of 1v or less. This can cause problems
when using pin powered widgets - line drivers, converters, modems etc. These types of
units need enough voltage & current to power them self's up. Typical URART (the RS232 I/O chip) allows up to 50ma per output pin - so if the device needs 70ma to run we
would need to use at least 2 pins for power. Some devices are very efficient and only
require one pin (some times the Transmit or DTR pin) to be high - in the "SPACE" state
while idle. An RS-232 port can supply only limited power to another device. The
number of output lines, the type of interface driver IC, and the state of the output lines
are important considerations.

The types of driver ICs used in serial ports can be divided into three general categories:

Drivers which require plus (+) and minus (-) voltage power supplies such as the
1488 series of interface integrated circuits. (Most desktop and tower PCs use
this type of driver.)

Low power drivers which require one +5 volt power supply. This type of driver
has an internal charge pump for voltage conversion. (Many industrial
microprocessor controls use this type of driver.)

Low voltage (3.3 v) and low power drivers which meet the EIA-562 Standard.
(Used on notebooks and laptops.)

Data is transmitted and received on pins 2 and 3 respectively. Data Set Ready
(DSR) is an indication from the Data Set (i.e., the modem or DSU/CSU) that it is on.
Similarly, DTR indicates to the Data Set that the DTE is on. Data Carrier Detect (DCD)

19
indicates that a good carrier is being received from the remote modem. Pins 4 RTS
(Request to Send - from the transmitting computer) and 5 CTS

(Clear To Send - from the Data set) are used to control. In most Asynchronous
situations, RTS and CTS are constantly on throughout the communication session.
However where the DTE is connected to a multipoint line, RTS is used to turn carrier
on the modem on and off. On a multipoint line, it's imperative that only one station is
transmitting at a time (because they share the return phone pair). When a station wants
to transmit, it raises RTS. The modem turns on carrier, typically waits a few
milliseconds for carrier to stabilize, and then raises CTS. The DTE transmits when it
sees CTS up. When the station has finished its transmission, it drops RTS and the
modem drops CTS and carrier together. Clock signals (pins 15, 17, & 24) are only used
for synchronous communications. The modem or DSU extracts the clock from the data
stream and provides a steady clock signal to the DTE. Note that transmit and receive
clock signals do not have to be the same, or even at the same baud rate.

Besides that the RS-232 has several limitations for its connection. The
limitations are listed as follows:

a) Increased power consumptions.


b) Limit the noise immunity and transmission distance.
c) Limit in speed and compatibility.
d) The connector is large by current standards.
e) The use of handshaking lines for flow control is not reliable in many
devices.

CHAPTER III

METHODOLOGY

3.1

Project Methodology

Automatic door lock systems have 3 main blocks of systems which is receiver,
controller and door lock circuit. Receiver for this system is the mobile phone Sony
Ericsson K500i. This mobile phone acts as the signal receiver and received the short
messaging system (SMS) from the user and sends the data to the microcontroller.

A microcontroller of MC68HC11A1 is the major controller of the system. This


microcontroller has power supply connected to it which comes from the regulator
circuit that being builds. The firmware for this microcontroller is program in the chip in
order to program the chip using the boot loader techniques.

The electromagnetic lock is used as the door lock. This electromagnetic lock is
using the electromagnetic principle which will act as an electromagnet when there is
power supply feed to it.

21

3.2 Mobile Phone Characteristics

A Sony Ericsson K700i phone was used in this project. This phone was chosen
because of it compatibility that support the AT-Commands. The short messaging system
(SMS) can be read by using the hyper terminal from the Microsoft Software if the right
AT-Commands sends to the phone.

Figure 3.0: Sony Ericsson K700i Phone

3.3 Controller Circuit

A MC68HC11A1 circuit was build and the main components for the main
circuit for this microcontroller are crystal, capacitor, regulator and max-232 for serial
interfacing purposes. These components are required in order to operate the
microcontroller. Below is the circuit of the microcontroller.

22

Figure 3.1: MC68HC11 Microcontroller Circuit

This microcontroller manufactured by Motorola is an 8 bit microcontroller and


have two accumulators that are accumulator A and B. These accumulator can be joined
together to become an accumulator D which in this case is 16 bit. It also has 512kb
EEPROM, 256kbRAM and ROM is disable for this type of controller. Besides, it also
has the analog to digital converter built in this microcontroller. This analog to digital
converter is an 8 channels, 8 bit, multiplexed input, and successive-approximation
converter. However this features is not used in this project. Another features that was
used for this project is the serial communications interface (SCI) or called universal
asynchronous receiver transmitter (UART).This features was used in this automatic
door lock system project in order the microcontroller read the short messaging system
(SMS) using the received (RD) and transmit (TX) port available at the microcontroller.
These two ports were connected to the received (RD) and transmit (TX) port at the
phone.

23

Figure 3.2: MC68HC11A1 Microcontroller Chip

3.4

Voltage regulator Circuit

Voltage regulator circuit that was built is mainly use to supply the fixed 5V
voltage to the microcontroller circuit. This regulator circuit consists of LM7805 which
is the positive 5V chip regulator. This chip is not stand by itself but there are two
capacitors were used for this circuit. One capacitor was connected at the first and
second pin of the regulator chip and the other was connected at the second and third of
the regulator. These two capacitors act as a voltage stabilizer for the input and the
output for this regulator. So the 5V voltage was supply correctly without any dissipation
of voltage.

Figure 3.3: Voltage Regulator Circuit

24

3.5

Serial Interfacing Circuit

One of the most important circuits regarding this project is the serial interfacing
circuit. This circuit was built in order to make the communication between the
microcontroller and the computer. The major purpose of this circuit is to load the
program that has been written to the microcontroller chip. This serial interfacing circuit
also is the medium to see the program through the hyper terminal which in the
Microsoft software.

This circuit consists of the major component that is MAX232 chip. This chip can
convert between 5 Volt logic and RS232.Many microcontroller have asynchronous
serial port but their input and output use 5Volt logic rather than rs232 voltages.
Interfacing 5Volt logic to an RS232 port requires converting to and from RS232 levels..

Figure 3.4: Serial Interfacing Circuit

25
3.6 Output Circuit

The final circuit for this project was the relay circuit. This relay circuit was
implemented in order to switch the contact to open circuit if the true signal (SMS) was
send by the user. At the initial condition, the relay is normally closed. This means that
the door is at lock condition at the initial state. When there is true message send by the
user then only the microcontroller trigger the relay to the open circuit state. Figure
below shows the relay circuit:

Figure 3.5: Output Circuit (Relay)

3.7 Project Prototype

After completing the circuit implementation, next is to develop the prototype for
the door lock output. For this purposes several material had been prepared such as two
play wood, magnetic lock, nail, screw driver and steel. Before start built the door
prototype, a design for this was sketch in order to give some idea and for the
improvement for next time reference.

26
The door was built from two pieces of wood and from this wood, a measure
was taken and the installation works are done in the lab. Some of the works are cutting
the wood, make a hole to the steel, put and hold the magnetic lock to the steel in order
to attach it to the door lid. This works contribute to the creative thinking and problem
solving technique to finished .Below are some view of the prototype,

Figure 3.6: Project Overview

Figure 3.7: Front View

27

Figure 3.8: Left View

Figure 3.9: Top view

3.8

Component Used

For this project, all components that were used were list together to help the work
become smooth. The component was plan according to the need of the project. List
bellows

28

Table 2: List of Components

3.9

THRSim11

This automatic door lock project will use not only the hardware implementation
but the software implementation as well. In order to program the microcontroller chip, a
simulator program that called THRSIM11 from the Motorola was being used. This
software was used because it is suite to the chip.

THRSIM simulator was user friendly software because the simulation can be
implemented through the software after the program written by the user. It has features
such as led, switch, traffic light, serial communication receiver and transmitter and so
on. This features can be used according to the program that suite to the objectives that
user want.

29

Figure 3.10: THRSim11 Simulator

Figure 3.11: THRSim11 Simulator Windows

THRSim11 simulator has a menu display on top of the windows. This menu provides
the user a task that they want to use. The task are view, edit, execute, label, breakpoint,

30
connect and so on. This helps the user while programming the project. For this project,
the signal from the phone must be read by the microcontroller and then verified it and
lastly on the output if the right messaging was send by the user. Figure below shows
the transmitter for this simulator. This transmitter will shows that the data that will send
by the phone to the microcontroller.

Figure 3.12: Serial Transmitter

The data was send by the phone and then is transmitting to the receiver port of the
microcontroller. The data was send serially and one by one from the left side to the right
side. When the data was send by the phone it simultaneously stored in the memory of
the microcontroller as shown below

31

Figure 3.13: Data Stored in the Memory Windows

The data stored in the memory was in the hexadecimal type. The data from the phone
was in the ASCII code. The microcontroller will convert this type of data to
hexadecimal type to store it in the first memory located at $0000 and so on. hen
microcontroller verified the data and found 6F37 which means on, t then on the led
as shown. his led was shown to represent the output trigger for the relay to switch at the
normally open condition.

32

Figure 3.14: Led Output (Represent relay)

After the output has been triggered, it holds for a certain delay in order user to
close the door manually from inside the room. For user to open the door inside the door
they need to push the switch inside the room to release the magnet for the lock.

3.10 HCLOAD

Another software that used in completing this project were HCLOAD. This
software also develops by the Motorola Company in order to load the program that has
been written by the programmer to the microcontroller chip. Using this software enables
to load the program using the boot loader techniques. Boot loader techniques means that
the microcontroller chip can be program directly using the computer through the serial
port. The only need is the serial port and the serial interfacing circuit that was
implementing before.

Besides that this software enable to check and deleting the EEPROM for the
microcontroller.

33

Figure 3.15: HCload

The microcontroller board (MC68HC11A1) that has been finish built was check
whether it is function or not. The serial ports which are transmit (TX) and received
(RD) port was connected to the serial port interfacing circuit and from this circuit the
DB9 connector was connected to the serial port of the computer. After the voltage
supply was feed, the reset button at the microcontroller circuit was press. The green
light from the HCload was display and this means that the microcontroller board was
properly and can be used to implement this project.

For this demo version of THRSim11 and HCload program there are limited source
such as the memory to load the program only limited at EEPROM which the starting
address is $B600.Although this was the constraints it still not effect because the
program written is not exceed the memory that was allocated by this software.

34

3.11 Hyper terminal

Before starting to write the program through THRSim11, a preliminary works


have been done which is to know the short messaging signal (SMS) from the Sony
Ericsson phone. The method was implemented by using the hyper terminal software
which comes directly with the Microsoft software.

Figure 3.16: Hyper terminal Windows

For setting the connection from the phone to the hyper terminal, a menu which
shows the phone connection at left side corner of the windows was select. This means
that a connection between the phone and the computer was made.

35

Figure 3.17: Com Port Windows Selector

After the connection was selected, then the com port that being used for
connection between phone and microcontroller was choose that is com 4.This is to
make sure the correct port that the phone and the computer is connected together.

Figure 3.18: Baud Rate Selector Windows

36

Next is to select the baud rate for the connection. Baud rate means the speed of transfer
rate for the data from the phone to the computer. For this connection 9600bps
connection was used because this connection was suitable for the phone.

Figure 3.19: SMS Signal from the Phone

The code for this project is created with the easy code which in this case is on.
This on signal coming from the phone was then detect by the hyper terminal by
sending special command in order to communicate the phone with the computer. First
the code AT was sends through the hyper terminal. Then the phone replied the response
which in this case is ok. This means that the phone support this type of command. The
command known as AT-Commands. AT means attention. After that, then the command
to read the message from the first memory of the phone was send. Then the phone
replied with the string of data which

07910621000010F5040B910671677925F9000080306000849223026F37.

37

Consider that the exact message sending by the user was on. And the response from
the hyper terminal was shown before. Note that the coding for the exact message was
located at the last of the string of data which are 6F37.This data are represent the on
which send by the user.

3.12 How to Know the Actual Message

07910621000010F5040B910671677925F9000080306000849223026F37.

6F37

Let be informed that the data from the phone was shown above. It is the string type
of data. The coding for the actual message was 6F37.To convert this data in order to
identify the actual data is firstly the data is divided in two section which every section
include two character. After that, convert the two separated section to its binary value.
Second, the zero from the MSB for data 6F is put on the right side of data 37 which
have been converted to the binary just now. Now by referring to the ASCII chart shown
below, the actual message was identified which for the first character was o and the
second character was n. So the message send by user was on.

6F = 0110 1111
37 = 0011 0111

38

0110

1111

0011

01110 (Zero from the MSB for 6F is put at the LSB of 37)

Figure 3.20: ASCII Chart for o Character

Figure 3.21: ASCII Chart for n Character

39

3.13

Assembly Language

Assembly language is a language that low level programming language using


the human readable instructions of the central processing unit. This project was used the
assembly language to develop the program that suite to the objectives. This
programming has been done using the THRSim11 simulator and the program was
shown below:

DFTRIO

EQU $1000

BAUD

EQU $2B

SCCR1

EQU $2C

SCCR2

EQU $2D

SCSR

EQU $2E

SCDR

EQU $2F

PORTB

EQU $04

PORTE

EQU $0

ORG

$FF00

LDX

#DFTRIO

LDY

#MSG

LDAA

#$30

STAA

BAUD,X

CLR

SCCR1,X

LDAA

#%00000100

STAA

SCCR2,X

40

RCV BRCLR

SCSR,X #%00100000

LDAA

SCDR,X

CMPA

#'6'

BEQ

LAGI

STAA

0,Y

RCV

INY
BRA

RCV

LAGI NOP
RC

BRCLR

SCSR,X #%00100000

LDAA

SCDR,X

CMPA

#'F'

BEQ

LAG

STAA

0,Y

RC

INY
BRA

RC

LAG NOP
R

BRCLR

SCSR,X #%00100000

LDAA

SCDR,X

CMPA

#'3'

BEQ

LA

STAA

0,Y

INY
BRA

41

LA
TERIMA

ONRELAY

DELAY

NOP
BRCLR

SCSR,X #%00100000

LDAA

SCDR,X

CMPA

#'7'

BEQ

ONRELAY

BRA

RCV

LDAB

#%11111111

STAB

PORTB,X

BRA

DELAY

LDAB

#240

LDY

#$8B7E

TERIMA

;DELAY30S UNTUK
;PENGGUNA
;TUTUP PINTU BALIK

ULANG

DEY
BNE

ULANG

DECB
BNE

DELAY

LDAB

#%00000000

STAB

PORTB,X

LDAA

PORTE,X

CMPA

#%11111111

;OFF RELAY

42
BEQ

ONDALAM

;KALAU TEKAN SUIS


;DARIPADA DALAM
;MAGNETIC RELEASE

BRA

ONDALAM LDAB

RCV

#%11111111

;NAK

BUKAK

PINTU

;DALAM PAKAI SUIS

STAB

PORTB,X

LDY

#$6F96

;DELAY UNTUK USER


;TUTUP PINTU SELEPAS
;BUKAK DPD DALM

GO

DEY
BNE

GO

BRA

RCV

ORG

$0000

MSG RMB

32

DARI

43
3.14

AT-Commands

Computer use an AT commands to communicate with modems. Most


communication applications have user interface that hide the AT commands from the
user. AT Commands can be relate via a communications application. When the phone
has received an AT command, it respond with message that is displayed on the screen
of the used device which in this case is hyper terminal.

The AT or at prefix must be added to the beginning of each command line.


Several AT commands can be type on the same line and the AT or at need to be
entered only once at the beginning line. There are many ways of AT Commands that
suite to the user need. User can check the phone number, read and send text message,
delete message, check the service center number, select phone memory and many more
through AT Commands.

Note that every command has + prefix after the AT prefix. This sign is
compulsory in order to use the commands. Some of the AT Commands that was used in
this project are:

AT

: This command must be entered in order to check


whether

the

phone

support

this

command

or

not.

AT+CPMS=ME

Select the phone memory only (SIM card memory


is disabled)

AT+CMGR=1

: Read the first message in the first memory of the


phone.

AT+CMGD=1

: Delete the first message in the first memory of the


phone.

44
3.15 System Flow Chart

START

READ MESSAGE FROM


PHONE

DELETE
MESSAGE
COMPARE
on

YES
SWITCH THE RELAY
TO NORMALLY OPEN

DELAY 30s

SWITCH THE RELAY


TO NORMALLY

NO

CHAPTER IV

RESULT AND DISCUSSION

4.0 Result

4.0.1 Voltage Regulator Circuit

After the project has been finished work with, all of the circuit that was built was
successfully work. For the voltage regulator circuit, it successfully work which enable
to supply the continuous fixed 5 Volt to the other circuit that used in this project. he
adapter was used for the input voltage of the regulator. Since the regulator was built
from LM7805 chip, he maximum voltage input for this chip is 24V.This chip LM7805
were used because of the capability to supply the positive 5 Volt continuously. The red
led was used as the indicator to indicate that whether there is voltage output from the
regulator or not. If the led is shows the red light, this means that there is output voltage
from the regulator circuit.

As an additional component to the regulator circuit, two capacitors were


connected each at the input and output of the LM7805 chip. This is to make the voltage
input to the regulator and the output voltage are stabilize without any dissipation.

46

Figure 4.0: Voltage Regulator Circuit

4.0.2

Microcontroller MC68HC11A1 Circuit

Next for the controller of the system the microcontroller MC68HC11A1 from
the Motorola manufacturer was successfully built. This microcontroller has been tested
in order to make sure it can receive the program written or not. For this microcontroller
it works with the 5 Volt as a supply to the chip. Attached at this circuit are two button,
red led, output port pins, oscillator, capacitor and resistor.

Figure 4.1: Microcontroller Circuit

47

The red led work and red light seen after the 5 Volt are supply to the microcontroller.
Next when the transmit and receive port are connected to the serial interfacing circuit
and checking using HCLoad software, the green light of the software shows at the
monitor screen as the reset button was pressed. This means that the microcontroller
circuit is properly functioning.

4.0.3

Serial Interfacing Circuit

The serial interfacing circuits that have been build work properly. This serial
interfacing circuit is used to load the program that has been written to the
microcontroller chip. After done with the programming, the program was load in the
microcontroller chip using the HCLOAD software. Transmit (TX) and receive (RD)
port for the serial interfacing circuit was connected to transmit (TX) and receive (RD)
of port at the microcontroller. The green lights at the HCLOAD software are shown
after the reset button for the microcontroller are pressed.

The serial interfacing circuit is connected to the computer by using the DB9
connector. The specifications of the RS232 connector are:

48

Table 3: RS-232 Specification

4.0.4

Relay Circuit

For the last circuit for this project, the relay circuit has successfully built. This
circuit was built because of to release the magnetic in order user open the door. The
magnetic lock at initial condition was in the lock condition. In other words the relay
condition the initial state is normally closed. After the right message was send by the
user, the microcontroller will trigger the relay to the normally open. This means that the
magnetic effect was enabled. The concept of putting the transistor to the relay is that
implement the transistor as a switching device.

49

Figure 4.2: Relay Circuit

4.0.5

Project Prototype

In completing the project prototype, there are lots of works done to design the
door using the wood. The wood was obtained from recycle shop at Taman Universiti.
The design work has been done first in order to create a good prototype which can be
equal as an exact situation.

Figure 4.3: Project Prototype

50

Design was first sketch on a sheet of paper and the measurement was taken based on the
suitable cases. The door consists of the lid, handle, frame of the door and lastly is the
magnetic lock which is attached to the steel that hold the magnetic lock. The door was
properly design and lastly the result is that a good prototype of door lock was built.

4.0.6

Software Skills

After finished doing this project, what I have learned was the programming
skills using the assembly language. Although there are lot of programming language
such as C, C++, JAVA but assembly language are easy for me to understand the
meaning. Also from this project, searching for information from a various sources skills
also has been learned. To know the characteristics of the microcontroller, the data sheet
is an important reference for this. In the data sheet all the characteristics of the
microcontroller was obtained. Besides, the programming skills require the critical and
creative thinking in order to write the program.

4.1

Discussion

In this project that has been done, all the circuit was successfully worked. There
is on problem encountered which is the microcontroller cannot read the message from
the phone and function as needed in the first objectives. Searching for the problem was
done to detect where the problem is. From the simulation that has been done using the
THRSim11 simulator, it shows that after the microcontroller read the data from the
phone, it will store the data in the memory inside it. But after testing with the real
hardware the situation is not same with the simulation that has been done.

51

4.1.0

Obstacles Encountered

In completing this project, there are several problems encountered. The


problems are:

i. Difficulty looking for the suitable phone that suite to the project
objective. There are two different model that are Nokia and Sony Ericsson
model.

Solution: Search for information and Sony Ericsson phone support AT


Commands.

ii. Problems on find the suitable data cable in order to connect the phone to
the microcontroller.

Solution: Ask a friend that was doing the project that will use the SMS
concept. Finally the cable was found and can be used in this
project.

iii. Hardware of microcontroller circuit was enable to work properly at first

Solution: Do the troubleshooting work over and over. Using the multimeter
to check the voltage supply whether it is supplied or not. Finally,
the microcontroller circuit was properly functioning.

CHAPTER V

CONCLUSION AND RECOMMENDATIONS

5.1

Conclusion

Security system nowadays has become an important aspect to human life. As the
need was demanding nowadays, this system was built in order to meet the demand in
the security system. The Automatic Door Lock System was built in order to help user in
opening their door without using the key. This system using short messaging system
(SMS) in order to open the door. This concept gives the additional features in the
security system as well as to help the consumer for more security of their life.

In this project, the objective that learning the SMS technology has be met. This
knowledge can be implemented in more complex system later. Besides, through this
project a lot of skills have been develop not only in the software and hardware skills but
the capabilities of searching for important data also have been learned.

53

5.2

Future Recommendations

This project could be improved for the next future as listed below:

i.

Signals Display
A suitable display for lock and unlock condition could be made in order
to enable user to know the condition of the door whether it is in lock
condition or not.

ii.

Charging Port

A charging port for the phone could be made in future in order to charge the
phone in case of it battery does not have the supply.

iii

Security Features

A security features such as a device to detect the unusual way of opening


the door others than the originally specified.

54

REFERENCES

1. Daniel J. Black (2001).Technicians guide to the 68HC11


Microcontroller. New York: Delmar Learning a division of Thomson
learning Inc .Pg 1-362.

2. Jan Axelson (2000).Serial Port Complete Chinook: Lakeview Research.


Pg 1- 295.

3. Jonathan W. Valvano. (2000).Embedded Microcomputer Systems.Brooks/Cole


Thomson Learning. Pg 1-743.

4. Motorola Inc (1991).The MC68HC11 reference manual.

5. Wikipedia

(2004),

"Mobile

Phone"

retrieved

23

October,

2004,

from

http://en.wikipedia.org/wiki/Mobile_phone.

6. Nurhuda

bt

Zahari

(2006),

Automatic

Fire

Alarm.Universiti

Teknologi

Malaysia:Bachelor.Thesis

7. Sin

Chung

Fei

(2006),

Malaysia:Bachelor.Thesis

Smart

Automatic

Door.

Universiti

Teknologi

55

APPENDICES

GANTT CHART for PSM 1

TASK
1
Briefing on
PSM
Meeting
with
supervisor
Select
project
Search
information
for the
project
tools,
software,
articles
Submit
proposal
Search &
Design
circuit
Prepared
for
presentation
Presentation
of PSM 1
Reports
preparation
Submit
reports

WEEK
8
9

10

11

12

13

14

15

56

GANTT CHART for PSM 2


TASK

WEEK
1

Submit the
progress of
project
Build
circuit
Submit
summary of
project
Prepare for
presentation
and demo
Presentation
and demo
Thesis
preparation
Submit
thesis draft
Submit
thesis and
CD

10 11 12 13 14 15 16 17

You might also like