You are on page 1of 66

Andriod mobile controlled door security locking system by using TCP-IP

CHAPTER 1
INTRODUCTION
An embedded system is a special-purpose system in which the computer is
completely encapsulated by or dedicated to the device or system it controls. Unlike a
general-purpose computer, such as a personal computer, an embedded system performs
one or a few predefined tasks, usually with very specific requirements. Since the system
is dedicated to specific tasks, design engineers can optimize it, reducing the size and
cost of the product. Embedded systems are often mass-produced, benefiting from
economies of scale.
Personal digital assistants (PDAs) or handheld computers are generally
considered embedded devices because of the nature of their hardware design, even
though they are more expandable in software terms. This line of definition continues to
blur as devices expand. With the introduction of the OQO Model 2 with the Windows
XP operating system and ports such as a USB port — both features usually belong to
"general purpose computers", — the line of nomenclature blurs even more.

Fig 1.1 Embedded system

Embedded systems plays major role in electronics varies from portable devices to
large stationary installations like digital watches and MP3 players, traffic lights, factory
controllers, or the systems controlling nuclear power plants.
In terms of complexity embedded systems can range from very simple with a
single microcontroller chip, to very complex with multiple units, peripherals and
networks mounted inside a large chassis or enclose.

Page | 1
Andriod mobile controlled door security locking system by using TCP-IP

CHAPTER 2
BLOCK DIAGRAM AND SCHEMATIC DIAGRAM

POWER
SUPPLY LCD

MICRO
WIFI
SWITCH
(OTP) CONTROLLER

SWITCHES DOOR MOTOR

2.1 Block diagram

2.1.1 BLOCK DIAGRAM DESCRIPTION

Power Supply: This section is meant for supplying Power to all the sections mentioned
above. It basically consists of a Transformer to step down the 230V ac to 9V ac
followed by diodes. Here diodes are used to rectify the ac to dc. After rectification the
obtained rippled dc is filtered using a capacitor Filter. A positive voltage regulator is
used to regulate the obtained dc voltage.

Page | 2
Andriod mobile controlled door security locking system by using TCP-IP

Microcontroller: This section forms the control unit of the whole project. This section
basically consists of a Microcontroller with its associated circuitry like Crystal with
capacitors, Reset circuitry, Pull up resistors (if needed) and so on. The Microcontroller
forms the heart of the project because it controls the devices being interfaced and
communicates with the devices according to the program being written.
MAX 232: The microcontroller can communicate with the serial devices using its
single Serial Port. The logic levels at which this serial port operates is TTL logics. But
some of the serial devices operate at RS 232 Logic levels. For example PC and GSM
etc. So in order to communicate the Microcontroller with either GSM modem or PC, a
mismatch between the Logic levels occurs. In order to avoid this mismatch, in other
words to match the Logic levels, a Serial driver is used. And MAX 232 is a Serial Line
Driver used to establish communication between microcontroller and PC (or GSM)
LCD Display: This section is basically meant to show up the status of the project. This
project makes use of Liquid Crystal Display to display / prompt for necessary
information.
WIFI module: This module helps the data to get placed in the internet and get
transferred to the other authenticated users through a wireless network. Here we use
WIFI module named as HLink RM04.

2.2 Schematic diagram

Page | 3
Andriod mobile controlled door security locking system by using TCP-IP

Explanation:
In this project we required operating voltage for ARM controller board is 12V. Hence
the 12V D.C. power supply is needed for the ARM board. This regulated 12V is
generated by stepping down the voltage from 230V to 18V now the step downed a.c
voltage is being rectified by the Bridge Rectifier using 1N4007 diodes. The rectified
a.c voltage is now filtered using a ‘C’ filter. Now the rectified, filtered D.C. voltage is
fed to the Voltage Regulator. This voltage regulator provides/allows us to have a
Regulated constant Voltage which is of +12V. The rectified; filtered and regulated
voltage is again filtered for ripples using an electrolytic capacitor 100μF. Now the
output from this section is fed to microcontroller board to supply operating voltage.

LCD is interfaced to the controller Port 1 of P1.16 to P 1.21.

GSM is connected to UART0

Keys are connected to pins

Motors are connected to pin

Page | 4
Andriod mobile controlled door security locking system by using TCP-IP

CHAPTER 3

HARDWARE COMPONENTS

3.1 Microcontroller (LPC 2148):

ARM stands for Advanced RISC Machines. It is a 32 bit processor core, used
for high end application. It is widely used in Advanced Robotic Applications.

3.1.1 History and Development:

• ARM was developed at Acron Computers ltd of Cambridge, England between


1983 and 1985.
• RISC concept was introduced in 1980 at Stanford and Berkley.
• ARM ltd was found in 1990.
• ARM cores are licensed to partners so as to develop and fabricate new
microcontrollers around same processor cores.

Page | 5
Andriod mobile controlled door security locking system by using TCP-IP

3.1.2 Key features:


• 16-bit/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.
• 8 kB to 40 kB of on-chip static RAM and 32 kB to 512 kB of on-chip flash
memory.
• 128-bit wide interface/accelerator enables high-speed 60 MHz operation.
• In-System Programming/In-Application Programming (ISP/IAP) via on-chip
boot loader software. Single flash sector or full chip erase in 400 ms and
programming of 256 bytes in 1 ms.
• Embedded ICE RT and Embedded Trace interfaces offer real-time debugging
with the on-chip Real Monitor software and high-speed tracing of instruction
execution.
• USB 2.0 Full-speed compliant device controller with 2 kB of endpoint RAM.
• In addition, the LPC2146/48 provides 8 kB of on-chip RAM accessible to USB
by DMA.
• One or two (LPC2141/42 vs. LPC2144/46/48) 10-bit ADCs provide a total of
6/14 analog inputs, with conversion times as low as 2.44 μs per channel.
• Single 10-bit DAC provides variable analog output (LPC2142/44/46/48 only).
• Two 32-bit timers/external event counters (with four capture and four compare
channels each), PWM unit (six outputs) and watchdog.
• Low power Real-Time Clock (RTC) with independent power and 32 kHz clock
input.
• Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus
(400 kbit/s),
• SPI and SSP with buffering and variable data length capabilities.
• Vectored Interrupt Controller (VIC) with configurable priorities and vector
addresses.
• Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny LQFP64 package.
• Up to 21 external interrupt pins available.
• 60 MHz maximum CPU clock available from programmable on-chip PLL with
settling time of 100 μs.
• On-chip integrated oscillator operates with an external crystal from 1 MHz to
25 MHz.

