You are on page 1of 53

1.

INTRODUCTION

Consider the basic electrical parameters. That electrical parameters are all
controlled by wired system but the recent trend the wireless communication is
replaced by wired system which was very messy and difficult to setup how ever,
the existing wireless system can cover up to certain range of area that is limited
by the range of wireless module being used. This paper introduces the
conceptual understanding and strategy of GSM standard to be deployed in any
environment. GSM will provide unlimited range of communication for the
system as long as there are intermediate nodes that will pass the data from one
node to another until it reaches the destination. Prototype systems of electrical
device switching are built utilizing GSM based sensor network to present an
insight for its practical implementation in smart home concept.

This GSM is abbreviated by Global system For Mobile

In this project electrical devices are controlled by sending a message


through mobile phone. Each device is connected to separate switching section
and each assigned with unique code if we send particular code of any device the
controller will on/off the device through switching section.

1
3.1 POWER SUPPLY SECTION

3.1.1 Power Supply Unit

Every electronics system whether an entertainment gadget or a test and


measurement equipment is requires one or more than one DC voltages for its
operation. Power supplies are often classified as linear power supplies or
switched mode power supplies depending up on the nature of regulation circuit.
In our project linear power supplies are used, since the required DC voltages are
+5v, +12v, & -12volts. Basic constituents of a linear power supply such as
transformer, rectifier, filters and voltage regulators are discussed here. The linear
power supply block diagram is shown in fig.

Step down Rectifier Filter Regulator


Transformer

3.1.2.Function and operation:

The main function of this linear power supply is to convert AC to DC.


The basic principle of the linear power supply is following.

The 230v single-phase AC supply is step-downed by the step-down


transformer. We are choosing 9v step-down transformer, because we require DC
volt as 5v. Always the transformer rating is higher than DC output voltage.

2
The transformer output is given to rectifier, where the AC signal is
converted into DC signal. Than the rectifier, output is given to filter because the
rectifier output has the noise signal. This noise signal is filtered by capacitor.
The capacitor output is given regulator IC, where the capacitor output voltage is
regulated and maintaining as constant voltage. This constant DC voltage is
supply to our component.

Design and explanation: -

Power transformer:

Its job is either to step up or (mostly) step down the ac supply voltage to
suit the requirement at the solid-state electronic device and circuit fed by the DC
power supply. It also provides isolation from the supply line an important safety
consideration.

A transformer is required for reducing the nominally 230v ac wall outlet


voltage to the lower ac valve required by transistors, IC’s and other electronic
devices. Transformer voltages are given in terms of any valves. The transformer
rated as 230 V to full center tap with the 230 V rms connected to the primary,
full rms developed between secondary 1 & 2. A third lead brought out from the
center of the secondary, is called a center tap CT. Between terminals CT and 1
or CT and 2 , the rms voltages is half V

T1
1 5
230V,
single phase, 9V
4 8
AC supply
TRANSFORMER

An oscilloscope would show the sinusoidal voltage. The maximum


instantaneous voltage Em is related to the rms Erms by Em=1.4(Erms)

3
The transformer selection not only depends on voltage. But current are taken to
be account there different circuit are used. They are transducer, microcontroller,
driver circuit, MAX 232 and relays. The transformer rates as 230-15V. The step-
down transformer rated as 230-15V, 1A.

3.1.3.Rectifier circuit: -

It is a circuit, which employs one or more diodes to convert AC voltage in


to pulsating DC voltage. Some important terms relevant to rectifier circuit are
described below

Here we are using full wave convectional type rectifier as shown in fig.
Filter (Capacitor filter): - +V
IN4001 IN4001

AC IN DC OUT
IN4001 IN4001

GND

The function of the circuit element is to remove the fluctuations or


pulsating (called ripple) present in the output voltage supplied by the rectifier.
Of course, no filter can be in practice, which gives an output voltage as ripple-
free, as that of DC battery, but if approaches it to closely that power supply
perform as well.

The capacitor filter is mostly used. The filtering actions of a capacitor


across the output of the rectifier come from the fact that it offers a low reactance
to AC components. The AC component is by passed to ground through the
capacitor and only the DC is allowed to go through the load.
The capacitor charges to the peak value of the voltage waveform during
the first cycle and as the voltage in the rectifier waveform is on the decrease , the

4
capacitor voltage is not able to follow the charge as it can discharge only at a
rate determined by (CRL) time constant. In case of light load when (R L ) is large,
the capacitor would discharge only a little before the voltage in the ripple is
triangular in nature with the ripple constant being inversely proportional to (C )
& (RL ).
Ripple can be reduced by increasing (C ) for a given value of (R L ). For
heavy load when RL is small even a large capacitance value may not be able to
provide ripple within acceptable limits. Ripple factor (r ) can be expressed by

V=2886/ CRL for power line frequency of 50 Hz.

+V +V

1000/25V

GN GN
D D
3.1.4.Regulators: -

Its main function is to keep terminal voltage of the DC supply constant even
when AC input voltage to transformer varies

1. The load varies.


Usually zener diode and transistor are used for voltage regulation purpose.
Again it is impossible to get 100 % constant voltage but minor variation are
acceptable for most of the job.

The power supply circuits suffer from the drawback that, their DC output
voltage changes with changes in load or input voltage. Such power supply is
called unregulated power supply. Regulated power supply can be obtained by
using a voltage regulator circuit. A regulator is an electronic control circuit,
which is capable of providing a nearly constant DC output voltage even when

5
these vary in load or input voltage. Regulators are of two types, linear &
switching regulator, which are also available in integrated circuit form.

IC Voltage Regulator: -

Due to low-cost fabrication technique, many commercial integrated-


circuit (IC) regulator are available since the past two decades. These include
 Fairly simple
 Fixed voltage type of high quantity precision
regulators.
 Improved performance
They have a number of unique build-in features as: -

 Current limiting
 Self-protection against over temperature
 Remote control operation over a wide range of
input voltage and feedback current Limiting.

Types of IC Regulators: -

1. Fixed positive linear voltage regulator


2. Fixed negative linear voltage regulator
3. Variable positive linear voltage regulator
4. Variable negative linear voltage regulator
In our project we used only fixed positive & fixed negative linear voltage
regulators, therefore we discuss up on these types of regulators.

