Vous êtes sur la page 1sur 67

CHAPTER 3 : METHODOLOGY

3.1 HARDWARE USED

I.
II.

ATMEGA-8
GSM-300

III.

L293D

IV.

LM7805

V.
VI.
VII.
VIII.
IX.
X.
XI.
XII.

Capacitors
Diodes
Resistors
Crystal oscillator
12 Volt DC motor
Solenoid lock
16*2 LCD
4*3 keypad matrix

XIII.

12-0-12 Centre tap transformer

XIV.

5 volt adaptor

3.1.1 ATMEGA-8:
Microcontrollers, as the name suggests, are small controllers. They are like single
chip computers that are often embedded into other systems to function as
processing/controlling unit. For example, the remote control you are using probably
has microcontrollers inside that do decoding and other controlling functions. They are
also used in automobiles, washing machines, microwave ovens, toys ... etc, where
automation is needed.

3.1.1.1 KEY FEATURES OF MICROCONTROLLERS:

HIGH INTEGRATION OF FUNCTIONALITY

Microcontrollers sometimes are called single-chip computers because they have onchip memory and I/O circuitry and other circuitries that enable them to function as
small standalone computers without other supporting circuitry.

FIELD PROGRAMMABILITY, FLEXIBILITY

Microcontrollers often use EEPROM or EPROM as their storage device to allow field
programmability so they are flexible to use. Once the program is tested to be correct
then large quantities of microcontrollers can be programmed to be used in embedded
systems.

EASY TO USE

Assembly language is often used in microcontrollers and since they usually follow
RISC architecture, the instruction set is small. The development package of
microcontrollers often includes an assembler, a simulator, a programmer to "burn" the
chip and a demonstration board. Some packages include a high-level language
compiler such as a C compiler and more sophisticated libraries.

3.1.2 MICROCONTROLLER (AT89C51)

8051 microcontroller has 128 bytes of RAM, 4K bytes of on-chip ROM, two timers,
one serial port, and four ports (each 8-bits wide) all on a single chip. The 8051 is an 8bit processor i.e. the CPU can work on only 8 bits of data at a time. The fixed amount
of on-chip ROM, RAM, and number of I/O ports in microcontroller makes them ideal
for many applications in which cost and space are critical.

The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with


4K bytes of Flash programmable and erasable read only memory (PEROM). The onchip Flash allows the program memory to be reprogrammed in-system or by a
conventional non-volatile memory programmer. By combining a versatile 8-bit CPU
with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer,
which provides a highly flexible and cost-effective solution to many embedded
control applications.

3.1.2.1 FEATURES:

Compatible with MCS-51 Products


4K Bytes of In-System Reprogrammable Flash Memory
Endurance: 1,000 Write/Erase Cycles
Fully Static Operation: 0 Hz to 24 MHz
Three-level Program Memory Lock
128 x 8-bit Internal RAM
32 Programmable I/O Lines
Two 16-bit Timer/Counters
Six Interrupt Sources
Programmable Serial Channel
Low-power Idle and Power-down Modes

3.1.2.2 BLOCK DIAGRAM:

External
Interrupts

On-chip
ROM for
program
code

Timer 0

On-chip
RAM

Timer 1

4 I/O
Ports

Serial
port

CPU

Osc

Bus
control

P0 P1 P2 P3
ADDRESS/DATA

FIG 3.1

10

TXD

RXD

Counter Inputs

Interrupt
control

ETC.

3.1.2.3 PIN CONFIGURATION:


P1.0
P1.1

40

39

P1.2
P1.3
P1.4
P1.5

RST

38

37

36

34

33

(RD) P3.7

32

10

31

GND

EA/VPP

PSEN
P2.7 (A15)
P2.6 (A14)

11

30

12

29

P2.5 (A13)
P2.4 (A12)
P2.3 (A11)

13

28

XTAL2
XTAL1

P0.7 (AD7)

ALE/PROG

(T0) P3.4

(WR) P3.6

P0.4 (AD4)

P0.6 (AD6)

(TXD) P3.1

(T1) P3.5

P0.3 (AD3)

35

(INT1) P3.3

P0.2 (AD2)

P0.5 (AD5)

(RXD) P3.0

(INT0) P3.2

P0.0 (AD0)
P0.1 (AD1)

P1.6
P1.7

Vcc

P2.2 (A10)
14

27

15

26

FIG 3.2
16

25
11

17

24

P2.1 (A9)
P2.0 (A8)

3.1.2.4 PIN DESCRIPSION:

VCC - Supply voltage.

GND - Ground.

Port 0 - Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each
pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used
as high- impedance inputs.

Port 0 may also be configured to be the multiplexed low-order address/data bus


during accesses to external program and data memory. In this mode P0 has internal
pull-ups.

Port 0 also receives the code bytes during Flash programming, and outputs the code
bytes during program verification. External pull-ups are required during program
verification.

Port 1 - Port 1 is an 8-bit bi-directional I/O port with internal pull-ups.


The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to
Port 1 pins they are pulled high by the internal pull-ups and can be used as inputs. As
inputs, Port 1 pins that are externally being pulled low will source current (IIL)
because of the internal pull-ups. Port 1 also receives the low-order address bytes
during Flash programming and verification.

Port 2 - Port 2 is an 8-bit bi-directional I/O port with internal pull-ups.


The Port 2 output buffers can sink/source four TTL inputs.
When 1s are written to Port 2 pins they are pulled high by the internal pull-ups and
can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will
source current (IIL) because of the internal pull-ups. Port 2 emits the high-order
address byte during fetches from external program memory and during accesses to
external data memory that use 16-bit addresses (MOVX @ DPTR). In this
application, it uses strong internal pull-ups when emitting 1s. During accesses to
external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the
contents of the P2 Special Function Register.

12

Port 2 also receives the high-order address bits and some control signals during Flash
programming and verification.

Port 3 - Port 3 is an 8-bit bi-directional I/O port with internal pullups.


The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to
Port 3 pins they are pulled high by the internal pullups and can be used as inputs. As
inputs, Port 3 pins that are externally being pulled low will source current (IIL)
because of the pullups. Port 3 also serves the functions of various special features of
the AT89C51 as listed below:

RST - Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device.

ALE/PROG - Address Latch Enable output pulse for latching the low byte of the
address during accesses to external memory. This pin is also the program pulse input
(PROG) during Flash programming.

PORT PIN

ALTERNATE FUNCTIONS

P3.0

RXD (serial input port)

P3.1

TXD (serial output port)

P3.2

INT0 (external interrupt 0)

P3.3

INT1 (external interrupt 1)

P3.4

T0 (timer 0 external input)

P3.5

T1 (timer 1 external input)

P3.6

WR (external data memory write strobe)

P3.7

RD (external data memory read strobe)

TABLE 3.1

13

In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency,
and may be used for external timing or clocking purposes. Note, however, that one
ALE pulse is skipped during each access to external Data Memory.
If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With
the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the
pin is weakly pulled high. Setting the ALE-disable bit has no effect if the
microcontroller is in external execution mode.

PSEN - Program Store Enable is the read strobe to external program memory. When
the AT89C51 is executing code from external program memory, PSEN is activated
twice each machine cycle, except that two PSEN activations are skipped during each
access to external data memory.

EA/VPP - External Access Enable. EA must be strapped to GND in order to enable


the device to fetch code from external program memory locations starting at 0000H
up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally
latched on reset.
EA should be strapped to VCC for internal program executions.
This pin also receives the 12-volt programming enable voltage (VPP) during Flash
programming, for parts that require 12-volt VPP.

XTAL1 - Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.

XTAL2 - Output from the inverting oscillator amplifier.

14

3.1.2.5 OSCILLATOR CHARACTERISTICS :

XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier,
which can be configured for use as an on-chip oscillator. Either a quartz crystal or
ceramic resonator may be used. To drive the device from an external clock source,
XTAL2 should be left unconnected while XTAL1 is driven.

XTAL1
C1

XTAL2
C2

GND

Fig 3.3

Note: C1, C2 = 30 pF +/- 10 pF for Crystals


= 40 pF +/- 10 pF for Ceramic Resonators