Page | 6
Andriod mobile controlled door security locking system by using TCP-IP

• Power saving modes include Idle and Power-down.

Fig 3.1.1 LPC 2144/46/48 PINNING

3.1.3 Block diagram :

Page | 7
Andriod mobile controlled door security locking system by using TCP-IP

Page | 8
Andriod mobile controlled door security locking system by using TCP-IP

3.1.4 Pin description

Page | 9
Andriod mobile controlled door security locking system by using TCP-IP

Page | 10
Andriod mobile controlled door security locking system by using TCP-IP

Page | 11
Andriod mobile controlled door security locking system by using TCP-IP

Page | 12
Andriod mobile controlled door security locking system by using TCP-IP

3.2 UNIVERSAL ASYNCHRONOUS RECEIVER/TRANSMITTER

3.2.1 UART 0 Features:


• 16 byte Receive and Transmit FIFOs
• Register locations conform to ‘550 industry standard
• Receiver FIFO trigger points at 1, 4, 8, and 14 bytes
• Built-in fractional baud rate generator with autobauding capabilities.
• Mechanism that enables software and hardware flow control implementation

Pin description:

Register description:

Page | 13
Andriod mobile controlled door security locking system by using TCP-IP

Architecture:
• The VPB interface provides a communications link between the CPU or host
and the UART0.
• The UART0 receiver block, U0RX, monitors the serial input line, RXD0, for
valid input. The
• UART0 RX Shift Register (U0RSR) accepts valid characters via RXD0. After
a valid character
• is assembled in the U0RSR, it is passed to the UART0 RX Buffer Register FIFO
to await access by the CPU or host via the generic host interface.

The UART0 transmitter block, U0TX, accepts data written by the CPU or host and
buffers the data in the UART0 TX Holding Register FIFO (U0THR). The UART0 TX
Shift Register (U0TSR) reads the data stored in the U0THR and assembles the data to
transmit via the serial output pin, TXD0

The UART0 Baud Rate Generator block, U0BRG, generates the timing enables used
by the UART0 TX block. The U0BRG clock input source is the VPB clock (PCLK).
The main clock is divided down per the divisor specified in the U0DLL and U0DLM
registers. This divided down clock is a 16x oversample clock, NBAUDOUT. The
interrupt interface contains registers U0IER and U0IIR. The interrupt interface receives
several one clock wide enables from the U0TX and U0RX blocks. Status information
from the U0TX and U0RX is stored in the U0LSR. Control information for the U0TX
and U0RX is stored in the U0LCR

Page | 14
Andriod mobile controlled door security locking system by using TCP-IP

Fig3.2.1 UART 0 BLOCK DIAGRAM

3.2.2 UART 1 Features:


• UART1 is identical to UART0, with the addition of a modem interface.
• 16 byte Receive and Transmit FIFOs
• Register locations conform to ‘550 industry standard
• Receiver FIFO trigger points at 1, 4, 8, and 14 bytes
• Built-in fractional baud rate generator with autobauding capabilities.
• Mechanism that enables software and hardware flow control implementation
Standard modem interface signals included with flow control (auto-CTS/RTS)

Page | 15
Andriod mobile controlled door security locking system by using TCP-IP

Pin description:

Register description:

Page | 16
Andriod mobile controlled door security locking system by using TCP-IP

Architecture:

The VPB interface provides a communications link between the CPU or host and the
UART1. The UART1 receiver block, U1RX, monitors the serial input line, RXD1, for
valid input. The UART1 RX Shift Register (U1RSR) accepts valid characters via
RXD1. After a valid character is assembled in the U1RSR, it is passed to the UART1
RX Buffer Register FIFO to await access by the CPU or host via the generic host
interface The UART1 transmitter block, U1TX, accepts data written by the CPU or host
and buffers the data in the UART1 TX Holding Register FIFO (U1THR). The UART1
TX Shift Register
U1TSR) reads the data stored in the U1THR and assembles the data to transmit via the
serial output pin, TXD1. The UART1 Baud Rate Generator block, U1BRG, generates
the timing enables used by the UART1 TX block. The U1BRG clock input source is
the VPB clock (PCLK). The main clock is divided down per the divisor specified in the
U1DLL and U1DLM registers. This divided down clock is a 16x oversample clock,
NBAUDOUT The modem interface contains registers U1MCR and U1MSR. This
interface is responsible for handshaking between a modem peripheral and the UART1

The interrupt interface contains registers U1IER and U1IIR. The interrupt interface
receives several one clock wide enables from the U1TX and U1RX blocks.Status
information from the U1TX and U1RX is stored in the U1LSR. Control information for
the U1TX and U1RX is stored in the U1LCR.

Page | 17
Andriod mobile controlled door security locking system by using TCP-IP

Fig 3.2.2 UART1 BLOCK DIAGRAM

3.3 ANALOG-TO-DIGITAL CONVERTER (ADC):

Features:
• 10 bit successive approximation analog to digital converter (one in LPC2141/2
and two in LPC2144/6/8).
• Input multiplexing among 6 or 8 pins (ADC0 and ADC1).
• Power-down mode.
• Burst conversion mode for single or multiple inputs.
• Optional conversion on transition on input pin or Timer Match signal.
• Global Start command for both converters (LPC2144/6/8 only).

Description:
Basic clocking for the A/D converters is provided by the VPB clock. A programmable
divider is included in each converter, to scale this clock to the 4.5 MHz (max) clock
needed by the successive approximation process. A fully accurate conversion requires
11of these clocks.
Pin description:

Page | 18
Andriod mobile controlled door security locking system by using TCP-IP

