0% found this document useful (0 votes)
97 views76 pages

Enjoy Free Life... Cos You Wont Get It Back..... : Sunday, October 31, 2010

This paper discusses the design and implementation of GSM based home control, a smart home application for remote monitoring and control home devices via messaging services of the cellular networks. Current smart home devices can be accessed by its remote control, within a limited coverage span of a personal area network, normally at around a 100m radius. In utilizing a mobile device, the access coverage of a home device will be rendered virtually limitless, increasing convenience and opening doors of Potential advancements in smart home technologies.

Uploaded by

Siddardha Reddy
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views76 pages

Enjoy Free Life... Cos You Wont Get It Back..... : Sunday, October 31, 2010

This paper discusses the design and implementation of GSM based home control, a smart home application for remote monitoring and control home devices via messaging services of the cellular networks. Current smart home devices can be accessed by its remote control, within a limited coverage span of a personal area network, normally at around a 100m radius. In utilizing a mobile device, the access coverage of a home device will be rendered virtually limitless, increasing convenience and opening doors of Potential advancements in smart home technologies.

Uploaded by

Siddardha Reddy
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 76

sunday, october 31, 2010

Enjoy free life...cos you wont get it back.....


Posted by  remesh viswanath  at  6:59 PM  0 comments  Links to this post

Reactions: 
thursday, march 4, 2010

gsm based home automation -ma project


ACHNOWLEDGEMENT

We, the project batch takes this opportunity to express our heart felt gratitude and thanks to the head
of Department of ELECTRONICS AND INSTRUMENTATION Mr.Arun C.A for his valuable help and

guidance in order to complete this project.

We express our sincere thanks to all the staff of the Department Mr.Ramesh T.M (lecturer); Mrs.Raji

M.P (lecturer); Mrs. Sathyabhama N.R (lecturer) and all other staffs for their help encouragement and

active participation in this project.

We are also indebted to all our friends who have given their valuable help in the completion of this

project.

With affection regards,

ABSTRACT
In this paper, we discuss the design and implementation of GSM based home control, a smart home

application for remote monitoring and control home devices via messaging services of the cellular

networks. Current smart home devices can be accessed by its remote control, within a limited

coverage span of a personal area network, normally at around a 100m radius. In utilizing a mobile

device, the access coverage of a smart home device will be rendered virtually limitless, increasing

convenience and opening doors of Potential advancements in smart home technologies.

CONTENTS

Introduction……………………………………………………………………..4

Objective……………………………………………………………….……5

Scope of the project…………………………………………………………6


Block diagram…………………………………………………………………..7

Block explanation…………………………………………………….…………8

Microcontroller…………………………………………………………………11

GSM module…………………………………………………………………..32

Power supply…………………………………………………………………..34

Design………………………………………………………………….………35

1. Hardware design

Circuit diagram…………………………………………………………..36

PCB layout…………………………………………………………….…38

PCB fabrication …………………………………………………………39

Soldering………………………………………………………………...40

2. Software design

Flowchart……………………………………………………….………...42

Program code…………………………………………………….………45

Cost estimate………………………………………………………………….50

Conclusion……………………………………….……………………………51

Bibliography…………………………………………………………………..52
Data sheets……………………………………………………………………53

INTRODUCTION
1.1 OBJECTIVE

1.2 SCOPE OF THE PROJECT


1.1 OBJECTIVE

Recently home automation product for intelligent home is increasingly getting very common. By the

help of home automation technologies life has been becoming easier.

With the widespread application of the mobile networking technologies, the term ‘smart home’ is no

longer alien to us as it was a few years ago. Alternatively referred to as Intelligent Homes, Automated

Homes and several other terminologies over the years, the term smart homes simply indicates the

automation of daily chores with reference to the equipments in the house. To this end, in this paper,

we present the design and implementation of a project “GSM BASED HOME AUTOMATION”

GSM based control of smart home devices via cellular access networks. The design intends to rely on
cheap and commercially available devices and services.

This project is to design and develop a home automation that control our home appliance through

mobile. The project is done using Microchip’s microcontroller PIC 16F877 .This has very much

influence in our current and future life. The concept of smart home is an emerging issue to the

modern technology dependent society. 

1.2 SCOPE OF THE PROJECT

The project “GSM BASED HOME CONTROL” is intended to automate the certain functions of home

appliances. The main scope of this project is that we can control our home from anywhere in the world

where gsm network is available. , Automated Homes and several other terminologies over the years,

the term smart homes simply indicates the automation of daily chores with reference to the

equipments in the house. This could be simple remote control of lights or more complex

functionalities. Smart home technologies have been around for about 30 years, mostly relying on

some proprietary technologies and applications. With the recent expansion of communication

networks, smart home applications can be further enhanced with new dimension of capabilities that

were not available before. In particular, wireless access technologies will soon enable exotic and

economically feasible applications.

The device is much helpful in controlling home. It reduces the wastage of valuable time and our daily

life become easier and flexible.


BLOCK DIAGRAM

2.1 CONTROLLER

2.2 GSM MODULE

2.3 POWER SUPPLY