There are no requirements on the duty cycle of the external clock signal, since the
input to the internal clocking circuitry is through a divide-by-two flip-flop, but
minimum and maximum voltage high and low time specifications must be observed.

15

3.1.2.6 THE 8051 REGISTERS:

The most widely used registers of the 8051 are A (accumulator), B, R0, R1, R2, R3,
R4, R5, R6, R7, DPTR (data pointer), and PC (program counter). All of the above
registers are 8-bits, except DPTR and the program counter. The 8 bots of a register are
shown below from the MSB (most significant bit) D7 to the LSB (least significant bit)
D0.

D7

D6

D5

D4

D3

D2

D1

D0

3.1.2.7 PROGRAM COUNTER:


The program counter points to the address of the next instruction to be executed. As
the CPU fetches the opcode from the program ROM, the program counter is
incremented to point to the next instruction. The PC is 16 bits wide i.e. it can access
program addresses 0000 to FFFFH, a total of 64K bytes of code.

3.1.2.8 PSW (PROGRAM STATUS WORD) REGISTER


The PSW contains status bits that reflect the current state of the CPU and is also
called flag register. The PSW contains the Carry bit, the Auxiliary Carry bit, the two
register bank select bits, the overflow flag bit, a parity bit, and two user definable
status flags.

CY

AC

F0

RS1

RS0

OV

---

CY

PSW.7 Carry flag.

AC

PSW.6 Auxiliary carry flag.

---

PSW.5 Available to the user for general purpose.

RS1

PSW.4 Register Bank selector bit 1.

RS0

PSW.3 Register Bank selector bit 0.

OV

PSW.2 Overflow flag.

---

PSW.1 User definable bit.

PSW.0 Parity flag.


16

RS1
0

RS0 Register Bank


0
0

Address
00H 07H
08H 0FH

10H 17H

18H 1FH

CY, THE CARRY FLAG


This flag is set whenever there is a carry out from the D7 bit. This flag bit is affected
after an 8-bit addition or subtraction. It can also be set to

1 or 0 directly by an instruction such as SETB C and CLR C where SETB C


stands for set bit carry and CLR C for clear carry.

AC, THE AUXILIARY CARRY FLAG


If there is a carry from D3 to D4 during an ADD or SUB operation, this bit is set;
otherwise, it is cleared. This flag is used by instructions that perform BCD (binary
coded decimal) arithmetic.

P, THE PARITY FLAG


The parity flag reflects the number of 1s in the A (accumulator) register only. If the A
register contains an odd number of 1s, then P=1. Therefore, P=0 if A has an even
number of 1s.

OV, THE OVERFLOW FLAG


This flag is set whenever the result of a signed number operation is too large, causing
the high-order bit to overflow into the sign bit.

17

3.1.2.9 RAM MEMORY SPACE ALLOCATION IN THE 8051


There are 128 bytes of RAM in the 8051, which are assigned addresses 00 to 7FH.
These 128 bytes are divided into three different groups:

i.

A total of 32 bytes from locations 00 to 1H hex are set aside for register banks
and the stack.

ii.

A total of 16 bytes from locations 20H to 2FH are set aside for bit-addressable
read/write memory.

iii.

A total of 80 bytes from locations 30H to 7FH are used for read and write
storage, or what is normally called a scratch pad. These
80 locations of RAM are widely used for the purpose of storing data and
parameters by 8051 programmers.

7F
Scratch pad RAM
30
2F
Bit-Addressable RAM
20
1F

Register Bank 3

18

17

Register Bank 2

10

0F Register Bank 1 (stack)


08
07
Register Bank 0
00

Fig 3.4

18

3.1.2.10 REGISTER BANKS IN THE 8051

The 32 bytes of RAM which is set aside for the register banks and stack is divided
into 4 banks of registers in which each bank has 8 registers, R0 R7. RAM locations
from 0 to 7 are set aside for bank 0 of R0 R7

where R0 is RAM location 0, R1 is RAM location 1, R2 is location 2, and so on, until


memory location 7 which belongs to R7 of bank 0. The second bank of registers R0
R7 starts at RAM location 08 and goes to location 0FH. The third bank of R0 R7
starts at memory location 10H and goes to location 17H; and finally RAM locations
18H to 1FH are set aside for the fourth bank of R0 R7. The following tables shows
how the 32 bytes are allocated into 4 banks:

Bank 0

Bank 1

Bank 2

Bank 3

R7

R7

R7

R7

R6

R6

R6

R6

R5

R5

R5

R5

R4

R4

R4

R4

R3

R3

R3

R3

R2

R2

R2

R2

R1

R1

R1

R1

R0

R0

R0

R0

FIG 3.5

19

3.1.2.11 STACK IN THE 8051:


The stack is a section of RAM used by the CPU to store information temporarily. This
information could be data or an address. The CPU needs this storage area since there
are only a limited number of registers. The register used to access the stack is called
the SP (stack pointer) register. The stack pointer in the 8051 is only 8 bits wide i.e. it
can take values of 00 to FFH. When the 8051 is powered up, the SP

register contains value 07 which implies that RAM location 08 is the first location
being used for the stack by the 8051. The storing of a CPU register in the stack is
called a PUSH, and loading the contents of the stack back into a CPU register is
called a POP. In other words, a register is pushed onto the stack to save it and popped
off the stack to retrieve it.

PUSHING ONTO THE STACK:


In the 8051 the stack pointer (SP) is pointing to the last used location of the stack. As
data is pushed onto the stack, the stack pointer (SP) is incremented by one and the
contents of the register are saved on the stack. To push the registers onto the stack,
RAM addresses are used.

POPPING FROM THE STACK:


Popping the contents of the stack back into a given register is the opposite process of
pushing. With every pop, the top byte of the stack is copied to the register specified
by the instruction and the stack pointer is decremented once.

3.1.2.12 ADDRESSING MODES:

The addressing modes in the microcontroller instruction set are as follows:


1. DIRECT ADDRESSING
In direct addressing, the operand is specified by an 8-bit address field in the
instruction. Only internal RAM and SFRs cab be directly accessed.

20

2. INDIRECT ADDRESSING
In indirect addressing, the instruction specifies a register that specifies a register that
contains the address of the operand. Both internal and external RAM can be indirectly
accessed.The address register for 8-bit addresses can be either the stack pointer or R0
or R1 of the selected register bank. The address register for 16-bit addresses can be
only the 16-bit data pointer register, DPTR.

3. REGISTER INSTRUCTIONS
The register banks, which contain registers R0 through R7, can be accessed by
instructions whose opcodes carry a 3-bit register specification. Instructions that access
the registers this way make efficient use of code, since this mode eliminates an
address byte. When the instruction is executed, one of the eight registers in the
selected bank is accessed. One of four banks is selected at execution time by the two
bank select bits in the PSW.

4. REGISTER-SPECIFIC INSTRUCTIONS
Some instructions are specific to a certain register. For example, some instructions
always operate on the Accumulator, so no address byte is needed to point to it. In
these cases, the opcode itself points to the correct register.

5. IMMEDIATE CONSTANTS
The value of a constant can follow the opcode in program memory. For example,
MOV A, #100
Loads the Accumulator with the decimal number 100. The same number could be
specified in hex digits as 64H.

6. INDEXED ADDRESSING
Program memory can only be accessed via indexed addressing. This addressing mode
is intended for reading look-up labels in program memory. A 16-bit base register
(either DPTR or the Program Counter) points to the base of the table, and the
accumulator is set up with the table entry number. The address of the table entry in
program memory is formed by adding the accumulator data to the base pointer.
21

3.1.2.13 8051 INSTRUCTION SET


MNEMONIC:

The MNEMONIC column contains the 8051 Instruction Set Mnemonic and a brief
description of the instruction's operation.

OPERATION:
The OPERATION column describes the 8051 Instruction Set in unambiguous
symbology. Following are the definitions of the symbols used in this column.

<n:m>

Bits of a register inclusive. For example, PC<10:0> means bits 0


through 10 inclusive of the PC. Bit 0 is always the
least significant bit.

Binary addition

Binary 2s complement subtraction

Unsigned integer division