Fixed positive regulators: -

There are many IC regulators available in the market that produces a


fixed positive voltage. But 7800(78XX) series of IC regulator is representative
6
of three terminal devices that are available with several fixed positive output
voltage making them useful in a wide range of applications. A standard
configuration of fixed positive IC regulators is 7800 series. It have three
terminal labeled as input, output, & ground. The last two digit marked (00) or
(XX) in the positive number are the designed output voltage. For example, IC
7805 is a +5V regulator. The 78XX used up to +5V to +24V. The capacitor C 1
( typically 0.33μF) is required only if the power supply filter is located more
than 3 inches from the IC regulator. The capacitor C 2 (typically 0.01μF) act
basically as a line filter to improve a transient response. It is primarily used to
produce fixed output voltage, but they can also be used with external component
to obtain adjustable output voltage and current.

Design: -

The output voltage is given by equation,

Vout = Vfixed + (Vfixed /R1 + IQ ) R2

For example, 7805 IC regulator

Vfixed = 5V

R1 = R2 = 1KΩ

IQ =2mA

Vout = 5+(5/1 + 5) * 1

Vout = 15V

Thus output voltage of IC 7805 regulator can be adjusted anywhere


between 5 to 15V. By using external resistance R 1 & R2, the circuit diagram is
shown in fig.

1 3
+V IN LM7805 OUT VCC
GND

7
2

10/25V

GND GND
Fixed negative linear voltage regulator: -

The 7900 series is typically of three terminal IC regulators that provide a


fixed negative output voltage. This series is a negative voltage counterpart of the
7800 and shares most of the same features, characteristics, & package types.
Functions of components: -
1.The capacitor C1 (.22μF)
It is required only if the power supply filter is located more than 3 inch
Away from the IC regulator.
2. The capacitor C2 (1μF)
It is required for the stability of output voltage.
3. The capacitor C3 (25μF)
To improved the transient response of the output voltage.
4. The resistor R2 (300Ω)
The recommended value for 7905 is 300Ω, for 7915 is 750Ω & for
7915 is 1KΩ.
Design: -

The output voltage is given by the equation.

Vout = Vfixed ((R1 +R2)/ R2)

Vout =5+((9+1)/1)

Vout =15V

8
Thus output voltage of IC 7905 regulator can be adjusted any
where between –5 to –15V. By using external resistances R 1 & R2 . The circuit
diagram is shown in fig.
1 3
+V IN LM7905 OUT VCC

GND
2
10/25V 0

GND GND

Power consumption

The various circuit consuming voltage and current given in table

NAME OF
VOLT AMP POWER
CIRCUITS
Depending on Depending on
Micro controller +5V
I/O lines I/O lines
GSM module +12, +5V
MAX 232 +5V

CIRCUIT DIAGRAM
U1
LM7805C/TO220
1 3
IN OUT VCC
D1 D2
GND

9V 0V
2

0
C1 C2
D3 D4

GND

9
5.GSM (GLOBAL SYSTEM FOR MOBILES)

5.1 INTRODUCTON

The product is available as Board Level or enclosed in Metal Box. The


Board Level product can be integrated in to Various Serial devices in providing
those SMS and Data capability and the unit housed in a Metal Enclosure can be
kept outside to provide serial port connection. The GSM Modem supports
popular "AT" command set so that users can develop applications quickly.
The product has SIM Card holder to which activated SIM card is inserted
for normal use. The power to this unit can be given from UPS to provide
uninterrupted operation. This product provides great feasibility for Devices in
remote location to stay connected which otherwise would not have been possible
where telephone lines do not exist.

Details of “AT” (Attention) Commands:

AT commands are instructions used to control a modem. AT is the


abbreviation of Attention. Every command line starts with "AT" or "at". That’s
why modem commands are called AT commands. There are two types of AT
commands.

Basic commands are AT commands that do not start with "+". For
example, D (Dial), A (Answer), H (Hook control) and O (Return to online data
state) are basic commands.
Extended commands are AT commands that start with "+". All
GSM AT commands are extended commands. For example, +CMGS (Send
SMS message), +CMGL (List SMS messages) and +CMGR (Read SMS
messages) are extended commands.

10
5.2Application Of GSM

 Mobile Transport vehicles.


 LAN based SMS servers
 Alarm notification of critical events including Servers
 Network Monitoring and SMS reporting
 Data Transfer applications from remote locations
 Monitor and control of Serial services through GSM Network
 Integration to custom software for Warehouse, Stock, Production,
 Dispatch notification through SMS.
 AMR- Automatic Meter Reading.

CONNECTION DIAGRAM

Supply Input
The product requires AC supply of 9 V with 1 Amp current rating for
proper Operation.
GSM Serial
This RS 232 serial port can be connected to computer or any serial port
for communicating with the product using AT commands. Default Port Speed is
9600 bps.
11
BLOCK DIAGRAM:

Power ON LED Indication


Always On when there is Power available to the unit
GSM Status LED
OFF – Module is in OFF mode or under download condition
Slow Flash – ON 200 msec and OFF 2 sec – Unit is registered on the
Network and there is No data transfer.
Quick Flash – ON 200 ms and OFF 600 m sec – Unit is registered on the
Network and data transfer is in Progress.
SIM Card Holder
Insert the Activated SIM card from the GSM service provider in this
socket for Normal operation.
RJ 9 Jack for Handset Connection
Insert Analog Telephone instrument Handset with RJ 9 plug to this socket
for Voice communication.

12
4. MICROCONTROLLER 8051

4.1INTRODUCTION

A microcontroller is a computer-on-a-chip used to control electronic


devices. It is a type of microprocessor emphasizing self-sufficiency and cost-
effectiveness, in contrast to a general-purpose microprocessor, the kind used
in a PC. A typical microcontroller contains all the memory and I/O interfaces
needed, whereas a general-purpose microprocessor requires additional chips
to provide these necessary functions. Microcontrollers are a component in
many kinds of electronic equipment.

4.2 Pin Details

Pin Diagram of 8051:

8051

13
• 8051 contains four I/O ports (P0 - P3)

• Each port can be used as input or output (bi-direction)