2.4 HOME APPLIANCE


BLOCK DIAGRAM

2.0 BLOCK EXPLANATION

The above figure shows the block diagram of gsm home control device. This device is a useful device

which can convert home to smart home. The main blocks of the project are controller, gsm module

and home appliance.

2.1 Controller
Controller is the heart of the system, it controls the entire unit. The controller we use is PIC16F72 of

the MICROCHIP company . Now a days most commonly used microcontroller is PIC .These

microcontroller have three ports,2K RAM and 148 ROM.

2.2. GSM module

A GSM modem is a specialized type of modem which accepts a SIM card, and operates over a

subscription to a mobile operator, just like a mobile phone. From the mobile operator perspective, a

GSM modem looks just like a mobile phone.

A GSM modem can be a dedicated modem device with a serial, USB or Bluetooth connection, (here we

use serial connection) or it may be a mobile phone that provides GSM modem capabilities.

A GSM modem exposes an interface that allows applications such as NowSMS to send and receive

messages over the modem interface. The mobile operator charges for this message sending and

receiving as if it was performed directly on a mobile phone. To perform these tasks, a GSM modem

must support an "extended AT command set" for sending/receiving SMS messages. A GSM modem

could also be a standard GSM mobile phone with the appropriate cable and software driver to connect

to a serial port or USB port on your computer. Any phone that supports the "extended AT command

set" for sending/receiving SMS messages can be supported by the Now SMS/MMS Gateway. Note that

not all mobile phones support this modem interface.

Nokia phones that use the S60 (Series 60) interface, which is Symbian based, only support sending

SMS messages via the modem interface, and do not support receiving SMS via the modem interface.

Nokia phones using the Series 40 3rd Generation or later interface have similar limitations and do not

support receiving SMS via the modem interface. This makes most Nokia phones incompatible with the

2-way SMS functionality of Now SMS.

SonyEricsson phones generally have a good full GSM modem implementation (except for the P and X
series which use UIQ/Symbian or Windows Mobile).

2.3 Power Supply

Power supply is used to give sufficient power to the microcontroller. A step down transformer and a

bridge rectifier is used here to convert AC to DC. A regulator IC is also used here to give constant

supply.7805 IC is used for power supply and it is connected to the bridge rectifier.

2.4 Home appliance 

Home appliances are basically the electronic devices used in home which is to be controlled by gsm

device. It can be a heater, motor, lights, fan, fridge, electronic lock, etc…

2.1 MICROCONTROLLER

2.1.1MICROCONTROLLERS AND MICROPROCESSORS


The contrast between a Microprocessor and Microcontroller is best exemplified by the fact that most

microprocessors have many opcodes for moving data from external memory to CPU; Microcontroller

have one or two.

Microprocessor may have one or two types of bit handling instructions; Microcontroller will have

many. Microprocessors are concerned with rapid movement of code and data from external address to

the chip. Microprocessor must have many additional parts to be optional. Micro controllers can

function as a computer with addition of no external digital parts.

Microprocessors are intended to be general-purpose digital computer where as Microcontroller are

intended to be special purpose digital controllers. Microprocessors contain a CPU, memory, addressing

circuits and interrupt handling data. Micro controllers have these features as well as timers, parallel

and serial I\O, Internal RAM and ROM.

INTRODUCTION TO EMBEDDED SYSTEMS

Embedded system is any electronic equipment built in intelligence and dedicated software. All

embedded systems use either a microprocessor or a microcontroller. The application of these micro

controllers makes user-friendly cheaper solutions and enables to add features otherwise impossible to

provide by other means.


Embedded devices can be defined as any devices with a microprocessor or microcontroller embedded

in it that has a relatively focused.

functionality. The software for the Embedded System is called firmware. The firmware is written in

Assembly language for time or resource critical operation or using higher-level languages like C or

Embedded C. The software will be simultaneously micro code simulations for the largest processor.

Since they are supported to perform only specific task, these programs are stored in Read Only

Memories (ROMs). Moreover they may need no or minimal inputs from the user, hence the user

interface like monitor, mouse & large keyboard etc. may be absent.

Embedded system are also known as Real time Systems since they respond to an input or event and

produce the result within the guaranteed time period. This time period can be a few microseconds to

days or months.

Embedded system developments:

In the development of Embedded System application the hardware and software must go hand in

hand. The software created by the software engineers must be burnt into or micro coded into the

hardware or the micro controller produced by VLSI engineers. The micro controller and the software

micro coded in it together form the system for the particular application.
The software program for real time system is written either in assembly or high-level language such

as C. The assembly language is used in the case of some critical applications. Now day’s high-level

languages replace most of the assembly language constructs.

EMEBEDDED SYSTEM MARKETS

Embedded technology is present in almost every electronic device we use today. There is embedded

software inside the cellular phone, automobiles and thermostat in air conditioners, industrial control

equipments and scientific & medical equipments, defense uses communication satellites etc.

Embedded technology thus covers a broad range of products of which generalization is difficult.

The embedded intelligence can be found in five broad markets. The first is consumer segment, which

includes home appliances and entertainment equipment. The second is automotive segment-where a