Unsigned integer multiplication

Binary complement (1s complement)

Logical And

Inclusive Or

Exclusive Or

>

Greater than

<>

Not equal to

Equals

->

Is written into. For example, A + SOper -> A means the


result of the binary addition between A and the Source
Operand is written into A.

The 8-bit Accumulator Register.

AC

The Auxiliary Carry Flag in the Program Status Word

CF

The Carry Flag in the Program Status Word


22

Doper The Destination Operand used in the instruction.

DPTR

16-bit Data Pointer

Interrupt Active Flag


cleared.

Internal Flag that holds off interrupts until the Flag is

Jump Relative to PC
A Jump that can range between -128 bytes and +127 bytes
from the PC value of the next instruction.

Paddr

PC

A 16-bit Program Memory address

The 8051 Program Counter. This 16-bit register points


to the byte in the Program Memory space that is fetched
as part of the instruction stream.

PM (addr)

Byte in Program Memory space pointed to by addr.

Remainder

Integer remainder of unsigned integer division

Soper

The Source Operand used in the instruction.

SP

8-bit Stack Pointer

STACK

The Last In First Out data structure that is controlled by


the 8-bit Stack Pointer (SP). Sixteen bit quantities are
pushed on the stack low byte first.

HEX OPCODE:
This column gives the machine language hexadecimal opcode for each 8051
instruction.

BYTE:
This column gives the number of bytes in each 8051 instruction.

23

CYC:
This column gives the number of cycles of each 8051 instruction. The time value of a
cycle is defined as 12 divided by the oscillator frequency. For example, if running an
8051 family component at 12 MHz, each cycle takes 1 microsecond.

24

3.1.3 SIM-300:

FIG 3.6

3.1.3.1 PRODUCT CONCEPT:


Designed for global market, SIM300 is a Tri-band GSM/GPRS engine that works on
frequencies EGSM 900 MHz, DCS 1800 MHz and PCS1900 MHz. SIM300 provides
GPRS multi-slot class 10/ class 8 (optional) capability and support the GPRS coding
schemes CS-1, CS-2, CS-3 and CS-4.
With a tiny configuration of 40mm x 33mm x 2.85 mm , SIM300 can fit almost all the
space requirement in your application, such as Smart phone, PDA phone and other
mobile device.
The physical interface to the mobile application is made through a 60 pins board-toboard connector, which provides all hardware interfaces between the module and
customers boards except the RF antenna interface.The keypad and SPI LCD interface
will give you the flexibility to develop customized applications.
Two serial ports can help you easily develop your applications.
25

Two audio channels include two microphones inputs and two speaker outputs. This
can be easily configured by AT command.
SIM300 provide RF antenna interface with two alternatives: antenna connector and
antenna pad. The antenna connector is MURATA MM9329-2700. And customers
antenna can be soldered to the antenna pad.
The SIM300 is designed with power saving technique, the current consumption to as
low as 2.5mA in SLEEP mode.
The SIM300 is integrated with the TCP/IP protocolExtended TCP/IP AT
commands are developed for customers to use the TCP/IP protocol easily, which is
very useful for those data transfer applications.

3.1.3.2 POWER SUPPLY


The power supply of SIM300 is from a single voltage source of VBAT= 3.4V...4.5V.
In some case, the ripple in a transmit burst may cause voltage drops when current
consumption rises to typical peaks of 2A, So the power supply must be able to
provide sufficient current up to 2A. For the VBAT input, a local bypass capacitor is
recommended. A capacitor (about 100F, low ESR) is recommended. Multi-layer
ceramic chip (MLCC) capacitors can provide the best combination of low ESR and
small size but may not be cost effective. A lower cost choice may be a 100 F
tantalum capacitor (low ESR) with a small (1 F to 10F) ceramic in parallel, which
is illustrated as following figure. And the capacitors should put as closer as possible to
the SIM300 VBAT pins.

MINIMIZING POWER LOSSES


Make sure that the input voltage will never drops below 3.4V even in a transmit burst
during which the current consumption may rise up to 2A. If the power voltage drops
below 3.4V, the module may be switched off. Using the board-to-board connector
will be the best way to reduce the voltage drops. You should also take the resistance
of the power supply lines on the host board or of battery pack into account.

26

3.1.3.3 SPECIFICATIONS:
TABLE 3.2

Feature

Implementation

Power supply

Single supply voltage 3.4V 4.5V

Power saving

Typical power consumption in SLEEP mode to 2.5mA

Frequency bands

SIM300 Tri-band: EGSM 900, DCS 1800, PCS 1900.


The band can be set by AT COMMAND,
and default band is EGSM 900 and DCS
1800.
Compliant to GSM Phase 2/2+

GSM class
Transmit power

GPRS connectivity

Small MS
Class 4 (2W) at EGSM900
Class 1 (1W) at DCS1800 and
PCS 1900
GPRS multi-slot class 8
default )
GPRS multi-slot class
10 (option
GPRS mobile station
class B

Temperature range

Normal operation:-20 c+55C


Restricted operation: -25C to -20C and +55C to
+70C
Storage temperature -40C to +80C

DATA GPRS:

GPRS data downlink transfer: max. 85.6 kbps


GPRS data uplink transfer: max. 42.8 kbps
Coding scheme:
CS-1, CS-2, CS-3 and CS-4
SIM300 supports the protocols PAP (Password
Authentication Protocol) usually used for PPP connections.

CSD:

the SIM300 integrates the TCP/IP protocol.


Support Packet Switched Broadcast Control Channel
(PBCCH)
CSD transmission rates: 2.4, 4.8, 9.6, 14.4
kbps, non-transparent
Unstructured Supplementary Services Data (USSD)
support

27

MT, MO, CB, Text and PDU mode


SMS storage: SIM card
Support transmission of SMS alternatively over
CSD or
GPRS.
User can choose preferred mode.
Group 3 Class 1
FAX
SIM interface

Supported SIM card: 1.8V ,3V

External antenna

Connected via 50 Ohm antenna connector or antenna pad

Audio features

Speech codec modes:


Half Rate (ETS 06.20)
Full Rate (ETS 06.10)
Enhanced Full Rate (ETS 06.50 /
06.60 /
06.80)
Echo suppression

Two serial interfaces

Serial Port 1 Seven lines on Serial Port Interface

3.1.3.4 AT COMMANDS:
Command

Description

A/

RE-ISSUES LAST AT COMMAND GIVEN

ATA

ANSWER AN INCOMING CALL

ATD

MOBILE ORIGINATED CALL TO DIAL A NUMBER

ATD><MEM><N ORIGINATE CALL TO PHONE NUMBER IN MEMORY


<MEM>
>
ATD><N>
MEMORY

ORIGINATE CALL TO PHONE NUMBER IN CURRENT

28

ATT

SELECT TONE DIALLING

ATV

SET RESULT CODE FORMAT MODE

ATX

SET CONNECT RESULT CODE FORMAT AND MONITOR


CALL
PROGRESS

ATZ

SET ALL CURRENT PARAMETERS TO USER DEFINED


PROFILE

AT&C

SET DCD FUNCTION MODE

AT&D

SET DTR FUNCTION MODE

AT&F

SET ALL CURRENT PARAMETERS TO


MANUFACTURER
DEFAULTS

AT&V

DISPLAY CURRENT CONFIGURATION

AT&W

STORE CURRENT
PROFILE

AT+DR

V.42BIS DATA COMPRESSION REPORTING CONTROL

AT+DS

V.42BIS DATA COMPRESSION CONTROL

AT+GCAP

REQUEST COMPLETE TA CAPABILITIES LIST

AT+GMI

REQUEST MANUFACTURER IDENTIFICATION

AT+GMM

REQUEST TA MODEL IDENTIFICATION

AT+GMR

REQUEST
TA
SOFTWARE

PARAMETER

REVISION

TO

USER DEFINED

INDENTIFICATION

OF

AT+GOI

RELEASE
REQUEST GLOBAL OBJECT IDENTIFICATION

AT+GSN

REQUEST TA SERIAL NUMBER IDENTIFICATION (IMEI)

AT+ICF

SET TE-TA CONTROL CHARACTER FRAMING

AT+IFC

SET TE-TA LOCAL DATA FLOW CONTROL

AT+ILRR

SET TE-TA LOCAL RATE REPORTING MODE

AT+IPR

SET TE-TA FIXED LOCAL RATE

TABLE 3.3

29

3.1.4 L293D:

FIG 3.7

L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as
current amplifiers since they take a low-current control signal and provide a highercurrent signal. This higher current signal is used to drive the motors.
L293D contains two inbuilt H-bridge driver circuits. In its common mode of
operation, two DC motors can be driven simultaneously, both in forward and reverse
direction. The motor operations of two motors can be controlled by input logic at pins
2 & 7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01
and 10 will rotate it in clockwise and anticlockwise directions, respectively.
Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to
start operating. When an enable input is high, the associated driver gets enabled. As a
result, the outputs become active and work in phase with their inputs. Similarly, when
the enable input is low, that driver is disabled, and their outputs are off and in the
high-impedance state.

30

3.1.4.1 Pin Diagram:

FIG 3.8

31

3.1.4.2 PIN DESCRIPTION:


Pin
No

Function

Name

Enable pin for Motor 1; active high

Enable 1,2

Input 1 for Motor 1

Input 1

Output 1 for Motor 1

Output 1

Ground (0V)

Ground

Ground (0V)

Ground

Output 2 for Motor 1

Output 2

Input 2 for Motor 1

Input 2

Supply voltage for Motors; 9-12V (up to 36V)

Vcc

Enable pin for Motor 2; active high

Enable 3,4

10

Input 1 for Motor 1

Input 3

11

Output 1 for Motor 1

Output 3

12

Ground (0V)

Ground

13

Ground (0V)

Ground

14

Output 2 for Motor 1

Output 4

15

Input2 for Motor 1

Input 4

16

Supply voltage; 5V (up to 36V)

Vcc

TABLE 3.4

32

3.1.5 LM7805:

FIG 3.9

The MC78XX/LM78XX/MC78XXA series of three terminal positive regulators are


available in the TO-220/D-PAK package and with several fixed output voltages,
making them useful in a wide range of applications. Each type employs internal
current limiting, thermal shut down and safe operating area protection, making it
essentially indestructible. If adequate heat sinking is provided, they can deliver over
1A output current. Although designed primarily as fixed voltage regulators, these
devices can be used with external components to obtain adjustable voltages and
currents.

3.1.5.1 FEATURES
Output Current up to 1A
Output Voltage of 5
Thermal Overload Protection
Short Circuit Protection

3.1.5.2 INTERNAL BLOCK DIAGRAM


FIG 3.10

33

3.1.6 CAPACITORS
It is an electronic component whose function is to accumulate charges and then release
it.

To understand the concept of capacitance, consider a pair of metal plates which all
are placed near to each other without touching. If a battery is connected to these

FIG 3.11
plates the positive pole to one and the negative pole to the other, electrons from the
battery will be attracted from the plate connected to the positive terminal of the
battery. If the battery is then disconnected, one plate will be left with an excess of
electrons, the other with a shortage, and a potential or voltage difference will exists
between them. These plates will be acting as capacitors. Capacitors are of two
types: -

A) Fixed type:
like ceramic, polyester, electrolytic capacitors-these names refer to the material they
are made of aluminium foil.