IMPORTANT PINS:
• PSEN (out): Program Store Enable, the read signal for external program
memory (active low).
• ALE (out): Address Latch Enable, to latch address outputs at Port0 and
Port2
• EA (in): External Access Enable, active low to access external program
memory locations 0 to 4K
• RXD,TXD: UART pins for serial I/O on Port 3
• XTAL1 & XTAL2: Crystal inputs for internal oscillator.

PORT DESCRIPTION:
Port 0: Port 0 is an 8-bit open drain bidirectional port. As an open drain
output port, it can sink eight LS TTL loads. Port 0 pins that have 1s written to
them float, and in that state will function as high impedance inputs. Port 0 is also
the multiplexed low-order address and data bus during accesses to external
memory. In this application it uses strong internal pull-ups when emitting 1s.
Port 0 emits code bytes during program verification. In this application, external
pull-ups are required.

Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. Port
1 pins that have 1s written to them are pulled high by the internal pull-ups, and
in that state can be used as inputs. As inputs, port 1 pins that are externally being
pulled low will source current because of the internal pull-ups.

14
Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pullups. Port
2 emits the high-order address byte during accesses to external memory that use
16-bit addresses. In this application, it uses the strong internal pullups when
emitting 1’s.

Port 3: Port 3 is an 8-bit bidirectional I/O port with internal pullups. It


also serves the functions of various special features of the 80C51 Family as
follows:
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 interrupt)
P3.5 T1 (Timer 1 external interrupt)
P3.6 WR (external data memory write strobe)
P3.7 RD (external data memory read strobe)

SIGNALS – OPERATION:

• Vcc(pin 40):

– Vcc provides supply voltage to the chip.

– The voltage source is +5V.

• GND(pin 20):ground

• XTAL1 and XTAL2(pins 19,18):


These 2 pins provide external clock.
– Way 1:using a quartz crystal oscillator
– Way 2:using a TTL oscillator
• RST(pin 9):reset
15
– input pin and active high .

– The high pulse must be high at least 2 machine cycles.

– power-on reset.

– Upon applying a high pulse to RST, the microcontroller will reset


and all values in registers will be lost.

– Reset values of some 8051 registers .

• EA’(pin 31):external access

– There is no on-chip ROM in 8031 and 8032 .

– The EA’ pin is connected to GND to indicate the code is stored


externally.

– PSEN’ & ALE are used for external ROM.

– For 8051, EA’ pin is connected to Vcc.

– active low.

• PSEN’(pin 29):program store enable

– This is an output pin and is connected to the OE pin of the ROM.

• ALE (pin 30):address latch enable

 It is an output pin and is active high.

 8051 port 0 provides both address and data.

 The ALE pin is used for de-multiplexing the address and data by
connecting to the G pin of the 74LS373 latch.

4.3 BLOCK DIAGRAM:

16
Types of Memory

On-Chip memory refers to any memory (Code, RAM, or other) that


physically exists on the microcontroller itself.

17
External code memory is program memory that resides off the chip. This
is often in the form of an external EPROM.

External RAM resides off-chip. This is often in the form of standard static
RAM or flash RAM.

Code Memory
This is the memory that holds the actual 8051 program. It is limited to
64K size. Code memory may be found on-chip, either burned into the
microcontroller as ROM or EPROM. Code may also be stored completely off-
chip in an external ROM or more commonly, an external EPROM. Flash RAM
is also another popular method of storing a program. Various combinations of
these memory types may also be used--that is to say, it is possible to have 4K of
code memory on-chip and 64k of code memory off-chip in an EPROM. When
the program is stored on-chip the 64K maximum is often reduced to 4k, 8k, or
16k. This varies depending on the version of the chip that is being used. Each
version offers specific capabilities and one of the distinguishing factors from
chip to chip is how much ROM/EPROM space the chip has.

External RAM
This refers to random access memory found off-chip. This memory has
slower access time than on-chip RAM. For example, to increment an Internal
RAM location by 1 requires only 1 instruction and 1 instruction cycle. To
increment a 1-byte value stored in External RAM requires 4 instructions and 7
instruction cycles. In this case, external memory is 7 times slower! While
Internal RAM is limited to 128 bytes (256 bytes with an 8052), the 8051
supports 64K external RAM.

Special Function Registers:


SFRs are accessed as if they were normal Internal RAM. The only
difference is that Internal RAM is from address 00h through 7Fh whereas SFR

18
registers exist in the address range of 80h through FFh. Each SFR has an address
(80h through FFh) and a name. The following table lists the symbols, names and
addresses of the 8051 SFRs.

Accumulator:
The Accumulator is used as a general register to accumulate the results of
a large number of instructions. It can hold an 8-bit (1-byte) value and is the most
versatile register the 8051 has due to the shear number of instructions that make
use of the accumulator. More than half of the 8051’s 255 instructions manipulate
or use the accumulator in some way.

For example, if you want to add the number 10 and 20, the resulting 30
will be stored in the Accumulator. Once you have a value in the Accumulator
you may continue processing the value or you may store it in another register or
in memory.

Auxiliary registers:
The auxiliary registers are a set of eight registers that are named R0, R1,
etc. up to R7.These registers are used in many operations. To continue with the
above example, perhaps you are adding 10 and 20. The original number 10 may
be stored in the Accumulator whereas the value 20 may be stored in, say,
register R4. To process the addition you would execute the command.

Program Counter (PC):

The Program Counter (PC) is a 2-byte address that tells the 8051 where
the next instruction to execute is found in memory. When the 8051 is initialized
PC always starts at 0000h and is incremented each time an instruction is
executed. It is important to note that PC isn’t always incremented by one. Since
some instructions require 2 or 3 bytes the PC will be incremented by 2 or 3 in
these cases. The Program Counter is special in that there is no way to directly
modify its value. That is to say, you can’t do something like PC=2430h. On the
19
other hand, if you execute LJMP 2340h you’ve effectively accomplished the
same thing.

Stack Pointer (SP)

The Stack Pointer, like all registers except DPTR and PC, may hold an 8-
bit (1-byte) value. The Stack Pointer is used to indicate where the next value to
be removed from the stack should be taken from. When you push a value onto
the stack, the 8051 first increments the value of SP and then stores the value at
the resulting memory location.