modern car has nearly 50 micro controllers providing intelligence and control, like keyless entry,

antilock braking and air bags. The third is office automation, which includes PCs, keyboards, copiers

and printers. The fourth market, telecommunications, includes cellular phones, pagers and answering

machines.

ADVANTAGES OF EMBEDDED SYSTEM


Higher Performance: The integration of various ICs shortens the traveling route and time of data to

be transmitted resulting in higher performance. 

Lower Power Consumption: The integration of various ICs eliminates buffers and other interface

circuits. As the number of components is reduced, less power will be consumed. 

Slimmer and more compact: Housed in a single separate package, the chip is smaller in size and

therefore occupies less space on the PCB. Hence products using embedded system are slimmer and

more compact.

Reduced design and development: The system on a chip provides all functionality required by the

system. System designers need not worry about the basic function the system-right from the

beginning of the basic phase, they can focus on the development features. As a result, the time

spends on research and development is reduced and this in turn reduces the time to market of their

products.

Lower system costs: In the past, several chips in separate packages where required to configure a

system. Now, just one system on-chip can replace all of these, dramatically reducing the packaging

cost.

There are many MCU manufacturers. To understand apply general concepts, it is necessary to study

one type in detail. In our project, we use PIC series IC PIC16F877 from MICROCHIP.
PIC16F877 microcontroller

PIC micro controllers are low-cost computers-in-a-chip; they allow electronics designers and hobbyists

add intelligence and functions that mimic big computers for almost any electronic product or project. 