34

B) Variable type:
like gang condenser in radio or trimmer. In fixed type capacitors, it has two leads and
its value is written over its body and variable type has three leads. Unit of
measurement of a capacitor is farad denoted by the symbol F. It is a very big unit of
capacitance.
Small
unit
capacitor
are
pico-farad
denoted
by
pf
(Ipf=1/1000,000,000,000 f) Above all, in case of electrolytic capacitors, it's two
terminal are marked as (-) and (+) so check it while using capacitors in the circuit in
right direction. Mistake can destroy the capacitor.

35

3.1.7 DIODES
The simplest semiconductor device is made up of a sandwich of P-type semi
conducting material, with contacts provided to connect the p-and n-type layers to an
external circuit. This is a junction Diode. If the positive terminal of the battery is
connected to the p-type material (cathode) and the negative terminal to the N-type
material (Anode), a large current will flow. This is called forward current or forward
biased.
If the connections are reversed, a very little current will flow. This is because
under this condition, the p-type material will accept the electrons from the negative
terminal of the battery and the N-type material will give up its free electrons to the
battery, resulting in the state of electrical equilibrium since the N-type material has no
more electrons. Thus there will be a small current to flow and the diode is called
Reverse biased.
Thus the Diode allows direct current to pass only in one direction while
blocking it in the other direction. Power diodes are used in concerting AC into DC. In
this, current will flow freely during the first half cycle (forward biased) and
practically not at all during the other half cycle (reverse biased). This makes the diode
an effective rectifier, which convert ac into pulsating dc. Signal diodes are used in
radio circuits for detection. Zener diodes are used in the circuit to control the voltage.

FIG 3.12

Some common diodes are:1. Zener diode.


2. Photo diode.
3. Light Emitting diode.
36

3.1.7.1 ZENER DIODE:-

A zener diode is specially designed junction diode, which can operate


continuously without being damaged in the region of reverse break down voltage.
One of the most important applications of zener diode is the design of constant
voltage power supply. The zener diode is joined in reverse bias to d.c. through a
resistance R of suitable value.

3.1.7.2 PHOTO DIODE:-

A photo diode is a junction diode made from photo- sensitive semiconductor


or material. In such a diode, there is a provision to allow the light of suitable
frequency to fall on the p-n junction. It is reverse biased, but the voltage applied is
less than the break down voltage. As the intensity of incident light is increased,
current goes on increasing till it becomes maximum. The maximum current is called
saturation current.

3.1.7.3 LIGHT EMITTING DIODE (LED):-

When a junction diode is forward biased, energy is released at the junction


diode is forward biased, energy is released at the junction due to recombination of
electrons and holes. In case of silicon and germanium diodes, the energy released is in
infrared region. In the junction diode made of gallium arsenate or indium phosphide,
the energy is released in visible region. Such a junction diode is called a light emitting
diode or LED

37

3.1.8 RESISTORS

All conductors represent a certain amount of resistance, since no conductor is 100%


efficient. To control the electron flow (current) in a predictable manner, we use
resistors. Electronic circuits use calibrated lumped resistance to control the flow of
current. Broadly speaking, resistor can be divided into two groups viz. fixed &
adjustable (variable) resistors. In fixed resistors, the value is fixed & cannot be varied.
In variable resistors, the resistance value can be varied by an adjuster knob. It can be
divided into
(a) Carbon composition
(b) Wire wound
(c) Special type.
The most common type of resistors used in our projects is carbon type. The resistance
value is normally indicated by colour bands. Each resistance has four colours, one of
the band on either side will be gold or silver, this is called fourth band and indicates
the tolerance, others three band will give the value of resistance (see table). For
example if a resistor has the following marking on it say red, violet, gold. Comparing
these coloured rings with the colour code, its value is 27000 ohms or 27 kilo ohms
and its tolerance is 5%. Resistor comes in various sizes (Power rating). The bigger,
the size, the more power rating of 1/4 watts. The four colour rings on its body tells us
the value of resistor value as given below.
COLOURS

CODE

Black ------------------------------------------------0
Brown-----------------------------------------------1
Red -------------------------------------------------2
Orange ----------------------------------------------3
Yellow ----------------------------------------------4
Green -----------------------------------------------5
Blue -------------------------------------------------6
Violet------------------------------------------------7
Grey-------------------------------------------------8
White------------------------------------------------9

38

FIG 3.13

The first rings give the first digit. The second ring gives the second digit. The
third ring indicates the number of zeroes to be placed after the digits. The fourth ring
gives tolerance (gold 5%, silver 10%, No colour 20%).

In variable resistors, we have the dial type of resistance boxes. There is a knob
with a metal pointer. This presses over brass pieces placed along a circle with some
space b/w each of them.

Resistance coils of different values are connected b/w the gaps. When the
knob is rotated, the pointer also moves over the brass pieces. If a gap is skipped over,
its resistance is included in the circuit. If two gaps are skipped over, the resistances of
both together are included in the circuit and so on.