When you pop a value off the stack, the 8051 returns the value from the memory
location indicated by SP, and then decrements the value of SP. This order of
operation is important. When the 8051 is initialized, SP will be initialized to
07h. If you immediately push a value onto the stack, the value will be stored in
Internal RAM address 08h. First the 8051 will increment the value of SP (from
07h to 08h) and then will store the pushed value at that memory address (08h).
SP is modified directly by the 8051 by six instructions: PUSH, POP, ACALL,
LCALL, RET, and RETI. It is also used intrinsically whenever an interrupt is
triggered.

4.4 FEATURES:

 On-chip FLASH program memory


 Speed up to 33 MHz
 Full static operation
 RAM expandable externally to 64k bytes
 4 level priority interrupt
 6 interrupt source
 Four 8-bit I/O ports
 Three 16- bit timers

20
3.2 EXTERNAL DRIVERS

The microcontroller generates the control signals for activate the relays.
But this signal is not sufficient to drive the relays. Because the microcontroller
I/O lines has 0.25mA for drive current only. But the drive relays required
100mA. So we have to use power booster circuit. This power booster circuit is
called as driver circuit. There are two types of driver circuits available. These are
called as voltage driver circuit and current driver circuit. Here the current driver
circuits are used.

3.2.1 ULN2803

3.2.1.1 INTRODUCTION

The ULN2801A-ULN2805Aeach contains eight Darlington transistors


with common emitters and integral suppression diodes for inductive loads. Each
Darlington features a peak load current rating of 600mA (500mA continuous)
and can withstand at least50V in the off state. Outputs maybe paralleled for
higher current capability. Five versions are available to simplify interfacing to
standard logic families. The ULN2801Ais designed for general-purpose
applications with a current limit resistor. TheULN2802Ahas a 10.5kW input
resistor and zener for 14-25VPMOS; theULN2803Ahas a 2.7kW input resistor
for 5V TTL and CMOS . the ULN2804A has a 10.5kW input resistor for 6-15V
CMOS and the ULN2805A is designed to sink a minimum of 350mA for
standard and Scotty TTL where higher output current is required. All types are
supplied in an 18-lead plastic DIP with a copper lead from and feature the
convenient input opposite- output Pin out to simplify board layout.

The eight NPN Darlington connected transistors in this family of arrays


are ideally suited for interfacing between low logic level digital circuitry (such
as TTL, CMOS or PMOS/NMOS) and the higher current/voltage requirements

21
of lamps, relays, printer hammers or other similar loads for a broad range of
computer, industrial, and consumer applications. All devices feature open-
collector outputs and freewheeling clamp diodes for transient suppression. The
ULN2803 is designed to be compatible with standard TTL families while the
ULN2804 is optimized for 6 to 15volt high-level CMOS or PMOS.

3.2.1.2.PIN DIAGRAM:

SCHEMATIC (EACH DARLINGTON PAIR):

22
3.2.1.3.OPERATON OF ULN 2803:
The output of the ULN2803 is "inverted". This means that a HIGH at the
input becomes a LOW at the corresponding output line. eg If the printer port line
connected to pin 1 goes HIGH, pin 18 on the ULN2803 will go LOW (switch
off).
To operate the ULN2803 board an external power supply (not exceeding
maximum ratings) needs to be connected to the +VIN connection terminal and
the positive terminal for the lamp. The negative terminal connects to the
channel. When the I/O 24 module the connection to the lamp activates the
channel will go low causing the lamp to turn on. The circuit can be modified to
activate relays, solenoids etc.

3.2.1.4.APPLICATIONS:

• Power Switching
• On/Off Control
• Home Automation
• Relays, Motors
• Solenoids, Solenoid valves
• Lamps etc

23
3.2.2 ULN2003
3.2.2.1 INTRODUCTION
The ULN2003 is a monolithic high voltage and high current Darlington
transistor arrays. It consists of seven NPN Darlington pairs that feature high-
voltage outputs with common-cathode clamp diode for switching inductive
loads. The collector-current rating of a single Darlington pair is 500mA. The
Darlington pairs may be paralleled for higher current capability. Applications
include relay drivers, hammer drivers, lamp drivers, display drivers (LED gas
discharge), line drivers, and logic buffers.
The ULN2003 has a 2.7kW series base resistor for each Darlington pair
for operation directly with TTL or 5V CMOS devices.
Ideally suited for interfacing between low-level logic circuitry and
multiple peripheral power loads, the Series ULN2003 high-voltage, high-current
Darlington arrays feature continuous load current ratings to 500 mA for each of
the seven drivers.
At an appropriate duty cycle depending on ambient temperature and
number of drivers turned ON simultaneously, typical power loads totaling over
230 W (350 mA x 7, 95 V) can be controlled. Typical loads include relays,
solenoids, stepping motors, magnetic print hammers, multiplexed LED and
incandescent displays, and heaters. All devices feature open-collector outputs
with integral clamp diodes. The ULN2003A/L and ULN2023A/L have series
input resistors selected for operation directly with 5 V TTL or CMOS.
These devices will handle numerous interface needs — particularly those
beyond the capabilities of standard logic buffers. The ULN2004A/L and
ULN2024A/L have series input resistors for operation directly from 6 to 15 V
CMOS or PMOS logic outputs.

24
The ULN2003A/L and ULN2004A/L are the standard Darlington arrays.
The outputs are capable of sinking 500 mA and will withstand at least 50 V in
the OFF state. Outputs may be paralleled for higher load current capability. The
ULN2023A/L and ULN2024A/L will withstand 95 V in the OFF state.
These Darlington arrays are furnished in 16-pin dual in-line plastic
packages (suffix “A”) and 16-lead surface-mountable SOICs (suffix “L”). All
devices are pinned with outputs opposite inputs to facilitate ease of circuit board
layout. All devices are rated for operation over the temperature range of -20°C to
+85°C. Most (see matrix, next page) are also available for operation to -40°C; to
order, change the prefix from “ULN” to “ULQ”.

3.2.2.2 PIN DIAGRAM:

SCHEMATIC (EACH DARLINGTON PAIR)

25
LOGIC DIAGRAM:

3.2.2.3 OPERATION:
The output of microcontroller is not enough to drive the devices. So we
need some external drivers to drive the devices, that means the output current of
the microcontroller is 25mA, why we use this driver circuit means actually a
small dc motor current rating is 100mA .Here the ULN2003 is give the constant
current rating to the dc motor. The current rating level is 100mA. This
ULN2003 is used to drive up to 500mA level.

3.2.2.4 FEATURES:
 500mA rated collector current (Single output)
 High-voltage outputs: 50V
 Inputs compatible with various types of logic.
 Relay driver application.
 Transient-Protected Outputs

26
 Dual In-Line Plastic Package or Small-Outline IC Package.
3.3 RELAY SECTION

3.3.1 INTRODUCTION

A relay is an electrically operated switch. Many relays use an


electromagnet to operate a switching mechanism, but other operating principles
are also used. Relays find applications where it is necessary to control a circuit
by a low-power signal, or where several circuits must be controlled by one
signal. The first relays were used in long distance telegraph circuits, repeating
the signal coming in from one circuit and re-transmitting it to another. Relays
found extensive use in telephone exchanges and early computers to perform
logical operations. A type of relay that can handle the high power required to
directly drive an electric motor is called a contactor. Solid-state relays control
power circuits with no moving parts, instead using a semiconductor device to
perform switching. Relays with calibrated operating characteristics and
sometimes multiple operating coils are used to protect electrical circuits from
overload or faults; in modern electric power systems these functions are
performed by digital instruments still called "protection relays".

When an electric current


is passed through the coil, the
resulting magnetic field attracts the armature and the consequent movement of
the movable contact or contacts either makes or breaks a connection with a
fixed contact. If the set of contacts was closed when the relay was De-

27
energized, then the movement opens the contacts and breaks the connection,
and vice versa if the contacts were open.

When the current to the coil is switched off, the armature is returned by a
force, approximately half as strong as the magnetic force, to its relaxed position.

3.3.2 Relay Operation

When a current flows through the coil, the resulting magnetic field attracts
an armature that is mechanically linked to a moving contact.

The movement either makes or breaks a connection with a fixed contact.


When the current to the coil is switched off, the armature is returned by a force
approximately half as strong as the magnetic force to its relaxed position.
Usually this is a spring, but gravity is also used commonly in industrial motor
starters. Most relays are manufactured to operate quickly. In a low voltage
application, this is to reduce noise. In a high voltage or high current application,
this is to reduce arcing.

If the coil is energized with DC, a diode is frequently installed across the
coil, to dissipate the energy from the collapsing magnetic field at deactivation,
which would otherwise generate a spike of voltage and might cause damage to
circuit components. If the coil is designed to be energized with AC, a small
copper ring can be crimped to the end of the solenoid. This "shading ring"
creates a small out-of-phase current, which increases the minimum pull on the
armature during the AC cycle.

By analogy with the functions of the original electromagnetic device, a


solid-state relay is made with a thruster or other solid-state switching device. To
achieve electrical isolation, a light-emitting diode (LED) is used with a
phototransistor.

28
3.3.3 Applications

 Control a high-voltage circuit with a low-voltage signal, as in some


types of modems or audio amplifiers.

 Control a high-current circuit with a low-current signal, as in the


starter solenoid of an automobile.

 Detect and isolate faults on transmission and distribution lines by


opening and closing circuit breakers (protection relays)

 Isolate the controlling circuit from the controlled circuit when the
two are at different potentials, for example when controlling a
mains-powered device from a low-voltage switch. The latter is
often applied to control office lighting as the low voltage wires are
easily installed in partitions, which may be often moved as needs
change. Room occupancy detectors may also control them in an
effort to conserve energy,

 Logic functions. For example, the Boolean AND function is


realized by connecting normally open relay contacts in series, the
OR function by connecting normally open contacts in parallel. The
changeover or Form C contacts perform the XOR (exclusive or)
function. Similar functions for NAND and NOR are accomplished
using normally closed contacts. The Ladder programming language
is often used for designing relay logic networks.

29
8. PROGRAM:

#include<reg52.h>
#include<stdio.h>
#define FS 0x38 //Function Set: 8-bit, 2 Line, 5x7 Dots
#define DONCON 0x0E //Display on Cursor on
#define EM 0x06 //Entry Mode
#define DOFCOF 0x08 //Display Off Cursor Off (clearing display
without clearing DDRAM content)
#define DONCOF 0x0C //Display on Cursor off
#defineDONCB 0x0F //Display on Cursor blinking
#define SEDL 0x18 //Shift entire display left
#define SEDR 0x1C //Shift entire display right
#define MCLBOC 0x10 //Move cursor left by one character
#define MCRBOC 0x14 //Move cursor right by one character
#define CD 0x01 //Clear Display (also clear DDRAM
content)
sbit option1 = P2^7;
sbit option2 = P2^6;
sbit speed1 = P1^0;
sbit speed2 = P1^1;
sbit speed3 = P1^3;
sbit onoff = P2^5;

30
sbit lcd_rs = P3^5;
sbit lcd_rw = P3^6;
sbit lcd_en = P3^7;
void delay(unsigned long count);
void transmit_d(unsigned char *P);
void transmit(unsigned char *P);
void transmit1(unsigned char *P);
void introut(void);
unsigned char data serialdata;
unsigned char code att[]={"AT"};
unsigned char code setsms[]={"AT+CSMS=0"};
unsigned char code setmem[]={"AT+CPMS=\"SM\""};
unsigned char code setmod[]={"AT+CMGF=1"};
unsigned char code mes_indicate[]={"CMTI"};
//{"AT+CMGR=1"}; CMTI: "SM",2
unsigned char code read[]={"AT+CMGR=1"};
unsigned char code delet1[]={"AT+CMGD=1"};
unsigned char code delet2[]={"AT+CMGD=2"};
unsigned char code delet3[]={"AT+CMGD=3"};
unsigned char code l1on[]={"LT1ON"};
unsigned char code l1of[]={"LT1OF"};
unsigned char code l2on[]={"LT2ON"};
unsigned char code l2of[]={"LT2OF"};
unsigned char code spds[]={"SPDSL"};
unsigned char code spdm[]={"SPDME"};
unsigned char code spdo[]={"SPDOF"};
unsigned char code spdf[]={"SPDFA"};
unsigned char code low[]={" POWER TRIP DUE TO LOW VOLTAGE "};
unsigned char code high[]={" POWER TRIP DUE TO HIGH VOLTAGE "};