The programming of the system is done using a PIC micro controller 16F877. This powerful (200

nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS

FLASH-based 8-bit micro controller packs Microchip's powerful PIC® architecture into a 40-pin

package and is upwards compatible with the PIC16C5X, PIC12CXXX and PIC16C7X devices. It is has

five ports. I.e. port A, port B, port C, port D, port E. The PIC 16F877 has flash memory of 8K and Data

memory of 368 bytes Data EEPROM of 256 bytes. 


WHY PIC IS USED?

• Speed

• High Performance RISC CPU

• Instruction Set Simplicity

• Integration Of Operation Features

• Programmable Timer Options

• Interrupt Control

• EPROM/OTP/ROM Options
• Inbuilt Modules

• Low Power Consumption

• Wide Operation Voltage Range :2.5to 6.0 Volt

• Programmable Code Protection Mode

• Power Saving Sleep Mode


PIC 16F877A- FEATURES

• High performance CPU

• Only 35 instructions

• All single cycle instruction except for program branches. Operating speed DC-20MHz,clock i/p DC-

200ns instruction cycles

• Up to 8Kx14 word of flash memory

• Up to 368x8 bytes of data memory

• Up to 256x8 bytes of EEPROM data memory

• Interrupt compatibility

• Power on reset

• Power up timer and oscillator start up timer

• Watch dog timer with its own chip RC oscillator for reliable operation

• Programmable code protection power saving SLEEP mode

• Low power, high speed CMOS FLASH/EEPROM technology

• In circuit serial programming capability via two pins

• Processor read write access to program memory


• Single 5v in circuit serial programming capability

• In circuit debugging via two pins

• Wide operating voltage range

• High sink or source current

• Low power consumption

PINOUT DIAGRAM OF PIC 16F877


PIC 16F877A pin details

PROGRAM MEMORY

The PIC 16F87x devices have a 13-bit program counter, Capable of addressing an 8K x 14 program

memory space. The PIC 16F877 has 8Kx 14 words of FLASH program memory. The RESET Vector is at

0000h and the interrupt vector is at 0004h.

DATA MEMORY 
Data memory is partition in to multiple banks which contain the general purpose registers and special

function registers. Bits RP1(status <6>) and RP0(status<5>) are the banks bits. 

RP1:RP0 BANK

00 0

01 1

10 2

11 3

Each bank extends up to 7Fh (128bits). The lower location of each banks are 

Reserved for the special function registers. About the special function registers are general purpose

registers, implemented as the static RAM. All implemented banks contain special function registers

.Some frequently used special function register from 1 bank may be mirrored in another bank for code

reduction and quicker access.

General Purpose Register 

The register file can be accessed either directly, or indirectly through the file select register (FSR)
SPECIAL PURPOSE REGISTER

The Special purpose registers are registers used by the CPU and peripheral modules for controlling the

desired operation of the devices. These devices are implemented as static RAM. Some examples of the

SFR’s are INDF, OPTION_REG, FSR, PCLATH e.t.c. 

STATUS REGISTER

The Status register contains the arithmetic status of the ALU, the RESET status and the bank select

bits for data memory. The STATUS register can be the destination for any instruction, as with any

other register. 

R/W-0 R/W-0 R/W-0 R-1 R-1 R/W-x R/W-x R/W-x

IRP 

RP1 
RP0 

TO 

PD 

DC 

Bit 7 bit 0 

BIT 7 IRP: Register Bank select bit

1=Bank 2, 3(100h-1FFh)

0=Bank 0, 1(00h-FFh)

Bit 6-5 RP1:RP0: Register bank selects bits 

Bit 4 TO: time out bit

Bit 3 PD: power down bit 

Bit 2 Z: Zero bit


Bit 1 DC: Digit carry

Bit 0 C: Carry 

I/O PORTS ASSOCIATED WITH PIC 16F877

Some pins for these I/O ports are multiplexed with an alternate function for the peripheral features on

the device. PIC16F877 have FIVE ports (Port A, 

B,C, D, E).

PORT A & TRIS A Registers

Port A is a 6-bit wide, bit wide, bi-directional port. The corresponding data direction register is TRISA.

Setting a TRISA bit will make the corresponding Port A pin as input. Clearing a TRISA bit will make the

corresponding Port A pin as output.

Pin RA4 is multiplexed with the Timer 0 module clock input to become the RA4/T0CK1 pin. The

RA4/T0CK1 pin is a Schmitt Trigger input and an open drain output. All other Port A pins have TTL

input levels and full CMOS output drivers. Other Port A pins are multiplexed with analog input and
analog Vref input. The operation of each pin is selected by cleaning/setting the control bits in the

ADCON1 register.

TRISA register controls the direction of the RA pins, even when they are used as analog inputs. The

user must ensure the bits in the TRISA register are maintained set when using them as analog inputs.

PORT B AND THE TRISB Register

PORTB is an 8-bit wide, bi-directional port. The corresponding data direction register is TRISB. Setting

a TRISB bit will make the corresponding PORTB pin an input. Clearing a TRISB bit make the

corresponding PORTB pin an output.

Three pins of PORTB are multiplexed with the Low Voltage Programming function: RB3/PGN, RB6/PGC

and RB7/PGD. The alternate functions of these pins are described in the Special Features Section.

Each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all the pull-ups.

This is performed by cleaning bit RBPU (OPTION_REG<7>). The weak pull-up is automatically turned

off when the port pin is configured as an output. The pulls are disabled on a Power-on Reset. 

Four of the PORTB pins, RB7:RB4 have interrupt on change feature. Only pins configured as inputs

can cause this interrupt to occur. The input pin (RB7:RB4) are compared with the old value latched on
the last read of PORTB. The “Mismatch” output of RB7:RB4 are OR’ed together to generate the

RBPORT change interrupt with flag bit RBIF (INTCON<0>).

This interrupt can wake the device from SLEEP. A mismatch condition will continue to set flag bit RBIF.

Reading PORTB will end the mismatch condition and allow flag bit RBIF to be cleared

PORTC AND THE TRISTC Register

PORTC is an 8 bit wide, bi-directional port. The corresponding data direction register is TRISC. Setting

TRISC bit (=1) will make the corresponding PORTC pin an input. Clearing TRISC bit (=0) will make the

corresponding PORTC pin an output. PORTC is multiplexed with several peripheral functions. PORTC

pin have SCHMITT Trigger input buffers. When the I2C module is enabled the PORTC<4:3> pin can be

configure with normal I2C levels.

PORT D AND THE TRIS D REGISTER

PORT D is an 8-bit port with Schmitt trigger input buffers. Each pin is individually configurable as an

input or output.

.PORT E AND THE TRIS E REGISTER


PORT E has three pins which are individually configurable as input or output .The PORT E pins

becomes I/O control inputs for the microprocessor port when bit PSPMODE(TRIS<4>) is set .PORT E

pins are multiplexed with analog input . TRISE controls the direction of the RE pins.

. TIMER MODULE

TIMER0 MODULE

The TIMER0 module timer /counter have the following features:

8-bit timer/counter

Readable and writable 

8-bit software programmable pre scalar

Internal or external clock select

Interrupt on overflow from FFh to 00h 

Edge select for external clock

Timer mode is selected by clearing bit TOCS (OPTION_REG<5>). In timer mode, the timer 0 module

will increment every instruction cycle. Counter mode is selected by setting bit TOCS (OPTION-

REG<5>). In counter mode, TIMER0 will increment either on every rising or falling edge of pin
RA4/TOCK1. The pre scalar is mutually exclusively shared between the timer0 module and the watch

dog timer.

TIMERO INTERRUPT

The TMR0 interrupt is generated when the TMR0 register overflows from FFh to 00h . This overflow

sets bit TOIF (INTCON<2>).

USING TIMER0 WITH AN EXTERNAL CLOCK

When no pre scalar is used the external clock is the same as the pre scalar output.

PRE SCALAR

There is only one pre scalar available, which is mutually exclusively shared between the TMR0 module

and the watch dog timer. A pre scalar assignment for the TMR0 module means that there is no pre

scalar for the watch dog timer, and vice versa. This pre scalar is not readable or writable.The PSA and

PS2:PS0 bits (OPTION_REG<3:0>) determine the pre scalar assignment and pre scalar ratio.

R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W1


RBPU INTEDG TOCS TOSE PSA PS2 PS1 PS0

Bit7 Bit0 

Bit 7 RBPU

Bit 6 INTEDG 

Bit 5 T0CS: TMR0 clock source select bit 

1=transition on TOCK1 pin 

0= internal instruction cycle clock (CLKOUT)

Bit 4 T0SE: TMRsource edge select bit 

1=increment on high-to-low transition on T0CK1 pin 

0=increment on low-to-high transition on T0CK1 pin

Bit 3 PSA: pre scalar assignment bit

1= pre scalar is assigned to the watch dog timer 

0=pre scalar is assigned to the timer 0 module

Bit 2-0 PS2:PS0: pre scalar rate select bits


Bit value TMR0 RATE WDT RATE

000 1:2 1:1

001 1:4 1:2

010 1:8 1:4

011 1:16 1:8

100 1:32 1:16

101 1:64 1:32

110 1:128 1:64

111 1:256 1:128

REGISTERS ASSOCIATED WITH TMR0

The registers associated with TMR0 are TMR0, INTCON, and OPTION_REG.

TIMER 1 MODULE
The timer 1 module is a 16 bit timer/counter consisting of two 8-bit registers (TMR1H and TMR1L),

which are readable and writable. The TMR1 register pair (TMR1H:TMR1L) increment from 0000h to

FFFFh and rolls over to 0000h .The TMR1 interrupt, if enabled, is generated on over flow, which is

latched in interrupt flag bit TMR1IF( PIR1<0>).This interrupt can be enabled /disabled by setting

/clearing TMR1 interrupt enable bitTMR1IE(PIE1<0>).

TIMER 1 can operate in one of two modes:

• As a timer

• As a counter

The operating mode is determined by the clock select bit, TMR1CS (T1CON<1>).

U-0 u-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0

- - T1CKPS1 T1CKPS0 TIOSCEN T1SYNC TMR1CS TMR1ON

Bit 7 bit 0

Bit 7-6 unimplemented

Bit5-4 TICKPS1:T1CKPS0: TIMER 1 input clock pre scale select bits

Bit 3 T1OSCEN:Timer1 oscillator enable control bit

1= oscillator is enabled

0= oscillator is shut-off 

Bit 2 T1SYNC:TMR1 external clock input synchronization control bit 


Bit 1 TMR1CS:TMR1 clock source select bit 

Bit 0 TMR1ON: TMR1 on bit

TIMER1 OPERATION IN TIMER MODE

TIMER mode is selected by clearing the TMR1CS (T1CON<1>) Bit. In this mode the input clock to the

timer isFosc/4.The synchronize control bit T1SYNC (T1CON<2>) has no effect, since the internal clock

is always in sync.

RESETTING OF TIMER1 REGISTER PAIR(TMR1H,TMR1L) 

TMR1H and TMR1L registers are not reset to 00h on a PORT, or any other RESET, except by the CCP1

and CCP2 special event triggers. T1CON registers is reset to 00h on a power –on Reset, or a Brown-

out RESET ,which shuts off the timer and leaves a 1:1 pre scale .

TIMER2 MODULE

TIMER2 is an 8-bit timer with a pre scalar and a post scalar. It can be used as the PWM time –base for

the PWM mode of the CCP modules .The TMR2 registers is readable and writable, and is cleared on
any device RESET.

The input clock has a pre scale option of 1:1,1:4,1:16,selected by control bits

T2CKPS1:T2CKPS0(T2CON<1:0)

It has an 8 bit period register, PR2.TMR2 increments from 00h until it matches PR2and then reset to

00h on the next increment cycle.PR2 is a readable and writable register.PR2 register is initialized to

FFh up R/W-0on RESET.

U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0

- TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKP

Bit7 bit0

Bit 7 unimplemented

Bit 6-3 TOUTPS3: TOUTPSO: Timer2 Output Post scale selected bits

Bits 2 TMR2ON: Timer 2 on bit

Bit 1-0 T2CKPS1:T2CKPS0: Timer 2 Clock Presale Select bits

Timer 2 prescaler and Postscaler


The prescale and postscaler counters are cleared when any of the following occurs:

• A write to the TMR2 register

• A write to the T2CON register

• Any device reset

• TMR2is not cleared when T2CON is written.

ANALOG TO DIGITAL CONVERTER MODULE

The analog to digital converter module has 8 inputs for the 40 pin PIC .The A/D module has 4 register.

• A/D results high register.

• A/D results low register

• A/D control register 0.

• A/D control register 1.

The A/D conversion of the analog input signals in a corresponding 10-bit digital number.
ADCON0 REGISTER.

R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 U-0 R/W-0

ADCS1 

ADCS0 

CHS2 

CHS1 

CHS0 

GO/DONE 

-- ---- 

ADCON

ADCON1 REGISTER

U-0 U-0 R/W-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0


ADFM - - - PCFG3 PCFG2 PCFG1 PCFG0

USART

This mode is usually used to communicate in 8-bit ASCII code. It has two pins for transmittion and

reception.Transmittion begins whenever data is written to SBUF .USART is an acronym for universal

synchronous asynchronous receiver and transmitter.

Control Register Of Transmittion. (Txsta)

CSRC TX 9 TxEN SYNC - BRGH TRMT Tx9D

Control Register Of Reception (Rxsta)

SPEN Rx9 SREN CREN ADDEN FERR OERR Rx9D


2.2 GSM (Global System for Mobile communications) modem

A GSM modem is used to communicate with the home control device and our mobile phone. Here a

GSM mobile hand set is used. GSM networks are originally from the most popular standard for mobile

phones in the world.

GSM differs from its predecessors in that both signaling and speech channels are digital, and thus is

considered a second generation (2G) mobile phone system. This has also meant that data

communication was easy to build into the system. GSM is a cellular network, which means that mobile

phones connect to it by searching for cells in the immediate vicinity. GSM networks operate in a

number of different frequency ranges. Most 2G GSM networks operate in the 900 MHz or 1800 MHz

bands. The controller communicates with the mobile phone by AT comments. The Main AT commands

to communicate via a serial interface with the GSM subsystem of the phone. The comments that used

in the controller is sent and received by SMS (short message system).

Energy Monitoring System

Details of AT comments used

. AT+CMGD (Delete message)

Description: Deletes message from preferred message storage

Location.
Execution command: AT+CMGD=,

. AT+CMGR (Read message)

Description: Returns message with location value  from preferred message

storage  .

Execution command: AT+CMGR=

. AT+CPMS (Preferred message storage)

Description: Set command selects memory storage ,  and 

to be used for reading, writing, and so on.

Set command: AT+CPMS=[,[,]]

“ME” for Phone message storage

“SM” for SIM message storage

. AT+CMGF Message format

Description: Tells which input and output format of messages to use. 

indicates the format of messages used with send, list, read and write

commands and unsolicited result codes resulting from received


messages. Mode can be either PDU mode or text mode

Set command: AT+CMGF=; 0 for PDU mode and 1 for text mode.

delivery.
2.3 Power supply

Power supply is used to give sufficient power to the microcontroller. A step down transformer and a

bridge rectifier is used here to convert AC to DC. A regulator IC is also used here to give constant

supply.7805 IC is used for power supply and it is connected to the bridge rectifier.

Fig 2.1.4.1: power supply

This circuit can give +5V output at about 150 mA current, but it can be increased to 1 A when good

cooling is added to 7805 regulator chip. The circuit has over overload and terminal protection.

Circuit diagram of the power supply. 

Fig 2.1.4.2: circuit diagram

The capacitors must have enough high voltage rating to safely handle the input voltage feed to circuit.

The circuit is very easy to build for example into a piece of Vero board. 
Pin out of the 7805 regulator IC.

1. Unregulated voltage in 

2. Regulated voltage out

3. Ground

DESIGN

3.1 HARDWARE DESIGN


3.2 SOFTWARE DESIGN

3.1 HARDWARE DESIGN

3.1.1 CIRCUIT DIAGRAM


CIRCUIT DESCRIPTION & WORKING

The detailed circuit diagram of gsm based home automation is shown in the above figure. It consists

of a microprocessor PIC16F877A, gsm module and power supply . The PIC microprocessor is the main

part of both sections which provide control to the operation of controlling devices and gsm which is

used torecieve data by mobile technology.


When we send an instuction by sms service provided by gsm company,the sms is delivered in gsm

module in device. The gsm module have a modem which help to transform data via serial port of the

mobile (which is generally used for data transfering from mobile to pc via data cable). This data is

given to a comparator ic that is lm393 which is used for transforming the data’s voltage range to 0 to

5 volt range ( the binary data from the mobile is generally in the range of 0 to 3 volt). Then the serial

data is given to the serial ports of PIC, Tx and Rx. PIC compare this data with predefined datas which

are specified in program and generate curresponding output. Since this output is not sufficient to drive

relays, we use ULN2003 ic for driving relays.

3.1.3 PCB LAYOUT


3.1.4 PCB FABRICATION

Materials required

Copper clad sheet, drilling machines and ferric chloride solution.

Method

The following steps are involved in making a PCB.

1. Preparation of layout of track.

2. Transferring the layout of the track.

3. Etching to remove the copper from the copper clad where ever it is not required.

4. Drilling holes for component mounting.

Preparing layout

The track layout of the electronic circuit must be drawn on a white paper. The layout should be made

such a way that the paths are in easy routes, This enables the PCB to be more compact and
economical.

Transferring the layout to the copper

The layout made on white paper should be redrawn on copper clad using paint or varnish.

Etching

Ferric chloride solution is the popularly used etching solution. The ferric chloride powder is made into

a solution using water and kept in a plastic tray. Immerse the marked copper clad in this solution for

two hours. The reaction taking place is expressed by the equation.

FeCl3 + Cu ↔ CuCl3 + Fe

Due to the reaction, the solution will become weak and it is not recommended for another etching

process. The copper in the unmarked area will be etched out. Take our the etched sheet from the tray

and dry out in sun light for an hour. Later remove the paint or nail varnish using turpentine

Drilling

The holes are made by drilling machine for component insertion.

3.1.5 SOLDERING

Materials and tools required

Solder, flux, knife/blade, soldering iron, strip board and nose pliers

Theory

Soldering is the process of joining metals by using lower melting point metal to wet or alloy with
joined surfaces.

Solder

Soldering is the joining material that below 427°c. Soldering joints in electronic circuits will establish

strong electrical connections between component leads. The popularly used solders are alloys of tin

and lead that melts below the melting point of tin.

Fluxes

In order to make surfaces accept the solder readily, the component terminals should be free from

oxides and other obstructing films. The leads should be cleaned chemically or abrasion using blades or

knives. Small amount of lead coating can be done on the cleaned portion of the lead using soldering

iron. This process is called tinning. Zinc chloride or ammonium chloride separately or in combination

are the most commonly used fluxes. These are variables in petroleum jelly as paste flux. The residues

which remain after the soldering may be washed out with more water accompanied with brushing .

Soldering iron

It is the tool used to melt the solder and apply at the joints in the circuits. It operates in 230V and

25W soldering iron are most commonly used for this purpose.

Procedure

1) Make a layout of the connection of the components in the circuit. Plug-in the chord of the soldering