Operation:
Hardware-triggered conversion:
If the BURST bit in the ADCR is 0 and the START field contains 010-111, the ADC
will start a conversion when a transition occurs on a selected pin or Timer Match signal.
Th choices include conversion on a specified edge of any of 4 Match signals, or
conversion on a specified edge of either of 2 Capture/Match pins. The pin state from
the selected pad or the selected Match signal, XORed with ADCR bit 27, is used in the
edge detection logic

Interrupts:
An interrupt request is asserted to the Vectored Interrupt Controller (VIC) when the
DONE bit is 1. Software can use the Interrupt Enable bit for the A/D Converter in the
VIC to control whether this assertion results in an interrupt. DONE is negated when the
ADDR is read.

3.4 Power Supply:


The power supply is designed to convert high voltage AC mains electricity to
a suitable low voltage supply for electronic circuits and other devices. A power supply
can by broken down into a series of blocks, each of which performs a particular
function. A D.C. power supply which maintains the output voltage constant
irrespective of a.c mains fluctuations or load variations is known as “Regulated D.C
Power Supply”

Page | 19
Andriod mobile controlled door security locking system by using TCP-IP

For example a 5V regulated power supply system as shown below:

Fig 3.4.1 : Functional Block Diagram of Power supply

3.5 Transformer:
A transformer is an electrical device which is used to convert electrical power
from one electrical circuit to another without change in frequency.
Transformers convert AC electricity from one voltage to another with little loss
of power. Transformers work only with AC and this is one of the reasons why mains
electricity is AC. Step-up transformers increase in output voltage, step-down
transformers decrease in output voltage. Most power supplies use a step-down
transformer to reduce the dangerously high mains voltage to a safer low voltage. The
input coil is called the primary and the output coil is called the secondary. There is no
electrical connection between the two coils; instead they are linked by an alternating
magnetic field created in the soft-iron core of the transformer. The two lines in the
middle of the circuit symbol represent the core. Transformers waste very little power
so the power out is (almost) equal to the power in. Note that as voltage is stepped down
current is stepped up. The ratio of the number of turns on each coil, called the turn’s
ratio, determines the ratio of the voltages. A step-down transformer has a large number
of turns on its primary (input) coil which is connected to the high voltage mains supply,
and a small number of turns on its secondary (output) coil to give a low output voltage.

Page | 20
Andriod mobile controlled door security locking system by using TCP-IP

Fig 3.5.1: An Electrical Transformer

Turns ratio = Vp/ VS = Np/NS


Power Out= Power In
VS X IS=VP X IP
Vp = primary (input) voltage
Np = number of turns on primary coil
Ip = primary (input) current

3.6 Rectifier:
A circuit, which is used to convert a.c to dc, is known as RECTIFIER. The
process of conversion a.c to d.c is called “rectification”
Types of Rectifiers:
• Half wave Rectifier
• Full wave rectifier
1. Center tap full wave rectifier.
2. Bridge type full bridge rectifier.

3.6.1 Full-wave Rectifier:


From the above comparisons we came to know that full wave bridge rectifier as
more advantages than the other two rectifiers. So, in our project we are using full wave
bridge rectifier circuit.

Page | 21
Andriod mobile controlled door security locking system by using TCP-IP

3.6.1.1 Bridge Rectifier:


A bridge rectifier makes use of four diodes in a bridge arrangement to achieve
full-wave rectification. This is a widely used configuration, both with individual diodes
wired as shown and with single component bridges where the diode bridge is wired
internally.

A bridge rectifier makes use of four diodes in a bridge arrangement as shown in


fig(a) to achieve full-wave rectification. This is a widely used configuration, both with
individual diodes wired as shown and with single component bridges where the diode
bridge is wired internally.

Fig 3.6.1 Bridge Rectifier

Operation:
During positive half cycle of secondary, the diodes D2 and D3 are in forward
biased while D1 and D4 are in reverse biased as shown in the fig(b). The current flow
direction is shown in the fig (b) with dotted arrows.

Fig 3.6.1.1 Bridge rectifier operation during positive half cycle

During negative half cycle of secondary voltage, the diodes D1 and D4 are in
forward biased while D2 and D3 are in reverse biased as shown in the fig(c). The
current flow direction is shown in the fig (c) with dotted arrows.

Page | 22
Andriod mobile controlled door security locking system by using TCP-IP

Fig 3.6.2Bridge restifier operation during negative half cycle

3.7 Filter:
A Filter is a device, which removes the a.c component of rectifier output but
allows the d.c component to reach the load.
Capacitor Filter:
We have seen that the ripple content in the rectified output of half wave rectifier
is 121% or that of full-wave or bridge rectifier or bridge rectifier is 48% such high
percentages of ripples is not acceptable for most of the applications. Ripples can be
removed by one of the following methods of filtering:
(a) A capacitor, in parallel to the load, provides an easier by –pass for the ripples voltage
though it due to low impedance. At ripple frequency and leave the d.c.to appears the
load.
(b) An inductor, in series with the load, prevents the passage of the ripple current (due
to high impedance at ripple frequency) while allowing the d.c (due to low resistance to
d.c)
(c) various combinations of capacitor and inductor, such as L-section filter section
filter, multiple section filter etc. which make use of both the properties mentioned in
(a) and (b) above. Two cases of capacitor filter, one applied on half wave rectifier and
another with full wave rectifier.
Filtering is performed by a large value electrolytic capacitor connected across
the DC supply to act as a reservoir, supplying current to the output when the varying
DC voltage from the rectifier is falling. The capacitor charges quickly near the peak of
the varying DC, and then discharges as it supplies current to the output. Filtering

Page | 23
Andriod mobile controlled door security locking system by using TCP-IP

significantly increases the average DC voltage to almost the peak value (1.4 × RMS
value).
To calculate the value of capacitor(C),
C = ¼*√3*f*r*Rl
Where,
f = supply frequency,
r = ripple factor,
Rl = load resistance
Note: In our circuit we are using 1000microfarads.

Type of Rectifier
Parameter Half wave Full wave Bridge
Number of diodes
1 2 3
PIV of diodes
Vm 2Vm Vm

D.C output voltage Vm/ 2Vm/ 2Vm/

Vdc, at 0.318Vm 0.636Vm 0.636Vm