A dial type of resistance box contains many dials depending upon the range,
dials

39

3.1.9 CRYSTAL OSCILATOR

FIG 3.14

A crystal
oscillator is
an electronic
oscillator circuit
that
uses
the
mechanical resonance of a vibrating crystal of piezoelectric material to create an
electrical signal with a very precise frequency. This frequency is commonly used to
keep track of time (as in quartz wristwatches), to provide a stable clock
signal for digital integrated
circuits,
and
to
stabilize
frequencies
for radio
transmitters and receivers. The most common type of piezoelectric resonator used is
the quartz crystal, so oscillator circuits incorporating them became known as crystal
oscillators, but other piezoelectric materials including polycrystalline ceramics are
used in similar circuits.
Quartz crystals are manufactured for frequencies from a few tens of kilohertz to
hundreds of megahertz. More than two billion crystals are manufactured annually.
Most are used for consumer devices such as wristwatches, clocks, radios, computers,
and cell phones . Quartz crystals are also found inside test and measurement
equipment, such as counters, signal generators, and oscilloscopes.

3.1.9.1 OPERATION:

A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a
regularly ordered, repeating pattern extending in all three spatial dimensions.
Almost any object made of an elastic material could be used like a crystal, with
appropriate transducers, since all objects have natural resonant frequencies
of vibration. For example, steel is very elastic and has a high speed of sound. It was
often used in mechanical filters before quartz. The resonant frequency depends on
size, shape, elasticity, and the speed of sound in the material. High-frequency crystals
are typically cut in the shape of a simple, rectangular plate. Low-frequency crystals,
such as those used in digital watches, are typically cut in the shape of a tuning fork.
For applications not needing very precise timing, a low-cost ceramic resonator is
often used in place of a quartz crystal.
40

When a crystal of quartz is properly cut and mounted, it can be made to distort in
an electric field by applying a voltage to an electrode near or on the crystal. This
property is known as electrostriction or inverse piezoelectricity. When the field is
removed, the quartz will generate an electric field as it returns to its previous shape,
and this can generate a voltage. The result is that a quartz crystal behaves like a circuit
composed of an inductor,capacitor and resistor, with a precise resonant frequency.
Quartz has the further advantage that its elastic constants and its size change in such a
way that the frequency dependence on temperature can be very low. The specific
characteristics will depend on the mode of vibration and the angle at which the quartz
is cut (relative to its crystallographic axes).Therefore, the resonant frequency of the
plate, which depends on its size, will not change much, either. This means that a
quartz clock, filter or oscillator will remain accurate. For critical applications the
quartz oscillator is mounted in a temperature-controlled container, called a crystal
oven, and can also be mounted on shock absorbers to prevent perturbation by external
mechanical vibrations.

41

3.1.10 DC MOTOR
Most electric motors work by electromagnetism, but motors based on other
electromechanical phenomena, such as electrostatic forces and the piezoelectric
effect, also exist. The fundamental principle upon which electromagnetic motors are
based is that there is a mechanical force on any current-carrying wire contained within
a magnetic field. The force is described by the Lorentz force law and is perpendicular
to both the wire and the magnetic field. Most magnetic motors are rotary, but linear
motors also exist. In a rotary motor, the rotating part (usually on the inside) is called
the rotor, and the stationary part is called the stator. The rotor rotates because the
wires and magnetic field are arranged so that a torque is developed about the rotor's
axis. The motor contains electromagnets that are wound on a frame. Though this
frame is often called the armature, that term is often erroneously applied. Correctly,
the armature is that part of the motor across which the input voltage is supplied.
Depending upon the design of the machine, either the rotor or the stator can serve as
the armature.

DC motors

FIG 3.15

Electric motors of various sizes.


One of the first electromagnetic rotary motors was invented by Michael Faraday in
1821 and consisted of a free-hanging wire dipping into a pool of mercury. A
permanent magnet was placed in the middle of the pool of mercury. When a current
was passed through the wire, the wire rotated around the magnet, showing that the
current gave rise to a circular magnetic field around the wire. This motor is often
demonstrated in school physics classes, but brine(salt water) is sometimes used in

42

place of the toxic mercury. This is the simplest form of a class of electric motors
called homopolar motors. A later refinement is the Barlow's Wheel.
Another early electric motor design used a reciprocating plunger inside a switched
solenoid; conceptually it could be viewed as an electromagnetic version of a two
stroke internal combustion engine.
The modern DC motor was invented by accident in 1873, when Znobe Gramme
connected a spinning dynamo to a second similar unit, driving it as a motor.
The classic DC motor has a rotating armature in the form of an electromagnet. A
rotary switch called a commutator reverses the direction of the electric current twice
every cycle, to flow through the armature so that the poles of the electromagnet push
and pull against the permanent magnets on the outside of the motor. As the poles of
the armature electromagnet pass the poles of the permanent magnets, the commutator
reverses the polarity of the armature electromagnet. During that instant of switching
polarity, inertia keeps the classical motor going in the proper direction.

Fig 3.16(a)

A simple DC electric motor. When the coil is powered, a magnetic field is generated
around the armature. The left side of the armature is pushed away from the left
magnet and drawn toward the right, causing rotation.

Fig 3.16 (b)

43

The armature continues to rotate.

Fig 3.16 (c)

When the armature becomes horizontally aligned, the commutator reverses the
direction of current through the coil, reversing the magnetic field. The process then
repeats.
3.1.10.1 WOUND FIELD DC MOTOR
The permanent magnets on the outside (stator) of a DC motor may be replaced by
electromagnets. By varying the field current it is possible to alter the speed/torque
ratio of the motor. Typically the field winding will be placed in series (series wound)
with the armature winding to get a high torque low speed motor, in parallel (shunt
wound) with the armature to get a high speed low torque motor, or to have a winding
partly in parallel, and partly in series (compound wound) for a balance that gives
steady speed over a range of loads. Further reductions in field current are possible to
gain even higher speed but correspondingly lower torque, called "weak field"
operation.

3.1.10.2 SPEED CONTROL


Generally speaking the rotational speed of a DC motor is proportional to the voltage
applied to it, and the torque is proportional to the current. Speed control can be
achieved by variable battery tappings, variable supply voltage, resistors or electronic
controls. The direction of a wound field DC motor can be changed by reversing either
the field or armature connections but not both, this is commonly done with a special
set of contactors (direction contactors).
Effective voltage can be varied by inserting a series resistor or by an electronically
controlled switching device made of thyristors, transistors, or, formerly, mercury arc
44

rectifiers. In a circuit known as a chopper, the average voltage applied to the motor is
varied by switching the supply voltage very rapidly. As the "on" to "off" ratio is
varied to alter the average applied voltage, the speed of the motor varies. The rapid
switching wastes less energy than series resistors. Output filters smooth the average
voltage applied to the motor and reduce motor noise.
Since the series-wound DC motor develops its highest torque at low speed, it is often
used in traction applications such as electric locomotives, and trams. Another
application is starter motors for petrol and small diesel engines. Series motors must
never be used in applications where the drive can fail (such as belt drives). As the
motor accelerates, the armature (and hence field) current reduces. The reduction in
field causes the motor to speed up (see 'weak field' in the last section) until it destroys
itself. This can also be a problem with railway motors in the event of a loss of
adhesion since, unless quickly brought under control, the motors can reach speeds far
higher than they would do under normal circumstances. This can not only cause
problems for the motors themselves and the gears, but due to the differential speed
between the rails and the wheels it can also cause serious damage to the rails and
wheel treads as they heat and cool rapidly.
One interesting method of speed control of a DC motor is the Ward-Leonard Control.
It is a method of controlling a DC motor (usually a shunt or compound wound) and
was developed as a method of providing a speed-controlled motor from an AC supply,
though it is not without its advantages in DC schemes. The AC supply is used to drive
an AC motor, usually an induction motor that drives a DC generator or dynamo. The
DC output from the armature is directly connected to the armature of the DC motor
(usually of identical construction). The shunt field windings of both DC machines are
excited through a variable resistor from the generator's armature. This variable
resistor provides extremely good speed control from standstill to full speed, and
consistent torque. This method of control was the de facto method from its
development until it was superseded by solid state thyristor systems. It found service
in almost any environment where good speed control was required, from passenger
lifts through to large mine pit head winding gear and even industrial process
machinery and electric cranes. Its principal disadvantage was that three machines
were required to implement a scheme (five in very large installations, as the DC
machines were often duplicated and controlled by a tandem variable resistor). In
many applications, the motor-generator set was often left permanently running to
avoid the delays that would otherwise be caused by starting it up as required.