31
unsigned char code light1on[]={" YOUR LIGHT1 WAS ON "};
unsigned char code light1of[]={" YOUR LIGHT1 WAS OFF "};
unsigned char code light2on[]={" YOUR LIGHT2 WAS ON "};
unsigned char code light2of[]={" YOUR LIGHT2 WAS OFF "};
unsigned char code slow[]={" YOUR MOTOR RUNS IN 25 RPM "};
unsigned char code medium[]={" YOUR MOTOR RUNS IN 60 RPM "};
unsigned char code off[]={" YOUR MOTOR IS OFF "};
unsigned char code fast[]={" YOUR MOTOR RUNS IN 90 RPM "};
unsigned char code sendnum[]={"AT+CMGS=\"9790367571\""};
unsigned char data temp[30];
bit comp_bit=0;
unsigned char bit1=0;
unsigned char bit2=0;
unsigned char bit3=0;
int i,j;
unsigned char data z;
void transmit_d(unsigned char *p) //FUNCTION TO TRANSMIT DATA
{
unsigned char i;
TR1=1; // TIMER1 RUN
for(i=0;*p!='\0';i++)
{
SBUF=*p; // SEND THE ARRAY 'TEMP'
*p++;
while(TI==0)
{}
TI=0;
}
SBUF=0X0D; // INDICATE END OF COMMAND

32
TR1=0;
delay(4000);
}
void transmit1(unsigned char *p) // FUNCTION TO TRANSMIT DATA
{
unsigned char i;
TR1=1; // TIMER1 RUN
for(i=0;*p!='\0';i++)
{
SBUF=*p; // SEND THE ARRAY 'TEMP'
*p++;
while(TI==0)
{}
TI=0;
}
SBUF=0X1A; // INDICATE END OF MESSAGE 'ctrl+z'
TR1=0;
delay(4000);
}
void sendsms(void)
{
transmit_d(setsms);
transmit_d(setmod);
transmit_d(sendnum);
}
void sendsms1(void)
{
transmit_d(setsms);
transmit_d(setmod);

33
}
void delay(unsigned long count)
{
unsigned long int i;
for(i=0;i<count;i++);
}
void receive()
{
TR1=1;
while(RI==0) {}
serialdata=SBUF; // COPY TO 'serialdata'
RI=0; TR1=0;
}
void receive1(unsigned char n)
{
unsigned char i;
TR1=1;
for(i=0;i<n;i++)
{
while(RI==0) {}
temp[i]=SBUF; // COPY TO 'temp'
RI=0;
}
TR1=0;
temp[i]='\0';
}
void str_cpy(unsigned char *p,unsigned char *p1)
{
while(*p1!='\0')

34
{
*p=*p1;
*p++;*p1++;
}
p='\0';
}
str_comp(unsigned char *p,unsigned char *p1)
{
comp_bit=0;
while(*p1!='\0')
{
if(*p==*p1)comp_bit=1;
else
{
comp_bit=0;
break;
}
*p++;*p1++;
}
return (comp_bit);
} //char temp[25]= "LCD TEST PROGRAM SUCCESS";
void lcd_cmd (unsigned char value)
{ //lcd command
lcd_rs=0; lcd_rw=0; lcd_en=0;
P0 = value;
lcd_en=1;
delay(200);
lcd_en=0;
} // end of lcd_cmd

35
void lcd_dat (unsigned char value)
{ // send lcd data
lcd_rs=1; lcd_rw=0; lcd_en=0;
P0 = value;
lcd_en=1;
delay(200);
lcd_en=0;
} // end of lcd_dat

void init_lcd ()
{
/* following sequence is essential for initialization of lcd*/
lcd_cmd(FS);
delay(50);
lcd_cmd(FS);
delay(6);
lcd_cmd(FS);
delay(1500);
lcd_cmd(DOFCOF); //display off
lcd_cmd(DONCOF); //display on
lcd_cmd(EM); //entry mode set
} // end of init_lcd

void disp_lcd (char str[])


{
unsigned char j ;
lcd_cmd(0x80) ; // display off
for(j = 0 ; j < 16 ; j ++) // first line
{

36
lcd_dat(str[j]) ; // data to lcd
}
lcd_cmd(0xc0) ; // display on
for(j = 16 ; j < 32 ; j ++) // second line
{
lcd_dat(str[j]) ; // data to lcd
}
} // end of disp_lcd
/* You can copy all above functions and use it in your program as
demonstrated here */
/* end of LCD functions */

void ext0_IT() interrupt 0