no-load

Ripple factor 1.21 0.482 0.482


Ripple
frequency f 2f 2f
Rectification
efficiency 0.406 0.812 0.812
Transformer
Utilization 0.287 0.693 0.812
Factor(TUF)
RMS voltage Vrms Vm/2 Vm/√2 Vm/√2
Table 3.7 : Comparison of rectifier circuits:

Page | 24
Andriod mobile controlled door security locking system by using TCP-IP

3.8 Regulator:
Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or
variable output voltages. The maximum current they can pass also rates them. Negative
voltage regulators are available, mainly for use in dual supplies. Most regulators include
some automatic protection from excessive current ('overload protection') and
overheating ('thermal protection'). Many of the fixed voltage regulator ICs have 3 leads
and look like power transistors, such as the 7805 +5V 1A regulator shown on the right.
The LM7805 is simple to use. You simply connect the positive lead of your unregulated
DC power supply (anything from 9VDC to 24VDC) to the Input pin, connect the
negative lead to the Common pin and then when you turn on the power, you get a 5 volt
supply from the output pin.

Fig 3.8 Three Terminal Voltage Regulator


3.8.1 :78XX
The Bay Linear LM78XX is integrated linear positive regulator with three
terminals. The LM78XX offer several fixed output voltages making them useful in wide
range of applications. When used as a zener diode/resistor combination replacement,
the LM78XX usually results in an effective output impedance improvement of two
orders of magnitude, lower quiescent current. The LM78XX is available in the TO-252,
TO-220 & TO-263packages,
Features:
• Output Current of 1.5A
• Output Voltage Tolerance of 5%
• Internal thermal overload protection
• Internal Short-Circuit Limited
• No External Component
• Output Voltage 5.0V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 24V
• Offer in plastic TO-252, TO-220 & TO-263

Page | 25
Andriod mobile controlled door security locking system by using TCP-IP

• Direct Replacement for LM78XX

3.9 Liquid crystal display


Liquid crystal displays (LCDs) have materials, which combine the properties
of both liquids and crystals. Rather than having a melting point, they have a temperature
range within which the molecules are almost as mobile as they would be in a liquid, but
are grouped together in an ordered form similar to a crystal.
An LCD consists of two glass panels, with the liquid crystal material sand
witched in between them. The inner surface of the glass plates are coated with
transparent electrodes which define the character, symbols or patterns to be displayed
polymeric layers are present in between the electrodes and the liquid crystal, which
makes the liquid crystal molecules to maintain a defined orientation angle.
One each polarisers are pasted outside the two glass panels. These polarisers
would rotate the light rays passing through them to a definite angle, in a particular
direction.
When the LCD is in the off state, light rays are rotated by the two polarisers and
the liquid crystal, such that the light rays come out of the LCD without any orientation,
and hence the LCD appears transparent.
When sufficient voltage is applied to the electrodes, the liquid crystal molecules
would be aligned in a specific direction. The light rays passing through the LCD would
be rotated by the polarisers, which would result in activating/ highlighting the desired
characters.
The LCD’s are lightweight with only a few millimeters thickness. Since the
LCD’s consume less power, they are compatible with low power electronic circuits,
and can be powered for long durations.
The LCD’s don’t generate light and so light is needed to read the display. By
using backlighting, reading is possible in the dark. The LCD’s have long life and a wide
operating temperature range.
Changing the display size or the layout size is relatively simple which makes
the LCD’s more customers friendly.
The LCDs used exclusively in watches, calculators and measuring instruments
are the simple seven-segment displays, having a limited amount of numeric data. The
recent advances in technology have resulted in better legibility, more information

Page | 26
Andriod mobile controlled door security locking system by using TCP-IP

displaying capability and a wider temperature range. These have resulted in the LCDs
being extensively used in telecommunications and entertainment electronics. The LCDs
have even started replacing the cathode ray tubes (CRTs) used for the display of text
and graphics, and also in small TV applications.
This section describes the operation modes of LCD’s then describe how to
program and interface an LCD to 8051 using Assembly and C.

3.9.1 LCD pin description


The LCD discussed in this section has 14 pins. The function of each pins is
given in table.

Pin Symbol I/O Description


1 Vss -- Ground
2 Vcc -- +5V power supply
3 VEE -- Power supply to
control contrast
4 RS I RS=0 to select
command register
RS=1 to select
data register
5 R/W I R/W=0 for write
R/W=1 for read
6 E I/O Enable
7 DB0 I/O The 8-bit data bus
8 DB1 I/O The 8-bit data bus
9 DB2 I/O The 8-bit data bus
10 DB3 I/O The 8-bit data bus
11 DB4 I/O The 8-bit data bus
12 DB5 I/O The 8-bit data bus
13 DB6 I/O The 8-bit data bus
14 DB7 I/O The 8-bit data bus
TABLE 3.9.1:Pin description for LCD

Page | 27
Andriod mobile controlled door security locking system by using TCP-IP

Code Command to LCD Instruction


(hex) Register

1 Clear display screen


2 Return home
4 Decrement cursor
6 Increment cursor
5 Shift display right
7 Shift display left
8 Display off, cursor off
A Display off, cursor on
C Display on, cursor off
E Display on, cursor on
F Display on, cursor blinking
10 Shift cursor position to left
14 Shift cursor position to right
18 Shift the entire display to the left
1C Shift the entire display to the right
80 Force cursor to beginning of 1 st line
C0 Force cursor to beginning of 2 nd line
38 2 lines and 5x7 matrix
TABLE 3.9.2 : LCD Command Codes

3.9.2 Uses:
The LCDs used exclusively in watches, calculators and measuring
instruments are the simple seven-segment displays, having a limited amount of numeric
data. The recent advances in technology have resulted in better legibility, more
information displaying capability and a wider temperature range. These have resulted
in the LCDs being extensively used in telecommunications and entertainment
electronics. The LCDs have even started replacing the cathode ray tubes (CRTs) used
for the display of text and graphics, and also in small TV applications.

Page | 28
Andriod mobile controlled door security locking system by using TCP-IP

3.9.3 LCD INTERFACING