3.1.10.3 UNIVERSAL MOTORS


A variant of the wound field DC motor is the universal motor. The name derives from
the fact that it may use AC or DC supply current, although in practice they are nearly
always used with AC supplies. The principle is that in a wound field DC motor the
current in both the field and the armature (and hence the resultant magnetic fields)
will alternate (reverse polarity) at the same time, and hence the mechanical force
generated is always in the same direction. In practice the motor must be specially
designed to cope with the AC current (impedance must be taken into account as must
45

the pulsating force), and the resultant motor is generally less efficient than an
equivalent pure DC motor. Operating at normal power line frequencies, the maximum
output of universal motors is limited and motors exceeding one kilowatt are rare. But
universal motors also form the basis of the traditional railway traction motor. In this
application, to keep their electrical efficiency high, they were operated from very low
frequency AC supplies with 25 Hz and 16 2/3 Hz operation being common. Because
they are universal motors, locomotives using this design were also commonly capable
of operating from a third rail powered by DC.
The advantage of the universal motor is that AC supplies may be used on motors
which have the typical characteristics of DC motors, specifically high starting torque
and very compact design if high running speeds are used. The negative aspect is the
maintenance and short life problems caused by the commutator. As a result such
motors are usually used in AC devices such as food mixers and power tools which are
only used intermittently. Continuous speed control of a universal motor running on
AC is very easily accomplished using a thyristor circuit while stepped speed control
can be accomplished using multiple taps on the field coil. Household blenders that
advertise many speeds frequently combine a field coil with several taps and a diode
that can be inserted in series with the motor (causing the motor to run on half-wave
DC with half the RMS voltage of the AC power line).
Unlike AC motors, universal motors can easily exceed one revolution per cycle of the
mains current. This makes them useful for appliances such as blenders, vacuum
cleaners, and hair dryers where high-speed operation is desired. Many vacuum cleaner
and weed trimmer motors will exceed 10,000 RPM, Dremel and other similar
miniature grinders will often exceed 30,000 RPM. A theoretical universal motor
allowed to operate with no mechanical load will overspeed, which may damage it. In
real life, though, various bearing frictions, armature "windage", and the load of any
integrated cooling fan all act to prevent overspeed.
With the very low cost of semiconductorrectifiers, some applications that would have
previously used a universal motor now use a pure DC motor, usually with a
permanent magnet field. This is especially true if the semiconductor circuit is also
used for variable-speed control.
The advantages of the universal motor and alternating-current distribution made
installation of a low-frequency traction current distribution system economical for
some railway installations. At low enough frequencies, the motor performance is
approximately the same as if the motor were operating on DC. Frequencies as low as
16 2/3 Hertz were employed.

46

3.1.11 SOLENOID LOCK

FIG 3.17

Solenoids are made up of a coil of wire and a plunger or actuator. The coil of wire is
wound many times around a plastic spool. The copper wire is lightly coated with a
varnish to electrically insulate the wire from conducting power to each strand, since
the wires are laying next to each other and touching. This allows the coil of wire to
have a long length for creating a magnetic field. The generation of the magnetic field
is dependent upon the way the coil is wound. The magnetic field can either be a push
or pull type of field. Since the coil is wound around the plastic spool, the plunger or
actuator fits inside of the spool. Attached to the plunger is a mechanical lever that can
increase the movement of the "in" or "out" action of the electric solenoid.
CAR DOOR LOCKS

The locks on modern cars and trucks are a typical example of a push & pull type
action solenoid. As described above, a coil of wire is wound around a plastic spool.
Inside the spool is a plunger or actuator. When the "lock" button is pressed on the
door panel of the vehicle, an electrical signal is sent to the coil. The electrical power
generates a magnetic field inside the coil, and may pull down on the plunger, causing
the lock mechanism to engage. The "unlock" button simply reverses the flow of
electricity to the solenoid, so the magnetic field is generated in the opposite direction.
This causes the plunger to be pushed from the plastic spool, forcing the lock
mechanism to disengage. Only direct current (DC) power has the ability to reverse the
magnetic force of an electrical solenoid. By reversing the current flow in DC, the
magnetic force will also be reversed. As the name implies, direct current can only
move in one direction at one time; either from positive to negative, or by switching,
from negative to positive.

47

AC SOLENOIDS

Alternating Current (AC) power goes from negative to positive 60 times every
second. This cycling of power is called a Hertz. The power from the wall outlet
energizing the computer you are reading this article on, operates at 120VAC with a
60-hertz cycle. Since the power is cycling at such a fast rate, the electric solenoid coil
must be wound in such as way that it can only move in one direction when energized
by AC power. Once engaged, the solenoid must have a way to disengage once the
power is released. This disengagement is typically performed by a spring. The springs
aid the push or pull action of the solenoid's ability to shut "off." Of course, since the
spring helps to release the plunger after being engaged, it must also be overcome in
force by the magnetism of the coil. In other words, the spring must be strong enough
to release the plunger to the "off" position, but not be so strong that the magnetic coil
cannot turn "on" the plunger. You can hear these types of electrical solenoids in the
cycling of a washing machine. This happens when the water valves are actuated to
allow cold and hot water to enter the machine. You should be able to hear an audible
"click" each time the push & pull solenoid is actuated.

48

3.1.12 16*2 LCD


LCD (Liquid Crystal Display) screen is an electronic display module and find a wide
range of applications. A 16x2 LCD display is very basic module and is very
commonly used in various devices and circuits. These modules are preferred
over seven segments and other multi segment LEDs. The reasons being: LCDs are
economical; easily programmable; have no limitation of displaying special &
even custom characters (unlike in seven segments), animations and so on.
A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In
this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers,
namely, Command and Data.
The command register stores the command instructions given to the LCD. A
command is an instruction given to LCD to do a predefined task like initializing it,
clearing its screen, setting the cursor position, controlling display etc. The data
register stores the data to be displayed on the LCD. The data is the ASCII value of the
character to be displayed on the LCD.

3.1.12.1 PIN DIAGRAM

FIG 3.18

49

3.1.13 3*4 KEYPAD MATRIX

FIG 3.19
A keypad is a set of buttons arranged in a block or "pad" which usually bear digits,
symbols and usually a complete set of alphabetical letters. If it mostly contains
numbers then it can also be called a numeric keypad. Keypads are found on
many alphanumeric keyboards and on other devices such as calculators, push-button
telephones, combination locks, and digital door locks, which require mainly numeric
input.

50

3.1.13.1 USES AND FUNCTIONS