{
onoff=0;
option1=option2=0;
disp_lcd(" POWER TRIP DUE TO LOW VOLTAGE ") ;
// display the string on LCD
delay(3000);
sendsms(); transmit1(low); delay(40000);
}
void ext1_IT() interrupt 2
{
onoff=0;
option1=option2=0;
disp_lcd(" POWER TRIP DUE TO HIGH VOLTAGE ") ;
// display the string on LCD
delay(3000);
sendsms(); transmit1(high); delay(40000);

37
}
void main()
{
P1=0x00;
P2=0x00;
SP=0x40;
TMOD=0x20;
TH1=0xFD;
SCON=0x50;
TR1=1;
init_lcd() ; // initialize LCD
disp_lcd(" GSM BASED DEVICE CONTROL ") ; // display the string on LCD
delay(3000);
EX0 = 1;
EX1 = 1;
EA = 1;
transmit_d(att);transmit_d(att);
transmit_d(att);delay(5000);
transmit_d(delet1);delay(5000);
transmit_d(delet2);delay(5000);
speed3=0;speed2=0;speed1=0;
while(1)
{
transmit_d(att);
transmit_d(att);
transmit_d(delet1);delay(5000);
transmit_d(delet2);delay(5000);
receive();
while(serialdata!='+') receive();

38
receive1(5);
str_comp(temp,mes_indicate);delay(4000);
if(comp_bit==1)
{
delay(10000);
transmit_d(read);
receive();
while(serialdata!=0x0A) receive();receive();
while(serialdata!=0x0A) receive();
receive1(5);
delay(5000); transmit_d(temp);
str_comp(temp,l1on);
if(comp_bit==1)
{
option1=1;
disp_lcd(" DEVICE STATUS LIGHT1 WAS ON ") ;
// display the string on LCD
delay(3000);
sendsms(); transmit1(light1on); delay(10000);
}
else
{
str_comp(temp,l1of);
if(comp_bit==1)
{
option1=0;
disp_lcd(" DEVICE STATUS LIGHT1 WAS OFF ") ;
// display the string on LCD
delay(3000);

39
sendsms(); transmit1(light1of); delay(10000);

else
{
str_comp(temp,l2on);
if(comp_bit==1)
{
option2=1;
disp_lcd(" DEVICE STATUS LIGHT2 WAS ON ") ;
// display the string on LCD
delay(3000);
sendsms(); transmit1(light2on); delay(10000);
}
else
{
str_comp(temp,l2of);
if(comp_bit==1)
{
option2=0;
disp_lcd(" DEVICE STATUS LIGHT2 WAS OFF ") ;
// display the string on LCD
delay(3000);
sendsms(); transmit1(light2of); delay(10000);
}
else
{

40
str_comp(temp,spds);
if(comp_bit==1)
{
onoff=1;delay(500);
speed1=1;speed2=speed3=0;
disp_lcd(" SPEED STATUS 25 RPM ") ;
// display the string on LCD
delay(3000);
sendsms(); transmit1(slow); delay(10000);
}
else
{
str_comp(temp,spdo);
if(comp_bit==1)
{onoff=0;delay(500);
disp_lcd(" MOTOR OFF ") ; // display the string on LCD
delay(3000);
sendsms(); transmit1(off); delay(10000);
}
else
{
str_comp(temp,spdm);
if(comp_bit==1)
{
onoff=1;delay(500);
speed2=1;speed1=speed3=0;
disp_lcd(" SPEED STATUS 60 RPM");// display the string on LCD
delay(3000);
sendsms(); transmit1(medium); delay(10000);

41
}
else
{
str_comp(temp,spdf);
if(comp_bit==1)
{
onoff=1;delay(500);
speed3=1;speed2=speed1=0;
disp_lcd(" SPEED STATUS 90 RPM") ;//display the string on LCD
delay(3000);
sendsms(); transmit1(fast); delay(10000);
//sendsms1(); transmit1(fast); delay(10000);
}
} }}}}
delay(5000);
}
else
{
transmit_d(delet1);delay(5000);
transmit_d(delet2);delay(5000);
transmit_d(delet3);delay(5000);
}
}
}

42
6. LCD DISPLAY(Liquid Crystal Display)

DESCRIPTION
The JHD162A dot-matrix liquid crystal display controller and driver LSI
displays alphanumeric, and symbols. It can be configured to drive a dot-matrix
liquid crystal display under the control of a 4- or 8-bit microprocessor. Since all
the functions such as display RAM, character generator, and liquid crystal
driver, required for driving a dot-matrix liquid crystal display are internally
provided on one chip, a minimal system can be interfaced with this
controller/driver.
A single JHD162A can display up to one 8-character line or two 8-
character lines.
The JHD162A character generator ROM is extended to generate 208 5X8
dot character fonts and 32 5X10 dot character fonts for a total of 240 different
character fonts.
The low power supply (2.7V to 5.5V) of the JHD162A is suitable for any
portable battery-driven product requiring low power dissipation.

Features
 5 x 8 and 5 x 10 dot matrix possible
 Low power operation support:
 2.7 to 5.5V
 Wide range of liquid crystal display driver power

43
 3.0 to 11V
 Liquid crystal drive waveform
 A (One line frequency AC waveform)
 Correspond to high speed MPU bus interface
 2 MHz (when VCC = 5V)
 4-bit or 8-bit MPU interface enabled
 80 x 8-bit display RAM (80 characters max.)
 9,920-bit character generator ROM for a total of 240 character fonts
 208 character fonts (5 x 8 dot)
 32 character fonts (5 x 10 dot)

BLOCK DIAGRAM

DB0
DB7 LCD SEG80
DB7 CONTROLLER IC
RS
R/
WE
VSS COM16 LCD PANEL
VDD 16 CHARACTERS X 2 LINES
VO

Data can be written to the LCD only on the falling edge of the enable pin.
Thismeans that the data will displayed only after the enable pin is taken high and
then taken low. This must be repeated for each data or command that is sent to
the LCD.

44
It is necessary to use delays between sending each instruction. This is
necessary, since if the second instruction arrives while the first one is still being
executed, then the execution time will far exceed the normal execution time.
The LCD provides a busy flag, which indicates whether the LCD is busy
performing an operation or whether it is ready to accept instructions.
This method can be used instead of using delay loops, since delay provided is
random at most and not optimized.

PIN DETAILS:
Pin
Symbol Level Description
NO.
1 VSS 0V Ground
2 VDD 5.0V Supply voltage for logic
3 VO --- Input voltage for LCD
4 RS H/L H : Data, L : Instruction code
5 R/W H/L H : Read mode, L : Write mode
6 E H, H  L Chip enable signal
7 DB0 H/L Data bit 0
8 DB1 H/L Data bit 1
9 DB2 H/L Data bit 2
10 DB3 H/L Data bit 3
11 DB4 H/L Data bit 4
12 DB5 H/L Data bit 5
13 DB6 H/L Data bit 6
14 DB7 H/L Data bit 7
15 NC --- No Connection

45
16 NC --- No Connection
INTERFACE PIN CONNECTIONS:

The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines.
The number on data lines depends on the mode of operation. If operated in 8-bit
mode then 8 data lines + 3 control lines i.e. total 11 lines are required. And if
operated in 4-bit more than 4 data lines + 3 control lines i.e. 7 lines are required.
How do we decide which mode to use? It’s simple if you have sufficient data
lines you can go for 8 bit mode & if there is a time constrain i.e. display should
be faster then we have to use 8-bit mode because basically 4-bit mode takes
twice as more time as compared to 8-bit mode.

When RS is low (0), the data is to be treated as a command. When RS is


high (1), the data being sent is considered as text data which should be displayed
on the screen.

When R/W is low (0), the information on the data bus is being written to
the LCD. When RW is high (1), the program is effectively reading from the

46
LCD. Most of the times there is no need to read from the LCD so this line can
directly be connected to Gnd thus saving one controller line.

The ENABLE pin is used to latch the data present on the data pins. A
HIGH - LOW signal is required to latch the data. The LCD interprets and
executes our command at the instant the EN line is brought low. If you never
bring EN low, your instruction will never be executed.

7. MAX232:

INTRODUCTION:

The MAX 232 is a dual RS-232 receiver/transmitter that meets all EAI
RS232c specifications whole using only a +5v power supply. It has 2 onboard
charge pump voltage converter which generate +10v and -10v power supplies
from a single 5v power supply. It has four level translators, two of which are
RS232 transmitters that converter TTL\CMOS input levels into +9V RS232
outputs. The other two level translators are RS232 receiver that convert RS232
inputs to 5V. TTL\CMOS output level. It is a serial communicating device it is
used to is the convert TTL Logic (Transistor Transistor Logic) to
CMOS(Complementary Metal-Oxide Semiconductor) Logic.

The MAX232 device is a dual driver/receiver that includes a capacitive


voltage generator to supply EIA-232 voltage levels from a single 5-V
supply.Each receiver converts EIA-232 inputs to 5-V TTL/CMOS levels. These
receivers have a typical threshold of 1.3 V and a typical hysteresis of 0.5 V, and
can accept ±30-V inputs. Each driver converts TTL/CMOS input levels into
EIA-232 levels.
The MAX232 is characterized for operation from 0°C to 70°C. The
MAX232I is characterized for operation from –40°C to 85°C.

47
CAPACITOR VALUE
PIN.NO NAME PURPOSE SIGNAL VOLTAGE
OF MAX232

+ connector for capacitor should stand at


1 C1+ 1µF
capacitor C1 least 16V

output of voltage +10V, capacitor should


2 V+ 1µF to VCC
pump stand at least 16V

- connector for capacitor should stand at


3 C1- 1µF
capacitor C1 least 16V

+ connector for capacitor should stand at


4 C2+ 1µF
capacitor C2 least 16V

- connector for capacitor should stand at


5 C2- 1µF
capacitor C2 least 16V

output of voltage -10V, capacitor should


6 V- 1µF to GND
pump / inverter stand at least 16V

7 T2out Driver 2 output RS-232

8 R2in Receiver 2 input RS-232

9 R2out Receiver 2 output TTL

10 T2in Driver 2 input TTL

11 T1in Driver 1 input TTL

12 R1out Receiver 1 output TTL

13 R1in Receiver 1 input RS-232

14 T1out Driver 1 output RS-232

15 GND Ground 0V 1µF to VCC

48
16 VCC Power supply +5V see above

PIN DIAGRAM OF MAX232


PIN DETAIL:

FEATURES OF MAX 232:

 Operates With Single 5-V Power Supply


 Two Drivers and Two Receivers
 ±30-V Input Levels
 Low Supply Current 8 mA Typical
 Designed to be Interchangeable With
 Maxim MAX232
 Battery-Powered Systems

49
9.PRINCIPLE OF OPERATION:
Our project consists of three sections the first section is ON/OFF
control, the second section is speed control and the last section is power tripping
circuit.

ON/OFF control and speed control are having individual unique code.
Here the working of power tripping circuit is depends upon the input voltage
level.

Actually we did this project in house hold application, so the normal input
voltage level is 230V. Whenever the input voltage level is crossing the limits,
below170V or above 250V that time the power tripping circuit is trip the total
power supply.

ON/OFF control and the speed control sections are controlled by sending
a sms through mobile phone by using GSM (Global System For Mobile)
communication. Here the GSM device is act as a transmitter/receiver circuit. It is
activated by external power supply.

One of the key features of GSM is the Subscriber Identity Module (SIM),
commonly known as a SIM card. The SIM is a detachable smart card containing
the user's subscription incodeion and phonebook. This allows the user to retain
his or her incodeion after switching handsets. Alternatively, the user can also
change operators while retaining the handset simply by changing the SIM.

The 8051 microcontroller is used for main serial communication device.


The data’s are transferred between GSM and microcontroller through max232.

50
Here the mobile phone and the GSM device are working in digital I/O.
Actually GSM device is working in ASCII and Hexa code. But the data’s are
transferred from mobile phone to GSM in ASCII code because of easy to
understand.

But the microcontroller is working in binary code. Here the binary code is
converted from ASCII code by GSM.

All the control operations have been done by predefined program which is
available in the microcontroller.

ON/OFF CONTROL EXECUTION:

In this operation the sms will be transferred from mobile to GSM and GSM
to MICROCONTROLLER vice versa. Then the MICROCONTROLLER will
compare the status of received SMS with predefined program which has been
accumulated already. If both the unique codes are same the ON/OFF control will
be executed.

SPEED CONTROL EXECUTION:

This section consists three types of speed controls (low, medium, high),
having individual unique codes. The sms will be passed from mobile phone to
GSM and then GSM will transfer it to MICROCONTROLLER. The
MICROCONTROLLER will compare the status of received SMS with
predefined program and speed control will be executed when the comparisons
are same.

51
10.CONCLUSION:

The main scope of this project is VERY innovative. Under present days
the electrical devices are controlled by using switches and remote control. It is
an attempt the electrical devices are controlled by sending a sms through
mobile phone by using GSM (Global service for mobile) communication device.
This is very useful to develop the knowledge about the communication devices.
So, we can implement this project in commercial purpose.

52
11. BIBLIOGRAPHY:

1. “Applied Electronics” by R.S.Sedha, S.Chand &company Ltd.

2. Details of 8051 microcontroller & Embedded systems, Muhammad Ali


Mazidi, Pearson education. & www.8051projects.net.

3. Hardware & Software of 8051 microcontroller by William Kleitz,


Pearson Education.

4. Electronics Instrumentation by H.S.Kalshi, Tata Mc Grawhill.

5. Programming in embedded ‘c’ By David E.Simon, pearson Education.

6. Linear integrated circuits by D.Roy Chodhary, Shile B.Jani.

7. www.data sheet4u.com& www.Alldatasheet.com.

53

You might also like