Sending commands and data to LCDs with a time delay:

Fig 3.9 Interfacing of LCD to a micro controller

To send any command from table 2 to the LCD, make pin RS=0. For data, make
RS=1.Then send a high –to-low pulse to the E pin to enable the internal latch of the
LCD.
3.10 WIFI
The components, organization, and operation of Wi-Fi networks will be presented.
There is an emphasis on security issues and the available security protocols. Wi-Fi is
the name given by the Wi-Fi Alliance to the IEEE 802.11 suite of standards. 802.11
defined the initial standard for wireless local area networks (WLANs), but it was
considered too slow for some applications and so was superseded by the extensions
802.11a and 802.11b, and later by 802.11g (with the release of 802.11n still pending).
At its most basic, Wi-Fi is the transmission of radio signals. Wireless router offer the
embedded systems engineer many benefits in a wide range of applications.
3.10.1 Benefits of Wi-Fi

Page | 29
Andriod mobile controlled door security locking system by using TCP-IP

We have enormous flexibility that a wireless connection brings to an embedded


application. The addition of wire-less provides more choices for monitoring, control
and the dissemination of information. Practically speak- ing, remote locations become
more accessible and costs drop. The following list summarizes some of the benefits of
a Wi-Fi network.
• Wireless Ethernet. Wi-Fi is an Ethernet replacement. Wi-Fi and Ethernet, both IEEE
802 networks, share some core elements.
• Extended Access. The absence of wires and cables extends access to places where
wires and cables cannot go or where it is too expensive for them to go.
• Cost Reduction
As mentioned above, the absence of wires and cables brings down cost. This is
accomplished by a combination of factors, the relatively low cost of wireless routers,
no need for trenching, drilling and other methods that may be necessary to make
physical connections.
• Mobility. Wires tie you down to one location. Going wireless means you have the
freedom to change your location without losing your connection.
• Flexibility. Extended access, cost reductions, and mobility create opportunities for
new applications as well as the possibility of creative new solutions for legacy
applications
3.10.2 Wi-Fi Embedded System Applications:
The reach of wireless communication in embedded systems continues to grow.
Forrester Research, a company that focuses on the business implications of
technology change, has reported that in a few short years, up to 95% of devices used
to access the Internet will be non-PC devices that use an embedded system. There are
many applications for embedded devices with a Wi-Fi interface:
• Industrial process and control applications where wired connections are too costly or
inconvenient, e.g., continuously moving machinery.
• Emergency applications that require immediate and transitory setup, such as
battlefield or disaster situations.
• Mobile applications, such as asset tracking.
• Surveillance cameras (maybe you don’t want them easily noticed, cables are
difficult to hide).
• Vertical markets like medical, education, and manufacturing.
• Communication with other Wi-Fi devices, like a laptop or a PDA.
Page | 30
Andriod mobile controlled door security locking system by using TCP-IP

3.10.3 AT Command

In AT mode, you can configurate the system parameters through the serial port AT
instruction.
Instruction format is as follows:
At+[command]=[value]\r
According to the different command, module will return a different return value.
For example:"at+remoteip=192.168.11.133\n" set remote ip address as
192.168.11.133.
For example:"at+remoteip=?\n" Inquiry remote ip address.
At command is as follows:
netmode Network mode
wifi_conf Wifi configuration
dhcpc Dhcp client configuration
net_ip Network ip address
>Tes
<Trst

AT Commands
net_dns Network dns address
dhcpd Dhcp server configuration
dhcpd_ip Dhcp server ip address
dhcpd_dns Dhcp server dns address
dhcpd_time Dhcp sever time allocation
net_commit Submit network configuration
out_trans Exit transparent transmission mode
remoteip Remote server domain name or IP address
remoteport The local or distal port number
remotepro Network Protocol type
timeout Network timeout
mode Network mode
uart Serial port configuration

Page | 31
Andriod mobile controlled door security locking system by using TCP-IP

uartpacklen Serial group frame length


uartpacktimeout Serial framing time
save Save the configuration and start service
reconn Restart services
default Restore factory value settings
reboot Restart the module
ver The version of module

3.11 DC Motor

DC motors are configured in many types and sizes, including brush less, servo,
and gear motor types. A motor consists of a rotor and a permanent magnetic field stator.
The magnetic field is maintained using either permanent magnets or electromagnetic
windings. DC motors are most commonly used in variable speed and torque.

Motion and controls cover a wide range of components that in some way are
used to generate and/or control motion. Areas within this category include bearings and
bushings, clutches and brakes, controls and drives, drive components, encoders and
resolves, Integrated motion control, limit switches, linear actuators, linear and rotary
motion components, linear position sensing, motors (both AC and DC motors),
orientation position sensing, pneumatics and pneumatic components, positioning
stages, slides and guides, power transmission (mechanical), seals, slip rings, solenoids,
springs.

Motors are the devices that provide the actual speed and torque in a drive
system. This family includes AC motor types (single and multiphase motors, universal,
servo motors, induction, synchronous, and gear motor) and DC motors (brush less,
servo motor, and gear motor) as well as linear, stepper and air motors, and motor
contactors and starters.

In any electric motor, operation is based on simple electromagnetism. A current-


carrying conductor generates a magnetic field; when this is then placed in an external
magnetic field, it will experience a force proportional to the current in the conductor,
and to the strength of the external magnetic field. As you are well aware of from playing
with magnets as a kid, opposite (North and South) polarities attract, while like polarities

Page | 32
Andriod mobile controlled door security locking system by using TCP-IP

(North and North, South and South) repel. The internal configuration of a DC motor is
designed to harness the magnetic interaction between a current-carrying conductor and
an external magnetic field to generate rotational motion.

Let's start by looking at a simple 2-pole DC electric motor (here red represents
a magnet or winding with a "North" polarization, while green represents a magnet or
winding with a "South" polarization).

Fig 3.11 1 : Block Diagram of the DC motor

Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator,
field magnet(s), and brushes. In most common DC motors (and all that Beamers will
see), the external magnetic field is produced by high-strength permanent magnets1. The
stator is the stationary part of the motor -- this includes the motor casing, as well as two
or more permanent magnet pole pieces. The rotor (together with the axle and attached
commutator) rotates with respect to the stator. The rotor consists of windings (generally
on a core), the windings being electrically connected to the commutator. The above
diagram shows a common motor layout -- with the rotor inside the stator (field)
magnets.