into the main supply to get it heated up.

2) Straighten and cleaned the component leads using a blade or knife. Apply a little flux on the leads.

Take a little solder on the soldering iron and apply on the molten solder on leads.

3) Mount the components on the PCB by bending the leads of the components using nose pliers.

4) Apply flux on the joints and solder joints. Soldering must be done in minimum time to avoid dry
soldering and heating up of the components.

5) Wash the residues using water and brush.


3.2 SOFTWARE DESIGN

3.2.1FLOW CHART

3.2.2PROGRAM CODE

/*GSM based device control system*/

/*The device status is stored in EEPROM inorder to avoid power failure problem*/
/*Mobile phone interfacing functions

requires serial port with a baud rate of 9600*/

/*************************************************************/

sbit Device1 at PORTC.B1; /*Device 1*/

sbit Device2 at PORTC.B2; //Device 2

sbit Device3 at PORTC.B3; //Device 3

sbit Device4 at PORTC.B4; //Device 4

/*****************************variables****************************************/

unsigned char msg[7]; /*array to store message content*/

/***********************sends a command passed to it***************************/

void Send_Command(unsigned char *ptr)

/*it sends the array until a null character reached*/

unsigned char Tx_Count=0;

do

{
Uart1_Write(ptr[Tx_Count]);

Tx_Count++;

}while(ptr[Tx_Count]!='\0'); /*checks for null*/