A computer keyboard usually has a small numeric keypad on the side, in addition to
the other number keys on the top, but with a calculator-style arrangement of buttons
that allow more efficient entry of numerical data. This number pad (commonly
abbreviated to "numpad") is usually positioned on the right side of the keyboard
because most people are right-handed.
Many laptop computers have special function keys which turn part of the alphabetical
keyboard into a numerical keypad as there is insufficient space to allow a separate
keypad to be built into the laptop's chassis. Separate external plug-in keypads can be
purchased.
As a general rule, the keys on calculator-style keypads are arranged such that 123 is
on the bottom row, whereas in a telephone keypad, there will be the 123-keys at the
top. A phone key-pad also has the special buttons labelled * (star) and #
(octothorpe, number sign, "pound", "hex" or "hash") on either side of the zero key.
Most of the keys on a telephone also bear letters which have had several auxiliary
uses, such as remembering area codes or whole telephone numbers.
The keypad of a calculator contains the digits 0 through 9, from bottom upwards,
together with the four arithmetic operations, the decimal point and other more
advanced mathematical functions.
The reason that the keypad of keyboards and calculators are different is the subject of
some uncertainty. There are several popular theories and folk histories. One popular
theory suggests that the reason is similar to that given for the QWERTY layout, the
unfamiliar ordering slowed down users to accommodate the slow switches of the late
1950s and early 1960s.[2] Although calculator keypads predate telephone keypads,
telephone designers had several reasons to use the descending order. At the time of
the introduction of the telephone keypad, telephone numbers in the U.S. where
commonly given out using alphabetical characters for the first two digits. Thus 5551234 would be given out as KL5-1234. These alpha sequences were mapped to
words. "27" was given out as "CRestview", "26" as "ATwood", etc. By placing the
"1" key in the upper left, the alphabet was arranged in the normal left-to-right
descending order for English characters. Additionally, on a rotary telephone the "1"
hole was at the top, albeit at the top right. Finally, some sources state that AT&T
conducted research to see which ordering resulted in the least confusion. [3]
The definitive answer appears to be the result of a research study conducted by Bell
Labs published in 1960: "Human Factor Engineering Studies of the Design and Use of

51

Pushbutton Telephone Sets" by R. L. Deininger. [4] This study concluded that the
adopted layout was best.
Keypads are also a feature of some combination locks. This type of lock is often used
on doors, such as that found at the main entrance to some offices.

Fig 3.20

52

3.1.14 CENTER TAP TRANSFORMER

FIG 3.21
In electronics, a center tap (CT) is a contact made to a point halfway along a winding
of a transformer or inductor, or along the element of a resistor or a potentiometer.
Taps are sometimes used on inductors for the coupling of signals, and may not
necessarily be at the half-way point, but rather, closer to one end. A common
application of this is in the Hartley oscillator. Inductors with taps also permit the
transformation of the amplitude of alternating current (AC) voltages for the purpose
of power conversion, in which case, they are referred to as autotransformers, since
there

is

only

one

winding.

An

example

of

an

autotransformer

is

an automobile ignition coil. Potentiometer tapping provides one or more connections


along the device's element, along with the usual connections at each of the two ends
of the element, and the slider connection. Potentiometer taps allow for circuit
functions that would otherwise not be available with the usual construction of just the
two end connections and one slider connection.

Fig 3.22

53

3.1.15 5V ADAPTOR

FIG 3.23
An AC adapter, AC/DC adapter, or AC/DC converteris a type of external power
supply, often enclosed in a case similar to an AC plug. Other names include plug
pack, plug-in adapter, adapter block, domestic mains adapter, line power adapter, wall
wart, power brick, and power adapter. Adapters for battery-powered equipment may
be described as chargers or rechargers (see also battery charger). AC adapters are used
with electrical devices that require power but do not contain internal components to
derive the required voltage and power from mains power. The internal circuitry of an
external power supply is very similar to the design that would be used for a built-in or
internal supply.
External power supplies are used both with equipment with no other source of power
and with battery-powered equipment, where the supply, when plugged in, can
sometimes charge the battery in addition to powering the equipment.
Use of an external power supply allows portability of equipment powered either by
mains or battery without the added bulk of internal power components, and makes it
unnecessary to produce equipment for use only with a specified power source; the
same device can be powered from 120Vac or 230Vac mains, vehicle or aircraft
battery by using a different adapter.

54

CHAPTER 4 : SETUP, PROCEDURE & FABRICATION


4.1 SETUP
Fig 4.1

The basic setup of circuits of advance locking system is shown in the above diagram
the connections are as follows:

Port 0 of microcontroller is connected to 10k resistor array which is then


connected to VCC of the power supply for pulling up the port. After pulling
up port-0 is connected to 16*2 LCD display.

55

Fig 4.2
5V VCC is connected to 31st pin of microcontroller.
A RC reset circuit is connected to 9 st pin of microcontroller which resets the
microcontroller each the setup is switched on.
Port-3 (1st to 7th pin of port-3) of microcontroller is connected to 3*4 keypad
matrix.
18th and 19th pin of microcontroller is connected to 12 MHz crystal oscillator
for providing clock pulse to the microcontroller.
10th and 11th pin of microcontroller is connected to SIM-300 which send SMS
to the user.
Port-3 is again connected to L293D which drives the solenoid lock and DC
motor.

56

4.2 PROCEDURE

4.2.1 PCB FABRICATION


PCB fabrication includes following steps:

Designing the circuit.

Printing off the design.

Cutting the CCB material to size

Printing circuit on CCB

Etching.

Drilling.

Soldering.

4.2.1.1 DESIGNING THE CIRCUIT:


Design a circuit on a piece of paper according to the components used and its
working. Also mention holes and jump wires on the circuit. Always avoid jump wires
as it makes circuit complex. Then by the reference of this circuit design the PCB on
CAD or any other software for circuit design.

FIG 4.3

57

4.2.1.2 PRINTING OFF THE CIRCUIT:


Using a laser printer and toner transfer paper can allow you to get the circuit design
out of the computer and onto the copper clad printed circuit board material
.
4.2.1.3 CUTTING THE PCB MATERIAL TO ITS SIZE:
Using a band saw cut the printed circuit board material to the size of the design. After
cutting out the board, sand the board edges to remove the roughness of the fiberglass.
After sanding clean the new copper clad printed circuit board material and keep the
oil from fingers off the copper surface by holding the board by its edges.

4.2.1.4 PRINTING THE CIRCUIT ON CCB:


Putting the printed side of paper on the copper cladded side of circuit board and
ironing it for 5 to 10 minutes. This will print the circuit on the CCB. Now wait for 2
minutes for the board to cool.

Fig 4..4

58

4.2.1.5 ETCHING:
Pour a small amount of Ferric Chloride into a shallow plastic sealable container. Do
not use a metal container to store the etchant as it will be dissolved over time by the
etchant chemicals. Place the toner transferred PCB into the etchant. Soak a disposable
sponge in the ferric chloride and slowly rub the entire PCB material. Every so often
dip the sponge in the etchant to suck up more fluid. Rub the circuit board in a constant
pattern for around two to three minutes until all of the unmasked copper has been
etched away. A smaller circuit board will etch faster than a larger circuit board, so
spread out your rubbing action on a larger design.

FIG 4.5

59

4.2.1.6 DRILLING:
Using 0.5 mm drill bit drill the holes on the PCB where the components have to be
installed.
Be careful while drilling because it can break the PCB.

FIG 4.6
4.2.1.7 SOLDERING:

Now solder the components on the PCB for making the complete circuit. Keep time
soldering surface mount components minimum to avoid overheating.

FIG 4.7
60

4.2.2 PROCEDURE
Working of advance locking system is divided into following categories:
(i)

Power supply

(ii)

Microcontroller

(iii)

LCD

(iv)

GSM module

(v)

Motor driver IC

(vi)

Locks

4.2.2.1 POWER SUPPLY:


We are using two types of power supply circuit one directly from adapter
and other from rectified AC and then converting it into 5V rectified DC
5V RECTIFIED POWER SUPPLY:

Fig 4.8
The transformer converts 220V AC to 12V AC which is then given to full wave
rectifier which is then rectified into 10.8V rectified AV i.e. into DC but it contains
some ripple which is removed by using 100 microfarad electrolytic capacitor.
This 12V rectified AC is then given to LM7805 which converts 12V DC 5V regulated
DC. LM7805 does not gives exact 5V but it fluctuates between 4.9V to 5.2V therefore
to convert it into 5V we use 10 microfarad capacitor which gives 5V regulated DC
this is used to drive all the components of the advance locking system like
microcontroller, 16*2 LCD display, L293D and 3*4 keypad matrix.

61

4.2.2.2 ADAPTOR:
5V adaptor is used to drive GSM module which send and receive message while
operation of advance locking system.

4.2.2.3 MICROCONTROLLER:

Microcontroller acts as the brain of the advance locking system it controls all
the operations of the system. It stores the PIN and program for the operation as
it contains 8 KB of flash memory. It also generates the OTP.
It also compares the entered input with pre stored input or with the generated
OTP.
When we switch on the system LCD displays enter the PIN if user enters
correct PIN, microcontroller will generate an OTP and it is delivered to the
GSM module which send this OTP to the user via SMS. When user enter the
OTP the latch will be unlocked and door opens.
When user type incorrect PIN microcontroller will send the message
unauthorised attempt detected to GSM module which interns send this
message to the user via SMS. And microcontroller sends another signal to
L293D which latches secondary lock.

4.2.2.4 LCD:
LCD acts as one of the output device of the advance locking system it displays the
entered input and also display the response of the system.

4.2.2.5 GSM MODULE:


GSM module is used to send the OTP and the message unauthorised attempt
detected to the user via SMS (short messaging service) it uses 2G spectrum for its
operation.
GSM module can also be used to make calls.
We can also program our system to send message to police station when wrong
attempt is made or when someone tries to temper our system.
GSM module operates at 900MHz frequency and uses TDMA () or CDMA () technic
for modulation.

62

4.2.2.6 MOTOR DRIVER IC:

FIG 4.9
L293D is used to drive locks it can operate two motors at time at can deliver 36 V at
output.
According to the following input control signal it produces output which locks or
unlocks the system :
INPUT 1
0
0
1
1

INPUT 2
0
1
0
1

ENABLE 1,2
Result
1
Stop
1
Anti-clockwise rotation
1
Clockwise rotation
1
Stop
TABLE 4.1

4.2.2.7 SOLENOID LOCK:


A solenoid bolt is a type of electronic-mechanical locking mechanism. This type of
lock is characterized by the use of a solenoid to throw the bolt. Sophisticated solenoid
bolt
locks
may
use microprocessors to
perform voltage
regulation,
reduce power consumption, and/or provide access control. Depending on the strength
of the solenoid, some models can provide a holding force on the order of 1000 kg. A
solenoid bolt can be designed either to fail open (the lock opens on power loss) or to
fail closed (the device is locked upon power loss); fail safe. Some models may be
suitable for high-security sites.
According to the input control signal generated by the microcontroller the solenoid
can be locked or unlocked.

63

CHAPTER 5 : PROGRAMMING
C program is used to control the operations of microcontroller which is as follows:
#include <REGX52.H> //Include file for 8051
#include<LCD.h>
#define lcdrow1() lcdcommand(0x80)
#define lcdrow2() lcdcommand(0xC0)

/* Begin at Line 1 */
/* Begin at Line 2 */

void lcdenable();
void lcdcommand(unsigned char command);
void lcdputc(unsigned char ascii);
void lcdputs(unsigned char *lcdstring);
void lcdinit()
void send(unsigned char cht);
void sends(unsigned char *stt);
#define c1 P0_2 //column 1
#define c2 P0_1 //column 2
#define c3 P0_0 //column 3
unsigned char s;

void clock()
{
P3_6=0;
P1_6=1;
delay(100);
P3_6=1;
P1_6=1;
}
void anticlock()
{
P3_6=1;
64

P1_6=0;
delay(100);
P3_6=1;
P1_6=1;
}
void lock()
{
P3_7=1;
P1_7=1;
}
void unlock()
{
P3_7=0;
P1_7=1;
}
char k,j;
unsigned temp[4];
char t,l,ni,no,h;
bit flag=1;
#define port P0
unsigned char get,key;
unsigned char getkey(void);
unsigned char code otp[6][4]=
{
{"4456"},
{"5567"},
{"3345"},
{"2234"},
{"1123"},
{"6678"}

65

};
bit clockflag=0;
void main()
{
P1=0xff;
lock();
anticlock();
clockflag=0;
lcdinit();
lcdrow1();
lcdputs(" GSM BASED

") ;

lcdrow2();
lcdputs("ADVANCED LOCKING") ;
delay(1000);
lcdrow1();
lcdputs("PROJECT DONE BY:")

lcdrow2();
lcdputs("ALAINA

")

delay(1000);
lcdrow1();
lcdputs("VEDANT

")

lcdrow2();
lcdputs("PRABHAT

") ;

delay(1000);
lcdrow1();
lcdputs("PALLAVI

")

lcdrow2();
lcdputs("QUAYAD ")

delay(1000);
lcdrow1();

66

lcdputs("E.C.E. Final Yr.")

lcdrow2();
lcdputs("B.B.D.N.I.T.M. ") ;
delay(1000);
EA = 1;
ET0 = 1;
TR0 = 1;
serial_init();
lcdcommand(0x01);
while(1)
{
lcdrow1();
lcdputs("Enter Password ");
lcdrow2();
lcdputs("

");

lcdrow2();
t=0;
while(t!=4)
{
temp[t] =getkey();
}
if(t==4)
{
if(temp[0]=='1'&&temp[1]=='2'&&temp[2]=='3'&&temp[3]=='4')
{
lcdrow1();
lcdputs("USER ONE

");

lcdrow2();
lcdputs("SENDING OTP

");

delay(1000);

67

ni=no;
sends("AT+CMGS=");
send('"');
sends("9696277789");
send('"');
sends("\r");
for(h=0;h<4;h++)
send(otp[ni][h]);
send(0x1a);
lcdrow1();
lcdputs("USER ONE

");

lcdrow2();
lcdputs("OTP SENT

");

delay(1500);
lcdrow1();
lcdputs("Enter OTP

");

lcdrow2();
lcdputs("

");

lcdrow2();
t=0;
while(t!=4)
{
temp[t] =getkey();
}
if(temp[0]==otp[ni][0]&&temp[1]==otp[ni][1]&&temp[2]==otp[ni][2]&&temp[3]==
otp[ni][3])
{
lcdrow1();
lcdputs("Success

");

if(flag==1)
{
68

flag=0;
unlock();
lcdrow2();
lcdputs("Unlocked

");

delay(1500);
}
else
{
flag=1;
lock();
lcdrow2();
lcdputs("Locked

");

delay(1500);
}
if(clockflag==1)
{
clockflag=0;
anticlock();
}
}
}
else
if(temp[0]=='9'&&temp[1]=='8'&&temp[2]=='7'&&temp[3]=='6')
{
lcdrow1();
lcdputs("USER TWO

");

lcdrow2();
lcdputs("SENDING OTP

");

delay(1500);
ni=no;

69

sends("AT+CMGS=");
send('"');
sends("8979627559"); ///////////////////////
send('"');
sends("\r");
for(h=0;h<4;h++)
send(otp[ni][h]);
delay(50) ;
send(0x1a);
lcdrow1();
lcdputs("USER TWO");
lcdrow2();
lcdputs("OTP SENT");
delay(1500);
lcdrow1();
lcdputs("Enter OTP");
lcdrow2();
lcdputs("

");

lcdrow2();
t=0;
while(t!=4)
{
temp[t] =getkey();
}
if(temp[0]==otp[ni][0]&&temp[1]==otp[ni][1]&&temp[2]==otp[ni][2]&&temp[3]==
otp[ni][3])
{
lcdrow1();
lcdputs("Success

");

if(flag==1)
{
70

flag=0;
unlock();
lcdrow2();
lcdputs("Unlocked

");

delay(1500);
}
else
{
flag=1;
lock();
lcdrow2();
lcdputs("Locked

");

delay(1500);
}
if(clockflag==1)
{
clockflag=0;
anticlock();
}
}
}
else
{
clock();
clockflag=1;
lock();
flag=1;
lcdrow1();
lcdputs("INVALID USER

");

lcdrow2();

71

lcdputs("SENDING ALERT ");


delay(1500);
sends("AT+CMGS=");
send('"');
sends("9696277789");///////////////////////
send('"');
sends("\r");
sends("Unknown Attempt Detected\n\r");
send(0x1a);
delay(1500);
sends("AT+CMGS=");
send('"');
sends("8979627559");
send('"');
sends("\r");
sends("Unknown Attempt Detected\n\r");
send(0x1a);
delay(6500);
lcdrow1();
lcdputs("Alert Meassage ");
lcdrow2();
lcdputs("Sent");
delay(2000);
}
}
}
}
void timer0 (void) interrupt 1// Timer 0 for one second time
{
if(no<=4)

72

no++;
else
no=0;
}

73

Vous aimerez peut-être aussi