The geometry of the brushes, commutator contacts, and rotor windings are such
that when power is applied, the polarities of the energized winding and the stator
magnet(s) are misaligned, and the rotor will rotate until it is almost aligned with the
stator's field magnets. As the rotor reaches alignment, the brushes move to the next
commutator contacts, and energize the next winding. Given our example two-pole
motor, the rotation reverses the direction of current through the rotor winding, leading
to a "flip" of the rotor's magnetic field, and driving it to continue rotating.

In real life, though, DC motors will always have more than two poles
(three is a very common number). In particular, this avoids "dead spots" in the
Page | 33
Andriod mobile controlled door security locking system by using TCP-IP

commutator. You can imagine how with our example two-pole motor, if the rotor is
exactly at the middle of its rotation (perfectly aligned with the field magnets), it will
get "stuck" there. Meanwhile, with a two-pole motor, there is a moment where the
commutator shorts out the power supply (i.e., both brushes touch both commutator
contacts simultaneously). This would be bad for the power supply, waste energy, and
damage motor components as well. Yet another disadvantage of such a simple motor is
that it would exhibit a high amount of torque” ripple" (the amount of torque it could
produce is cyclic with the position of the rotor).

Fig 3.11.2: Block Diagram of the DC motor having two poles only

So since most small DC motors are of a three-pole design, let's tinker with the
workings of one via an interactive animation (JavaScript required):

Fig 3.11.3 : Block Diagram of the DC motor having Three poles

You'll notice a few things from this -- namely, one pole is fully energized at a time (but
two others are "partially" energized). As each brush transitions from one commutator
contact to the next, one coil's field will rapidly collapse, as the next coil's field will
rapidly charge up (this occurs within a few microsecond). We'll see more about the

Page | 34
Andriod mobile controlled door security locking system by using TCP-IP

effects of this later, but in the meantime you can see that this is a direct result of the coil
windings' series wiring:

Fig 3.11.4: Internal Block Diagram of the Three pole DC motor

There's probably no better way to see how an average dc motor is put together,
than by just opening one up. Unfortunately this is tedious work, as well as requiring the
destruction of a perfectly good motor. This is a basic 3-pole dc motor, with 2 brushes
and three commutator contacts

3.12 H-BRIDGE

DC motors are typically controlled by using a transistor configuration called an "H-


bridge". This consists of a minimum of four mechanical or solid-state switches, such as
two NPN and two PNP transistors. One NPN and one PNP transistor are activated at a
time. Both NPN and PNP transistors can be activated to cause a short across the motor
terminals, which can be useful for slowing down the motor from the back EMF it
creates.

Page | 35
Andriod mobile controlled door security locking system by using TCP-IP

Fig 3.12 H –BRIDGE

Basic Theory

H-bridge. Sometimes called a "full bridge" the H-bridge is so named because it has four
switching elements at the "corners" of the H and the motor forms the cross bar.

The key fact to note is that there are, in theory, four switching elements within the
bridge. These four elements are often called, high side left, high side right, low side
right, and low side left (when traversing in clockwise order).

The switches are turned on in pairs, either high left and lower right, or lower left and
high right, but never both switches on the same "side" of the bridge. If both switches
on one side of a bridge are turned on it creates a short circuit between the battery plus
and battery minus terminals. If the bridge is sufficiently powerful it will absorb that

Page | 36
Andriod mobile controlled door security locking system by using TCP-IP

load and your batteries will simply drain quickly. Usually however the switches in
question melt.

To power the motor, you turn on two switches that are diagonally opposed. In the
picture to the right, imagine that the high side left and low side right switches are turned
on.

The current flows and the motor begins to turn in a "positive" direction. Turn on the
high side right and low side left switches, then Current flows the other direction through
the motor and the motor turns in the opposite direction.

Actually it is just that simple, the tricky part comes in when you decide what to use for
switches. Anything that can carry a current will work, from four SPST switches, one
DPDT switch, relays, transistors, to enhancement mode power MOSFETs.

One more topic in the basic theory section, quadrants. If each switch can be controlled
independently then you can do some interesting things with the bridge, some folks call
such a bridge a "four quadrant device" (4QD get it?). If you built it out of a single DPDT
relay, you can really only control forward or reverse. You can build a small truth table
that tells you for each of the switch's states, what the bridge will do. As each switch has
one of two states, and there are four switches, there are 16 possible states. However,
since any state that turns both switches on one side on is "bad" (smoke issues forth: P),
there are in fact only four useful states (the four quadrants) where the transistors are
turned on.

High Side Left High Side Right Low Side Left Low Side Right Quadrant Description

On Off Off On Forward Running

Off On On Off Backward Running

On On Off Off Braking

Off Off On On Braking

Page | 37
Andriod mobile controlled door security locking system by using TCP-IP

TABLE 3.12.1 truth table

The last two rows describe a maneuver where you "short circuit" the motor which
causes the motors generator effect to work against itself. The turning motor generates
a voltage which tries to force the motor to turn the opposite direction. This causes the
motor to rapidly stop spinning and is called "braking" on a lot of H-bridge designs.

Of course there is also the state where all the transistors are turned off. In this case the
motor coasts freely if it was spinning and does nothing if it was doing nothing.

Implementation

1. Using Relays:

A simple implementation of an H Bridge using four SPST relays is shown.


Terminal A is High Side Left, Terminal B is High Side Right, Terminal C is
Low Side Left and Terminal D is Low Side Right. The logic followed is
according to the table above.

Warning: Never turn on A and C or B and D at the same time. This will lead to
a short circuit of the battery and will lead to failure of the relays due to the large
current.

2. Using Transistors:

Page | 38
Andriod mobile controlled door security locking system by using TCP-IP