/***********************Initmobile*****************************/

/*this function initialises the mobile phone, ECHO OFF,PHINE MEMORY

TEXT MODE...*/

void Init_Mobile()

Send_Command("AT\r\n");

Delay_Ms(1000);

Send_command("ATE=0\r\n"); /*ECHO off*/

Delay_Ms(1000);

Send_Command("AT+CPMS="); /*Select PHONE memory*/

Uart1_Write('"');

Send_Command("ME");
Uart1_Write('"');

Send_Command("\r\n");

Delay_Ms(1000);

Send_Command("AT+CMGF=1\r\n"); /*Select TEXT mode*/

Delay_Ms(1000);

Send_Command("AT+CMGF=1\r\n");

Delay_Ms(1000);

/******************Reads message from 1st location****************/

/*The address of the destination array is passed*/

unsigned char Read_Message(unsigned char *ptr_array)

unsigned char Rx_Count=0,Rx_Buffer;

Rx_Buffer=RCREG;

Rx_Buffer=RCREG;

Rx_Buffer=RCREG;
RCSTA.CREN=0;

RCSTA.CREN=1;

Send_Command("AT+CMGR=1\r\n"); /*Command for reading message*/

do

while(Uart1_Data_Ready()==0){;}

Rx_Buffer=RCREG;

Rx_Count++;

}while(Rx_Count<6); /*receive upto 6 characters*/

if(Rx_Buffer=='S') /*Checks for valid message*/

return 0;

else if(Rx_Buffer=='G')

do /*if message is there*/

while(Uart1_Data_Ready()==0){;} /*receive upto next 0x0A*/


Rx_Buffer=RCREG; //avoid number and msg status

}while(Rx_Buffer!=0x0a);

Rx_Count=0;

do

while(Uart1_Data_Ready()==0){;}

Rx_Buffer=RCREG; //Read message

ptr_array[Rx_Count]=Rx_Buffer;

Rx_Count++;

}while(Rx_Buffer!=0x0d); /*receive message uptp 0x0d*/

ptr_array[Rx_count-1]='\0'; /*the array is terminated with a null*/

return 1;

/*****************************************************************************/

/****************************************************************************/
void main()

unsigned char Count=0,Dev_Status;

Uart1_Init(9600); /*Init Uart*/

Dev_Status=Eeprom_Read(0x00); /*read the previous status*/

ADCON1=0x06; /*Porta as digital*/

TRISA=0XFF; /*PORTA input*/

TRISC&=0XF0;

PORTC=Dev_Status; /*output the status*/

Init_Mobile(); /*Init mobile*/

Delay_Ms(1000); /*1sec delay*/

while(1)

/****************************************************************************/