We can better control our motor by using transistors or Field Effect Transistors
(FETs). Most of what we have discussed about the relays H-Bridge is true of
these circuits. See the diagram showing how they are connected. You should
add diodes across the transistors to catch the back voltage that is generated by
the motor's coil when the power is switched on and off. This fly back voltage
can be many times higher than the supply voltage!

For information on building an H-Bridge using Transistors, have a look here.

Warning: If you don't use diodes, you could burn out your transistors. Also the
same warning as in the diode case. Don't turn on A and C or B and D at the same
time.

Transistors, being a semiconductor device, will have some resistance, which


causes them to get hot when conducting much current. This is called not being
able to sink or source very much power, i.e.: Not able to provide much current
from ground or from plus voltage.

Mosfets are much more efficient, they can provide much more current and not
get as hot. They usually have the fly back diodes built in so you don't need the
diodes anymore. This helps guard against fly back voltage frying your ICs.

To use Mosfets in an H-Bridge, you need P-Channel Mosfets on top because


they can "source" power, and N-Channel Mosfets on the bottom because then
can "sink" power.

Page | 39
Andriod mobile controlled door security locking system by using TCP-IP

It is important that the four quadrants of the H-Bridge circuits be turned on and
off properly. When there is a path between the positive and ground side of the
H-Bridge, other than through the motor, a condition exists called "shoot
through". This is basically a direct short of the power supply and can cause
semiconductors to become ballistic, in circuits with large currents flowing.
There are H-bridge chips available that are much easier, and safer, to use than
designing your own H-Bridge circuit.

3. Using H-Bridge Devices

The L293 has 2 H-Bridges (actually 4 Half H-Bridges), can provide about 1
amp to each and occasional peak loads to 2 amps.

The L298 has 2 h-bridges on board, can handle 1amp and peak current draws to
about 3amps. The LMD18200 has one h-bridge on board, can handle about 2 or
3 amps and can handle a peak of about 6 amps. There are several more
commercially designed H-Bridge chips as well.

Once a Half H-bridge is enabled, it truth table is as follows:

INPUT OUTPUT
A Y

L L

H H

Table 3.12.2 Half H-bridge truth table

So you just give a High level when you want to turn the Half H-Bridge on and
Low level when you want to turn it off. When the Half H-Bridge is on, the
voltage at the output is equal to Vcc2.If you want to make a Full H-Bridge, you
connect the motor (or the load) between the outputs of two Half H-Bridges and
the inputs will be the two inputs of the Half H-Bridges.

Page | 40
Andriod mobile controlled door security locking system by using TCP-IP

Suppose we have connected Half H-Bridges 1 and 2 to form a Full H-Bridge.


Now the truth table is as follows:

INPUT INPUT OUTPUT OUTPUT


Description
1A 2A 1Y 2Y

Braking (both terminals of


L L L L
motor are Gnd)

L H L H Forward Running

H L H L Backward Running

Braking (both terminals of


H H H H
motor at Vcc2

Table 3.12.3 Full H Bridge truth table

Page | 41
Andriod mobile controlled door security locking system by using TCP-IP

CHAPTER 4
SOFTWARE DESCRIPTION

Softwares used is:


*KEIL µVision using Embedded C programming
*Express PCB for lay out design
*Express SCH for schematic design
4.1 Express PCB
Express PCB is a Circuit Design Software and PCB manufacturing
service. One can learn almost everything you need to know about Express PCB
from the help topics included with the programs given.
Details:
Express PCB, Version 5.6.0
4.2 Express SCH
The Express SCH schematic design program is very easy to use. This software enables
the user to draw the Schematics with drag and drop options.
A Quick Start Guide is provided by which the user can learn how to use it.
Details:
Express SCH, Version 5.6.0

4.3 EMBEDDED C:
The programming Language used here in this project is an Embedded C
Language. This Embedded C Language is different from the generic C language in few
things like
a) Data types
b) Access over the architecture addresses.

Page | 42
Andriod mobile controlled door security locking system by using TCP-IP

The Embedded C Programming Language forms the user friendly language with access
over Port addresses, SFR Register addresses etc.
Embedded C Data types:
Data Types Size in Bits Data Range/Usage

unsigned char 8-bit 0-255


signed char 8-bit -128 to +127
unsigned int 16-bit 0 to 65535
signed int 16-bit -32,768 to +32,767
Table 4.1 Embedded c data types
Signed char
o Used to represent the – or + values.
o As a result, we have only 7 bits for the magnitude of the signed number, giving
us values from -128 to +127.

4.4 KEIL µVision using Embedded C programming

4.4.1 ABOUT KEIL SOFTWARE:


It is possible to create the source files in a text editor such as Notepad, run the Compiler
on each C source file, specifying a list of controls, run the Assembler on each Assembler
source file, specifying another list of controls, run either the Library Manager or Linker
(again specifying a list of controls) and finally running the Object-HEX Converter to
convert the Linker output file to an Intel Hex File. Once that has been completed the
Hex File can be downloaded to the target hardware and debugged. Alternatively KEIL
can be used to create source files; automatically compile, link and covert using options
set with an easy to use user interface and finally simulate or perform debugging on the
hardware with access to C variables and memory. Unless you have to use the tolls on
the command line, the choice is clear. KEIL Greatly simplifies the process of creating
and testing an embedded application.
Projects:
The user of KEIL centers on “projects”. A project is a list of all the source files
required to build a single application, all the tool options which specify exactly how to
build the application, and – if required – how the application should be simulated. A

Page | 43
Andriod mobile controlled door security locking system by using TCP-IP

project contains enough information to take a set of source files and generate exactly
the binary code required for the application. Because of the high degree of flexibility
required from the tools, there are many options that can be set to configure the tools to
operate in a specific manner. It would be tedious to have to set these options up every
time the application is being built; therefore they are stored in a project file. Loading
the project file into KEIL informs KEIL which source files are required, where they
are, and how to configure the tools in the correct way. KEIL can then execute each tool
with the correct options. It is also possible to create new projects in KEIL. Source files
are added to the project and the tool options are set as required. The project can then be
saved to preserve the settings. The project is reloaded and the simulator or debugger
started, all the desired windows are opened. KEIL project files have the extension