if(Read_Message(&msg[0])==1)
{

if(strcmp(msg,"1 ON")==0)

Device1=1;

Dev_Status

=0x02;

Eeprom_Write(0x00,Dev_Status);

else if(strcmp(msg,"1 OFF")==0)

Device1=0;

Dev_Status&=0xfd;

Eeprom_Write(0x00,Dev_Status);

else if(strcmp(msg,"2 ON")==0)

{
Device2=1;

Dev_Status

=0x04;

Eeprom_Write(0x00,Dev_Status);

else if(strcmp(msg,"2 OFF")==0)

Device2=0;

Dev_Status&=0xfA;

Eeprom_Write(0x00,Dev_Status);

else if(strcmp(msg,"3 ON")==0)

Device3=1;

Dev_Status

=0x08;

Eeprom_Write(0x00,Dev_Status);

}
else if(strcmp(msg,"3 OFF")==0)

Device3=0;

Dev_Status&=0xf7;

Eeprom_Write(0x00,Dev_Status);

else if(strcmp(msg,"4 ON")==0)

Device4=1;

Dev_Status

=0x08;

Eeprom_Write(0x00,Dev_Status);

else if(strcmp(msg,"4 OFF")==0)

Device4=0;

Dev_Status&=0xf7;
Eeprom_Write(0x00,Dev_Status);

Delay_Ms(2000); /*2sec delay*/

Send_Command("AT+CMGD=1\r\n"); //Delete message

else

Delay_Ms(1000); //Delay before next checking

}
COST ESTIMATE

PIC16F877 :-180 

GSM modem/mobile :-2500

IC LM393 :-15

IC ULN2003APG :-12

Regulator IC 7805 :-3

Resistors :-3

Capacitors :-10

dc adapter :-100

Serial data cable :-70

Switch :-2

Crystal oscillator :-3


PCB :-350

Voltage Transformer :-100

Extra components :-400

Cabinet :-100

Assembly charge :-350


CONCLUSION

Remote control technologies are widely used to control household electronic appliances without

walking up to them. Controlling household appliances through computer can also be a possible

solution. However, it cannot fulfill the current demand which is to control them from remote places.

The advantages of cellular communications like GSM technology is a potential solution for such remote

controlling activities. GSM-SMS technology can be used to control household appliances from remote

places. With these hypotheses, three different approaches have been proposed and implemented in

this paper. Firstly, household appliances are controlled by server mobile which acts as remote control.

Secondly, GSM-SMS messaging technology is used to control them from remote places and finally, to

provide a multiple agents environment. 


7. BIBILIOGRAPHY

THE 8051 MICROCONTROLLOR 

• -Kenneth J .Ayala

ELECTRICAL TECNOLOGY

-B.L .Theraja & A.K. Thereja

OP-AMPS AND LINEAR INTEGRATED CIRCUIT

-Ramakant .A.Gayakwad

http://www.microchip.com/ 

http://www.electronicsforyou.com/

http://www.datasheetcatalog.com /
http://www.analog.com/
DATA SHEETS
ULN2003APG
7805 REGULATOR IC

In the system IC 7805 is used to supply regulated voltage to the main board

DESCRIPTION

The UTC 78XX is monolithicfixed voltage regulator integrated circuit.They are suitable for applications

that requires supply current up to 1A

FEATURES

*Output current up to 1.5A

*Fixed output voltages of5V,6V,8V,9V,10V,12V,15V,18Vand 24V are available.

*Thermal overload shutdown protection

*Short circuit current limiting

*Output transistor SOA protection

1.Input 2.GND 3.output


The maximum steady state usable uotput current are dependent on input voltage,heat sinking,lead

length of the package and copper pattern of PCB.They have power dissipation < 0.5 W.to specify an

output voltage substitute voltage valuesfor”XX”.Bypass capacitors are recommended foroptimum

stability and transient response and should be located as close as possible to the regulators.

LM 393

Posted by  remesh viswanath  at  10:19 PM  0 comments  Links to this post

Reactions: 
monday, march 1, 2010

love story-taylor swift


this is ma fav song eva....hope yu ll enjoy

Posted by  remesh viswanath  at  10:20 PM  0 comments  Links to this post

Reactions: 
wednesday, january 20, 2010

my pencil marks..

                                                                seasons....

angelina
                                                              the unknown

Posted by  remesh viswanath  at  10:10 PM  0 comments  Links to this post

Reactions: 
i live in heaven

                                                  its raining...and im loving it......


                                    reflection, its like my brain......

                              Nothing imporatnt in it but colourfull......

                              rain drops falling down  .............like me?

Posted by  remesh viswanath  at  9:45 PM  0 comments  Links to this post

Reactions: 
Home

Subscribe to: Posts (Atom)

my life....my views...
This does nt contain any "story untold" or unexplored or like that. Jus want to share some pics
that is purely come from ma hand most of'em are wid ma mobile cam.

followers
about me

remesh viswanath

mala,thrissur, kerala, India

some people say that i must be horrible person but thats not true .I have a heart of a young

boy.......in a jar on my desk ! !!!

View my complete profile

blog archive

 ▼   2010  (5)

o ▼   October  (1)

 Enjoy free life...cos you wont get it back.....

o ►   March  (2)

o ►   January (2)

You might also like