4.4.2 Simulator/Debugger:
The simulator/ debugger in KEIL can perform a very detailed simulation of a
micro controller along with external signals. It is possible to view the precise execution
time of a single assembly instruction, or a single line of C code, all the way up to the
entire application, simply by entering the crystal frequency. A window can be opened
for each peripheral on the device, showing the state of the peripheral. This enables quick
trouble shooting of mis-configured peripherals. Breakpoints may be set on either
assembly instructions or lines of C code, and execution may be stepped through one
instruction or C line at a time. The contents of all the memory areas may be viewed
along with ability to find specific variables. In addition the registers may be viewed
allowing a detailed view of what the microcontroller is doing at any point in time.

4.4.3 ARM SOFTWARE:


About KeilARM:

1. Click on the Keil u Vision3 Icon on Desktop


2. The following fig will appear

Page | 44
Andriod mobile controlled door security locking system by using TCP-IP

3.Click on the Project menu from the title bar


4.Then Click on New Project

Page | 45
Andriod mobile controlled door security locking system by using TCP-IP

5.Save the Project by typing suitable project name with no extension in u r own
folder sited in either C:\ or D:\

Page | 46
Andriod mobile controlled door security locking system by using TCP-IP

6.Then Click on Save button above.


7.Select the component for u r project. i.e.NXP……
8.Click on the + Symbol beside of NXP

Page | 47
Andriod mobile controlled door security locking system by using TCP-IP

9.Select LPC2148 as shown below

Page | 48
Andriod mobile controlled door security locking system by using TCP-IP

10.Then Click on “OK”


11.The Following fig will appear

Page | 49
Andriod mobile controlled door security locking system by using TCP-IP

12.Then Click YES


13.Now your project is ready to USE
14.Now double click on the Target1, you would get another option “Source group
1” as shown in next page.

Page | 50
Andriod mobile controlled door security locking system by using TCP-IP

15.Click on the file option from menu bar and select “new”

Page | 51
Andriod mobile controlled door security locking system by using TCP-IP

16.The next screen will be as shown in next page, and just maximize it by double
clicking on its blue boarder.

Page | 52
Andriod mobile controlled door security locking system by using TCP-IP

17.Now start writing program in either in “C” or “ASM”


18.For a program written in Assembly, then save it with extension “. asm” and
for “C” based program save it with extension “ .C”

Page | 53
Andriod mobile controlled door security locking system by using TCP-IP

19.Now right click on Source group 1 and click on “Add files to Group Source”

Page | 54
Andriod mobile controlled door security locking system by using TCP-IP

20.Now you will get another window, on which by default “C” files will appear

Page | 55
Andriod mobile controlled door security locking system by using TCP-IP

21.Now select as per your file extension given while saving the file
22.Click only one time on option “ADD”
23.Now Press function key F7 to compile. Any error will appear if so happen.

Page | 56
Andriod mobile controlled door security locking system by using TCP-IP

24.If the file contains no error, then press Control+F5 simultaneously.


25.The new window is as follows

Page | 57
Andriod mobile controlled door security locking system by using TCP-IP

26.Then Click “OK”

27.Now Click on the Peripherals from menu bar, and check your required port as
shown in fig below

Page | 58
Andriod mobile controlled door security locking system by using TCP-IP

29.Drag the port a side and click in the program file

Page | 59
Andriod mobile controlled door security locking system by using TCP-IP

29.Now keep Pressing function key “F11” slowly and observe.


30.You are running your program successfully
4.5 Flash magic

Flash Magic is a PC tool for programming flash based microcontrollers from NXP
using a serial or Ethernet protocol while in the target hardware. The figures below show
how the baud rate is selected for the microcontroller, how are the registers erased before
the device is programmed.

Page | 60
Andriod mobile controlled door security locking system by using TCP-IP

Figure 4.5.1 Dumping of the code into Microcontroller

Page | 61
Andriod mobile controlled door security locking system by using TCP-IP

Figure 4.5.2 Dump process finished

If dumping process of the hex file is completed, then the controller will work as per
our requirement

Page | 62
Andriod mobile controlled door security locking system by using TCP-IP

CHAPTER 5

RESULTS

DESCRIPTION:

The system will consist of a Switch interfaced with microcontroller to generate a


onetime password. The MC unit will be connected with door locking system i.e. Door
(Motor). So when a person wants to unlock the door, he will press OTP switch and a
randomly generated OTP number will be sent to his smart phone via a Wi-Fi module.
This Wi-Fi module will be interfaced directly with MC. After receiving the OTP to
concern smart phone one needs to enter the password via some switch set. If the entered
password is matched then door will be unlocked i.e. door will be opened.

Page | 63
Andriod mobile controlled door security locking system by using TCP-IP

6.CONCLUSION

The project “Android mobile controlled door security locking system by


using TCP-IP” has been successfully designed and tested.

Integrating features of all the hardware components used have developed it.
Presence of every module has been reasoned out and placed carefully thus contributing
to the best working of the unit.
Secondly, using highly advanced IC’s and with the help of growing technology
the project has been successfully implemented.

Page | 64
Andriod mobile controlled door security locking system by using TCP-IP

REFERENCES

Books
[1]. ARM7TDMI datasheet ARM

[2]. LPC2119/2129/2194/2292/2294 User Manual Philips

[3]. ARM System on chip architecture Steve Furber

[4]. Architecture Reference Manual David Seal

[5]. ARM System developers guide Andrew N. Sloss,

Domonic Symes,

[6]. Chris Wright

[7]. Micro C/OS-II Jean J. Labrosse

GCC The complete reference Arthur Griffith

Websites

[1]. http://www.arm.com

[2]. http://www.philips.com

[3]. http://www.lpc2000.com

[4]. http://www.semiconductors.philips.com/

[5]. http://ieeexplore.ieee.org

[6]. http://ww.hitex.co.uk

[7]. http://www.keil.co.uk

[8]. http://www.ucos-ii.com

[9]. http://www.ristancase.com

Page | 65
Andriod mobile controlled door security locking system by using TCP-IP

[10]. http://gcc.gnu.org/onlinedocs/gcc/Evaluation Boards And Modules

[11]. http://www.knox.com

Page | 66