0% found this document useful (0 votes)
124 views86 pages

SMS Device Control and Monitoring System

This document provides an introduction to an SMS based device switching and status monitoring project. The project allows a user to control up to 8 electrical devices remotely through SMS text messages sent from a mobile phone. It also monitors the status of the devices and sends that information back to the user's phone. The system uses a microcontroller that is programmed to receive SMS commands and switch devices on or off. It can then send status updates on the device conditions. The project aims to demonstrate concepts of embedded systems and microcontroller programming.

Uploaded by

sab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views86 pages

SMS Device Control and Monitoring System

This document provides an introduction to an SMS based device switching and status monitoring project. The project allows a user to control up to 8 electrical devices remotely through SMS text messages sent from a mobile phone. It also monitors the status of the devices and sends that information back to the user's phone. The system uses a microcontroller that is programmed to receive SMS commands and switch devices on or off. It can then send status updates on the device conditions. The project aims to demonstrate concepts of embedded systems and microcontroller programming.

Uploaded by

sab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 86

A

Project report
On

SMS based device switching and


status monitoring

Submitted towards the partial fulfillment


Of the requirement for the diploma of
Of engineering
In

INDUSTRIAL ELECTRONICS

BY

Yash doshi
Vaibhav doshi
Aniket khedekar
Kaushal joshi

Under Guidance Of

Mrs. Radha sivadas


VIVEKANAND EDUCATION SOCIETYS
POLYTECHNIC,
CHEMBUR, MUMBAI-71

2007-2008

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Acknowledgement

It is great pleasure in presenting our multipurpose multifunctional


project on security system SMS based device switching and status

monitoring which is of great importance in the present world. This project


was completed because of the hard work and efforts taken by all the group
members and our project guide.
We take this opportunity to express our deep indebtness to the faculty of
VIVEKANAND INSTITUTE OF TECHNOLOGY.
Amongst the panorama of people who provided us with inspiring guidance
and encouragement, we wish to take an opportunity to convey our thanks to
people who guided us at every stage and gave their valuable time and knowledge
during our project.
From the core of our heart we give special thanks to our project guide who
has been a teacher to us in the real sense of the ward. We all pay deep gratitude
to her for having been a constant source of inspiration and for helping us in our
difficulties.
We pay special thanks to our processors for helping us to make this project
a grand success. We thank our staff and colleagues for being with us during this
long span for providing us with information and challenging opportunities to
prove ourselves in our respective fields.
The last but not the least we favor the lab assistants and workshop staff for
devoting their precious time as well as for giving their support.
We end this acknowledgement anticipating getting all encouragement and
support from the staff and students to have an enlightened future.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Table of Contents
Section I

Introductory-------------------------------------------------------
Introduction
Technology Used
Features

Section II

Overview-----------------------------------------------------------
Development Stages & Process

Section III

System Overview-------------------------------------------------
Connector Details
Brief Explanation

Section IV

Circuit Diagram -------------------------------------------------


Circuit Diagram
Circuit Basics
Explanation

Section V
Software-------------------------------------------------------
Flowchart
Coding

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Table of Contents Continue

Section VI
Basics of Microcontroller---------------------------------------
Introduction to Microcontrollers
The 89V51 Microcontroller
Features of 89V51
Pin diagram & Explanation
Architecture of 89V51
Memory Organization of 89V51

Section VII
Development Tools----------------------------------------------
The Keil (Vision2)
The Eagle 4.11

Section VIII
PCB design-----------------------------------------------------
Manufacturing process
PCB Fabrication

Section IX
Conclusion--------------------------------------------------------
Operational Basics
Inbuilt Commands

Section X
Bibliography -----------------------------------------------

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


SMS based device switching
and status monitoring

Preface

T he microcontroller is an exiting, challenging, and growing field; it will pervade industry for
decades to come. To meet the challenges of this growing technology, we will have to conversant
with the programmable aspect of the microcontroller. Programming is a process of problem solving
and communicating in a strange language of mnemonics. The projects could be developed
significantly faster and much easily using a microcontroller.

The mobile communication has expanded to a large extent such that it can be applied even
for controlling of electrical devices. In our project we make use of this capability of mobile phones.
However to enable this we need to connect the mobile phone to a microcontroller and to enable this
we make use of embedded technology .Apart from controlling it also does the sensing of the
devices. Thus we are also able to know of the status of the devices. Here we are controlling eight
electrical devices and sensing the status of eight devices. According to the user need both of this can
be expanded.

In our project the micro controller is controlled by the SMS send from the mobile phones.
The user controls the eight electrical devices connected to the device. The status of the devices is
made known to the user by the micro controller. The micro controller polls each device and sends
their status to user mobile phone. This enables the user to understand the status of each device either
in his office or house hold.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


We find our project as one which can be easily perceived by any one. Also the SMS
commands for controlling the devices are simple plain English text messages which can be send
with ease. Also the project can be used for both industrial and household applications .Thus we find
that our project proves to be a very beneficial one.

The purpose of this project is to implement the various concepts of microcontroller and
embedded designing environment. An embedded microcontroller is a chip which has a computer
processor with all its support functions (clock & reset), memory (both program and data), and I/O
(including bus interface) built into the device. These built in functions minimize the need for
external circuits and devices to be designed in the final application.

The SMS based device switching and status monitoring fully utilizes microcontroller
futures & embedded technology concepts to minimize the complications of digital gates, size and
cost too.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


INTRODUCTORY

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Section-I

Introductory

Introduction
Technology Used
Features
Introduction
This Project is a very good example of embedded system as all its operations are controlled
by intelligent software inside the microcontroller.

The aim of this project is to control i.e. to ON/OFF the electrical or electronic appliances
connected to this system from anywhere in the world. For this purpose user can use any type
of Mobile. This way it overcomes the limited range of infrared and radio remote controls.

Using the convenience of SMS, this project lets you remotely control equipment by
sending plain text messages, such as "abcdn1", "abcdnaf3", "abcdf57n142" all of which can
be pre-programmed into the controller and easily remembered later. It can control up to eight
external devices.

Short Message Service (SMS) is defined as a text-based service that enables up to 160
characters to be sent from one mobile phone to another. In a similar vein to email, messages
are stored and forwarded at an SMS centre, allowing messages to be retrieved later if you are
not immediately available to receive them. Unlike voice calls, SMS messages travel over the
mobile networks low-speed control channel.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


"Texting", as its also known, is a fast and convenient way of communicating. In fact,
SMS has taken on a life of its own, spawning a whole new shorthand language thats rapidly
being adopted as the norm.

Many industries have been quick to make use of this technology, with millions of
handsets currently in use. As new models with "must have" features hit the market, older models
become virtually worthless and if not recycled, end up in landfill. With this in mind, weve
designed the project to work with 3310 & 3315 Nokia models.

SHORT MESSAGE SERVICE:

Short Message Service is a service available on most digital mobile phone that permits
the sending of short messages also known as text messages between mobile phone other
handheld devices and even landline telephones. Other uses of text messaging can be for ordering
ringtones, wallpapers and entering competitions Messages are sent via a store-and-forward
mechanism to a short message service centre, which will attempt to sent the recipient and
possibly retry if the user is not reachable at a given moment. Both mobile terminated, for
messages sent to a mobile handset, and mobile originating, for those that are sent from the mobile
handset, operations are supported. Messages delivery is best effort, so, there are no guarantees
that a message will actually be delivered to its recipient and delay or complete loss of a message
is not uncommon, particularly when sending between networks. Users may choose to request
delivery reports, which can provide positive confirmation that the message has reached the
intended recipient, but notifications for failed deliveries are unreliable at best SMS would be
used as a means for sending text messages from a mobile user to another. One factor in the slow
take-up of SMS was that operators were slow to eliminate billing fraud which was possible by
changing SMSC settings on individual handsets to the SMSCs of other operators. Over time, this
issue was eliminated by switch-billing instead of billing at the SMSC and by new features within
SMSCs to allow blocking of foreign mobile users sending messages through it.SMS was
considered in the main GSM group as a possible service for the new digital cellular system. In
GSM document 'Services and Facilities to be provided in the GSM System both mobile
originated and mobile terminated, including point-to-point and point-to-multipoint, short
messages appear on the table of GSM tele -services. Larger content known as long SMS or
concatenated SMS can be sent segmented over multiple messages, in which case each message
will start with a user data header (UDH) containing segmentation information.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Short messages can also be used to send binary content such as ring tones or logos, as well as
OTA programming or configuration data. Some service providers offer the ability to send
messages to land line telephones regardless of their capability of receiving text messages by
automatically phoning the recipient and reading the message aloud using a speech synthesizer
along with the number of the sender. Short message services are developing very rapidly
throughout the world.

Technology Used
As microcontrollers are the core of the todays digital circuit design in industry, this system
uses it for the centralized operation and digital processing.

Mobile phones and the network they operate under vary significantly from provider to
provider, and even from nation to nation. However, all of them communicate through
electromagnetic radio waves with a cell site base station, the antennas of which are usually
mounted on a tower, pole, or building.
The phones have a low-power transceiver that transmits voice and data to the nearest cell
sited, usually .5 to 10 miles away. When the cellular phone or data device is turned on, it
registers with the mobile telephone exchange, or switch, with its unique identifiers, and will then
be altered by the mobile switch when there is an incoming telephone call. The handset constantly
listens for the strongest signal being received from the surrounding base stations. As the user
moves around the network, the mobile device will hand off to new cell sites.
Cell sites have relatively low-power radio transmitters which broadcast their presence and
relay communications between the mobile handsets and the switch. The switch in turn connects
the call to another subscriber of the same wireless service provider or to the public telephone
network, which includes the networks of other wireless carriers.
The dialogue between the handset and the cell site is a stream of digital data that includes
digitized audio. The technology that achieves this depends on the system which the mobile phone
operator has adopted. Some technologies include AMPS for analog, and TDMA, CDMA, GSM,
GPS, EV-DO, and UMTS for digital communications. Each network operator has a unique radio
frequency. The mobile phone used in this project is 5110, 3310 or 3315 may be used.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


The technology used here is embedded technology which is the future of todays modern
electronics.
Here we have used a very high speed Microcontroller i.e. P89V51RD2BN. This runs on
6-clk cycle period instead of 12-clk cycle. This makes the communication rate faster at
115200bps. Since we are using F-Bus protocol with the mobile, a full duplex communication
with the above baud rate is required.

Features
The following are the prominent features of SMS based device switching and status
monitoring

Works with Nokia 3310,3315 phones,


Can control up to 8-devices,
User-programmable plain text message control,
Communicate from any other mobile,
Password protected,
Ideal for alarm control panels,
Can be used in vehicles,
Can be controlled from anywhere, anytime,
In-system programmable i.e. we can modify the code of the Controller at anytime
depending upon our requirement without taking out the controller from the board.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


OVERVIEW

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Section-II

Overview

Development Stages & Process


The complete development of this system can be divided into the following
stages

Problem definition stage


Designing block diagram
Implementing circuits and components
Developing flowchart for software
Writing actual code for Microcontroller
Compiling the code
Burning the hex file into microcontroller with programmer
Testing
Running

Problem definition stage


This is the very first stage to develop any project. It actually defines the aim and
the concept of the project. The aim of SMS based device switching and status monitoring is
to design a top class access control system that can be controlled from anywhere in the world &
will reutilize the rejected or old mobile phones.

Designing block diagram


At this stage we have categorized the whole system into different individual
modules. These modules (block diagrams) will be helpful in understanding the concept and
working of the integrated system.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Implementing circuits and components
This is the actual implementation of circuit of each block. At this stage we have
actually designed each block separately and finally integrated them into the complete working
system.
Developing Flowchart for software
To get the logical flow of the software, the development of flowchart is having a
prominent role. So that we have analyzed the complete system and organized the flowchart in
such a manner that one can understand the complete working of the software.
Writing actual code for Microcontroller
After the development of the algorithm and flowchart we have actually translated
them in C language for P89V51RD2BN Microcontroller so that it can understand the
instructions and run as per our requirement. The instructions are in ANSII C Language.

Compiling the code


The hand written code on paper was then transferred into computer. For that we
have used Keil pre-install on PC. The Keil is a Computer Aided Program to simulate the
working of Microcontroller in real time without burning the software into actual IC. We
simulated and compiled our program for error checking. After removing several compiling
errors the program was converted into machine language i.e. Intel hex format.

Burning the hex file into microcontroller with Programmer


In this stage the compiled hex format file was downloaded or burned into Philips
P89V51RD2BN flash Microcontroller. This was done by using the Philips in-system
programming software provided by the manufacturer itself.

Testing
This time we tested our project for actual working, after loading the software into
the microcontroller. Any errors found were removed successfully.
Running

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


This is the last and final stage of development of our project. In this stage a user flowchart was
made so that any one can use this system without any difficulty.

BLOCK DIAGRAM

MOBILE 1

MOBILE 2
F-BUS CABLE

LCD DISPLAY
MOBILE
INTERFACING
CIRCUIT UC
P89V51
RD2BN RELAY 1 DEVICE 1

RELAY 2 DEVICE 2

MULTIPLE DEVICES
MULTIPLE RELAYS

SERIAL
EEPROM
93C46

RELAY N DEVICE N

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


SMS BASED DEVICE SWITCHING AND STATUS MONITORING
SYSTEM
OVERVIEW

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Section-III

SMS Overview

A Introduction to Nokia F-Bus

How to connect microcontrollers to Nokia 3310 & 3315

Most Nokia phones have F-Bus and M-Bus connections that can be used to connect a phone
to a PC or in our case a microcontroller. The connection can be used for controlling just about all
functions of the phone, as well as uploading new firmware etc. This bus will allow us to send and
receive SMS messages.

The very popular Nokia 3310/3315 has the F/M Bus connection under the battery holder.
This is a bit of a pain to get to and requires a special cable to make the connection. The left picture
above shows the 4 gold pads used for the F and M Bus. The right picture shows the F-Bus cable
connected to Nokia 3310.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Nokia download cables are available from most mobile phone shops and some electronics
stores. The cable contains electronics to level convert 3V signals to RS232 type signals. There are
also M and F bus switching in most cables.

The differences of M-Bus and F-Bus

M-Bus is a one pin bi-directional bus for both transmitting and receiving data from the
phone. It is slow (9600bps) and only half-duplex. Only two pins on the phone are used. One
ground and one data. M-Bus runs at 9600bps, 8 data bits, odd parity, and one stop bit. The data
terminal ready (DTR) pin must be cleared with the request to send (RTS).

F-Bus is the later high-speed full-duplex bus. It uses one pin for transmitting data and one
pin for receiving data plus the ground pin. Very much like a standard serial port. It is fast
115,200bps, 8 data bits, no parity, and one stop bit. For F-Bus the data terminal ready (DTR) pin
must be set and the request to send (RTS) pin cleared.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


The F-Bus Protocol and Commands

The F-Bus is bi-directional serial type bus running at 115,200bps, 8 data bits. The serial
cable contains electronics for level conversion and therefore requires power. The first thing to do
is supply power to the cable electronics and this is done by setting the DTR (Data Terminal
Ready) pin and clearing the RTS (Request to Send) pin.

Connect the DTR pin to a +3 to 12 Volt supply and RTS to a -3 to -12Volt supply. The
easy way to achieve this is by using a Max232 or similar transceiver for the RS232 TX and RX
pins and then connecting the DTR pin on the serial cable to the V+ pin on the Max232. Do the
same for the RTS; however connect it to the V- pin on the Max232. The V+ and V- pins are
derived from internal charge pumps that double the input voltage. i.e. for a 5V Max232, the V+
will +10V and the V- will be -10V.

The next step is to synchronize the UART in the phone with microcontroller. This is done
by sending a string of 0x55 or 'U' 128 times. The bus is now ready to be used for sending frames.

The Nokia protocol has a series of commands that allow the user to make calls, send and
get SMS messages and lots more.

Sample frame sent to Nokia 3310 (showed as a Hex dump)

B 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
1E 00 0C D1 00 07 00 01 00 03 00 01 60 00 72 D5

This sample frame is used to get the hardware and software version from a Nokia phone.

Byte 0: All frames sent by cable will start with the character 0x1E first. This is the F-Bus Frame
ID. Cable is 0x1E and InfraRed is 0x1C.

Byte 1: This is the destination address. When sending data, it's the phone's device ID byte. In our
case it's always 00 for the phone.

Byte 2: This is the source address. When sending data, it's the PC's device ID byte. In our case it's
always 0x0C (Terminal).

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Byte 3: This is the message type or 'command'. 0xD1 is Get HW & SW version.

Byte 4 & 5: Byte 4 & 5 is the message length. In our case it is 7 bytes long. Byte 4 is the MSB
and byte 5 is the LSB.

Byte 6: The data segment starts here and goes for 7 bytes in our case. As The Nokia is a 16 bit
phone and therefore requires an even number of bytes. As ours is odd the last byte will be a
padding byte and the message will end at location 13.
The last byte in the data segment (Byte 12 above) is the sequence number. The last 3 bits of this
byte increment from 0 to 7 for each frame. This part needs to be sent back to the phone in the
acknowledge frame.

Bytes 14 & 15: The second to last byte is always the odd checksum byte and the last byte is the
even checksum byte. The checksum is calculated by XORing all the odd bytes and placing the
result in the odd Checksum location and then XORing the even bytes and then placing the result
in the even byte.

If the phone received it, the reply is shown in the following data:

1E 0C 00 7F 00 02 D1 00 CF 71

1E 0C 00 D2 00 26 01 00 00 03 56 20 30 34 2E 34 35 0A 32 31 2D 30 36 2D 30 31 0A 4E 48 4D
2D 35 0A 28 63 29 20 4E 4D

50 2E 00 01 41 3F A4

The first line is an Acknowledge command frame. Notice how the destination and source
addresses are now swapped. This is because the Nokia phone is now talking. This message is two
bytes long with the two bytes representing the message type received (0xD1) and the sequence
number (0x00). The last two bytes are the checksum and should be checked to make sure the data
is correct. The 3310 will be waiting for an acknowledge frame after these two frames were sent. If
the acknowledge frame is not sent the 3310 will retry sending the data. The 3310 will only send
the data 3 times and then gives up.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


The second frame from the Nokia 3310 is the data we requested. The message type is
0xD2. This is 'receive Get HW&SW version'. This 38-byte (0x26) message should show 0x0003
"V "firmware\n" "firmware date\n" "model\n" "(c)NMP." The last byte in the data is the
sequence number. As with standard F-bus frames, the last two bytes in the frame are checksum
bytes.

The received data without f-bus frame

01 00 00 03 56 20 30 34 2E 34 35 0A 32 31 2D 30 36 2D 30 31 0A 4E 48 4D 2D 35 0A 28 63 29
20 4E 4D 50 2E 00 01 41

0003 V 0 4 . 4 5 \n 2 1 / 0 6 / 0 1 \n N H M - 5 \n ( c ) N M P .
Sequence no.

All that is required now is to send a acknowledge frame back to the phone to say 'I got it!'

1E 00 0C 7F 00 02 D2 01 C0 7C

0x7F is the acknowledge frame's command. We are only required to send a two-byte
message so length is set to 0x02. The message contains the acknowledged message type (0xD2)
and the sequence no. (0x01). The sequence number is made from the last 3 bits of the sequence
number in the previous frame. The checksum needs to be calculated and sent.

How to send a SMS message with F-Bus?

Now that we know how to send frames on the bus, we should look at sending an SMS
message.

SMS Point-to-Point Character Packing

The first thing we have to refer GSM 03.38 - Alphabets and language-specific
information from appendix. This is the Technical Specification that describes the packing of 7-bit
characters and shows the standard character map.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Example:

Let's say we want to decode the string 'hello'. First we have displayed 'hello' in
hexadecimal using the character map provided in GSM 03.38. For A to Z and numbers its just the
standard ASCII conversion.

h e l l o (ASCII characters)
68 65 6C 6C 6F (In hexadecimal)
1101000 1100101 1101100 1101100 1101111 (In Binary)

The first byte in the string is on the right. The least significant bit is then displayed on the
left with the most significant bit on the left. Shown below is the same string of 'hello' just
displayed backwards.Then it's just a matter to dividing the binary values into bytes starting with
the first character in the string. (Start from right and go to left.) The first decoded byte is simply
the first 7 bits of the first character with the first bit of the second character added to the end as
shown below. The next decoded byte in then the remaining 6 bits from the second character with
two bits of the third byte added to the end. This process just keeps going until all characters are
decoded. The last decoded byte is the remaining bits from the last character with the most
significant bits packed with zeros.

6F 6C 6C 65 68
1101111 1101100 1101100 1100101 1101000
(The ASCII characters shown in binary)

110 11111101 10011011 00110010 11101000


(The above binary just split into 8 bit segments)
06 FD 9B 32 E8
(The 8 bit segments decoded into hex)

The message hello is therefore E8 32 9B FD 06 when packed.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


How to receive a SMS message with F-Bus?

This part is really quite simple. When the phone gets SMS message, it sends a 'SMS
Message Received Frame' with the message attached to the F-Bus. All we have to do is decode it!

The SMS send example above sends a SMS message back to phone (The same phone
sending the message). Therefore below is the SMS message that was sent above, but now getting
received by the phone.

Byte: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
29 30 31 32 33 34 35
Data: 1E 0C 00 02 00 59 01 08 00 10 02 10 00 07 91 16 14 91 09 10 F0 00 10 19 38 04 00 00 33
0B 91 16 04 73 08 70
Byte: 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
65 66 67 68 69 70 71
Data: F4 70 40 32 25 30 30 82 22 74 45 4C 25 30 30 82 22 74 45 4C 74 7A 0E 6A 97 E7 F3 F0
B9 0C BA 87 E7 A0 79 D9
Byte: 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
Data: 4D 07 D1 D1 F2 77 FD 8C 06 19 5B C2 FA DC 05 1A BE DF EC 50 08 01 45 00 4A 5C
Byte 03: Message Type = 0x02 - SMS Handing
Byte 04 & 05: Message Length = 0x0059 - 89 Bytes long
Byte 09: 0x10 = SMS Message received
Byte 10: 0x02 = Memory Type = SIM
Byte 11: 0x10 = Location where SMS message stored - required to delete SMS message

(TPDU) Transfer Protocol Data Unit


Byte 24: 0x38
Byte 25: 0x04
Byte 26: Protocol ID
Byte 27: Data Coding Scheme
Byte 28: Message Length. 0x33 = 51 Bytes long!

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Serial Interface

The Nokia phones mentioned earlier incorporate two proprietary serial interfaces known as
"MBUS" and "FBUS". MBUS is half-duplex, meaning that it provides just one signal line for both
sending and receiving data. Data is exchanged over the MBUS at 9600bps (bits per second). This
interface is intended primarily for factory test and adjustment, so we wont be using it here.

FBUS, on the other hand, provides separate send and receive lines and operates at the much higher
speed of 115.2kbps. Nokia designed FBUS for connection to external accessories, such as their
PC Data Suite. However, not all models work with this particular software. Nevertheless, the
FBUS interface is present on all these models and ready to do duty in this project.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


CIRCUIT
DIAGRAM

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Section-IV

Circuit Diagram

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


MOBILE PHONE:

A mobile phone is an electronic telecommunications device. Most current mobile


phone connects to the network using a wireless radio wave transmission technology. These
mobile phones communicate via a cellular network of base stations, which is in turn linked
to the conventional telephone network.
Most mobile phones were sufficiently large that they often permanently installed in
vehicles as car phones. With the advance of miniaturization, currently the vast majority of
mobile phones are handled. In addition to the standard voice function of a telephone, a
mobile phone can support many additional services such as SMS for text messaging, packet
switching for access to the internet, and MMS for sending and receiving photos and video.
There is also specialist communication systems related to, but distinct from mobile
phones, such as Professional Mobile Radio. Mobile phones are also distinct from cordless
telephones, which generally operate only within a limited range of a specific base station.
Technically, the term mobile phone includes such devices as satellite phones and pre cellular
mobile phones such as those operating via MTS which do not have a cellular network,
whereas the related term cell phone does not. In practice, the two terms are used nearly
interchangeably; with the preferred term varying by location. The mobile phone has become
ubiquitous because of the interoperability of mobile phones across different networks and
countries.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Nokia 3310 CHARACTERISTICS

General Network GSM900


Introduced 1998
SAR Value 0.69 W/Kg
Size Weight 170 g (including battery)
Dimensions 132 x 47.5 x 31 mm
Display Type Alphanumeric
Size 5 lines
Memory Outgoing Calls 8
Received Calls 5
Lost Calls 5
Ringtones Number 30
Networking Modem Yes, 9600
Features Vibration Yes
SMS Send / Receive
Games Yes (3): Memory, Snake, Logic
Clock Yes
Alarm Yes
Standard Battery Type Li-Po
Amperage 600 mAh
Standby Time 40-180 hours
Talk Time 3 hours
Extended Battery Type Li-Po

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Circuit Diagram
Explanation
PCB Layout

This section provides the complete design details and circuit description of all the units used
in the project.

Main Controlling Unit

Explanation
This circuit is the heart of the complete project. This is the actual unit which controls all the
external peripherals & does the communication with the mobile.

The Port0 is connected to the Relay unit to control the devices connected on the relay pins.
We can control up to 8-devices. As port0 is used for controlling the relay section, it is pulled up
with the help of 10K resistor network.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


The Port1 & some pins of Port3 are used for LCD display interfacing. Port1 is used for 8-bit
data line. The controller sends various messages on the LCD indicating the current status of the
system.

The Pin Rx & Tx are used for serial communication with the mobile. The baud rate is
115200bps.

The crystal 11.0592 MHz is the standard for serial communication. The external circuit
connected to the Reset Pin of microcontroller is the R-C Network. This is used to auto-reset the
controller whenever the power is switched on.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Power Supply Unit

Explanation
This power supply circuit is divided into the following different part:
1. The transformer
2. The rectifier
3. The filter
4. The regulator

The transformer
This is used to step down the voltage level of the A.C. input from 230 V to 12 V A.C.
The current rating of the transformer is 500mA. This is more than enough to supply the current to
the relay unit & to all the other circuits.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


The rectifier
The rectifier used here is bridge rectifier. This is more efficient than the center tap. Here the
A.C. signal coming from the transformer is rectified & converted into the pulsating D.C. this is
further fed to the filter circuit.

The filter
This unit is nothing but a capacitor of high value which can charge & supply its charge to the
circuitry in the falling edge of the input signal. This way it continuously maintains the direct
cycle voltage across the circuit.

The regulator
The regulator is used to give constant output whatever is its input voltage. The input to this
unit is nearly 15 V D.C. & its output voltage is constant to 5 V. & 12 V. since we are using two
different types of regulators 7805 & 7812.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Max Unit

Explanation
Almost all digital devices which we use require either TTL or CMOS logic levels.
Therefore the first step to connecting a device to the RS-232 port is to transform the RS-232 levels
back into 0 and 5 Volts. This is done by RS-232 Level Converters.

Two common RS-232 Level Converters are the 1488 RS-232 Driver and the 1489 RS-232
Receiver. Each package contains 4 inverters of the one type, either Drivers or Receivers. The
driver requires two supply rails, +7.5 to +15v and -7.5 to -15v. This may pose a problem in many
instances where only a single supply of +5V is present.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Another device is the MAX-232. It includes a Charge Pump, which generates +10V and -
10V from a single 5v supply. This I.C. also includes two receivers and two transmitters in the
same package. This is handy in many cases when we only want to use the Transmit and Receive
data Lines. We don't need to use two chips, one for the receive line and one for the transmitting.
There are also many variations of these devices. The large value of capacitors are not only bulky,
but also expensive. Therefore other devices are available which use smaller capacitors and even
some with inbuilt capacitors. However the MAX-232 is the most common, and thus we will use
this RS-232 Level Converter.

Dual Charge-Pump Voltage Converter


The first converter uses capacitor C1 to double the +5V input to +10V on C3 at the V+
output. The second converter uses capacitor C2 to invert +10V to -10V on C4 at the V- output.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Relay Unit

RELAYS
The stepper motor drive is used to drive the stepper motor since the stepper motor needs 12v and
350 mA for its operation. The ULN 2803 relay driver consists of 8 Darlington pair which
produces an output voltage of 50v and output current of 500 mA .Darlington arrays are ideally
suited for interfacing between low level logic circuitry and multiple peripheral power loads.
Typical power loads totaling over 260w can be controlled at an appropriate duty cycle depending
on the ambient temperature and number of drivers turned on simultaneously. Typical loads
include relays, solenoids, stepping motors, magnetic print hammers, multiplexed LED and

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


incandescent displays, and heaters. All devices feature open-collector outputs with integral clamp
diodes. The ULx2803A, ULx2803LW, ULx2823A, and ULN2823LWhave series input resistors
selected for operation directly with 5 V TTLor CMOS. These devices will handle numerous
interface needs particularly those beyond the capabilities of standard logic buffers. The
ULx2804A, ULx2804LW, ULx2824A, and ULN2824LWhave series input resistors for operation
directly from 6 V to 15 VCMOS or PMOS logic outputs. The ULx2803A/LW and
ULx2804A/LW 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 ULx2823A/LW and ULx2824A/LW will withstand 95 V in the off state. These
Darlington arrays are furnished in 18-pin dual in-line plastic packages (suffix A) or 18-lead
small-outline plastic packages (suffix LW). All devices are pinned with outputs opposite inputs
to facilitate ease of circuit board layout. Prefix ULN devices are rated for operation over the
temperature range of -20C to +85C; prefix ULQ devices are rated for operation to -40C.

FEATURES OF ULN2803

TTL, DTL, PMOS, or CMOS Compatible Inputs


Output Current to 500 mA
Output Voltage to 95 V
Transient-Protected Outputs
Dual In-Line Package or Wide-Body Small-Outline Package

ABSOLUTE MAXIMUM RATINGS

Output Voltage, VCE


(X2803x and x2804x) 50 V
(X2823x and x2824x) 95 V
Input Voltage, VIN 30 V
Continuous Output Current, IC 500 mA
Continuous Input Current, IIN 25 mA
Power Dissipation, PD
(One Darlington pair) 1.0 W
Operating Temperature Range, TA
Prefix ULN -20C to + 85C

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Prefix ULQ -40C to +85C
Storage Temperature Range, TS -55C to +150C
.

PIN OUT OF ULN2803

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


RELAYS:

A relays is an electrically operated switch current flowing through the coil of the relay create a
magnetic field which attracts a lever and changes the switch contacts. The coil current can on or
off so relays have two switch positions and they are double throw switches. Relays allow one
circuit to switch a second circuit which can be completely separate from the first.
Relays are usually SPDT or DPDT but they can have many more sets of switch contacts. In
our projects the relays have a coil, which works on 12v dc power supply and provide DPDT action
as an output. The coil of the relay passes a relatively large current, typically 30mA for a 12v relay
Most chips can not provide this current and a transistor is usually used to amplify the small IC
current to the larger value required for the relay coil. The maximum output current for the popular
555 timer IC is 200mA.so these devices can supply relay coils directly with out amplifications.
Relay coils produce brief high voltage spikes ,when they are switched off and this can
destroy transistor and ICs in the circuits to prevent the image protection diode is connected across
the relay coil.Soild state relays is used which has a Darlington transistor. These relays would be
ideal for applications where many relays are needed and power requirements are low. Due to their
small size, a large number of relays could be mounted on single printed circuit board. The current
required to operate these relays is significantly less than for mechanical relay types also these
devices may be less expensive than mechanical relays.

CHOOSING A RELAY:
When choosing a relay we need to consider the following features.
1. Physical size and pin arrangement.
2. Coil voltage.
3. Coil resistances
4. Switch ratings
5. Switch contact arrangement.

ADVANTAGES OF RELAYS:
Relays can switch AC and DC, transistors can only switch DC.
Relays can switch high voltages, transistors cannot.
Relays are a better choice for switching large current (>5A).
Relays can switch many contacts at once.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


DISADVANTAGES OF RELAYS:

Relays are bulkier than transistors for switching small current.


Relays cannot switch rapidly, transistors can switch many times per seconds
Relays use more power due to the current following through their coil.
Relays require more current than many chips can provide, so a low power transistor
may be needed to switch the current for the relays coil.

Output switching

Eight outputs are provided for controlling external devices. Each output line is driven by
one open-collector transistor pair in a ULN2803 (IC4). Fig.4 shows the equivalent circuit for one
channel of the ULN2803.

Fig.: the amount of current the ULN2803 can sink depends on the number of outputs in use.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Reproduced from the datasheet, this graph shows the maximum current per channel for 1-
8 simultaneously conducting outputs. For most controller applications, a duty cycle of 100%
should be assumed.

One ULN2803 output can switch a maximum load current of 500mA. However, when
more than one output is used, this must be dreaded according to the graph in Fig. For example,
with four outputs in use, the maximum current per channel is slightly less than 300mA.

Relay Switching

This unit provides actual switching of external device connected to the pin of relay. The
voltage of the coil of the relay is 6V. That means it will energies at minimum of 6 volts across it.
After energizing of the coil the mechanical key present inside the relay switches to its other
position and vice versa. This gives a heavy induced e.m.f. which can cost the rest of circuit to
burn out but this is prevented by using a diode in parallel with the coil in opposite direction
which is in-built in ULN2803.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


PCB LAYOUTS
Main Controlling Unit

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Power Supply Unit

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Max Unit

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Relay Unit

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


SMS BASED DEVICE SWITCHING AND STATUS MONITORING
SOFTWARE

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Section-V

Software

The Flowchart
Software Instruction

The Flowchart

If pass
Change pass
Change

Decode SMS & S/W devices Send SMS


Pass changed

Send SMS success


X

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


START

Initialize All System


Variables

OFF all Devices

Initialize LCD, Serial


Port

Greeting on LCD

Send F-Bus Initialization Command

IF RST PASS Reload default


? password

If SMS Check for IR


found

Delete SMS If Check for


IR SW

Check Password
Send IR msg If
SW

X
IF match
Print Invalid pass found Y Send SW msg

X X

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


SOFTWARE

#include <stdio.h>
#include "P89V51.h"
#include "Delay.h"
#include "LCD.h"
#include "Serial.h"
#include "FBus.h"
#include "Mem93CXX.h"

#define Buzzer P3_7


#define RstPass P3_3
#define IR P2_4
#define SW P2_5
#define WA P2_6
#define TE P2_7
#define TI P3_2

void Beep(unsigned char No, unsigned int Delay);

//Mobile Variables/////////////////////////////////////////////////////////////
unsigned char xdata ToMN2[6]={0x19,0x99,0x96,0x06,0x77,0x95};
unsigned char xdata ToMN1[6]={0x19,0x99,0x76,0x86,0x27,0x68};

unsigned char xdata SrCN[6]={0x00,0x00,0x00,0x00,0x00,0x00};


unsigned char xdata MyCN[6]={0x19,0x89,0x02,0x00,0x45,0x44}; //Orange
unsigned char xdata SrMN[6];
unsigned char xdata Msg[20],LenMsg,MEM;
//Mobile Variables\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

unsigned char idata Status[8];


unsigned char xdata Temp[50];
unsigned char i,j,NF;

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


void main(void) //execution starts here
{
P0=0;//initially off all the devices

Beep(3,30000);
SetSerial115200();
SetLCD();
SetMem93CXX();

for(i=0;i<8;i++)Status[i]='0';

LCD(1);
printf(" Welcome to ");
LCD(2);
printf(" V.E.S.P. ");
DelayL(80000);
LCD(1);
printf("SMS Based Device");
LCD(2);
printf("Switching and...");
DelayL(80000);
LCD(1);
printf("Monitoring Sys. ");
LCD(2);
printf("Project Done By ");
DelayL(80000);
LCD(1);
printf("Yash Doshi ");
LCD(2);
printf("Vaibhav Doshi ");
DelayL(80000);
LCD(1);

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


printf("Aniket Khedekar ");
LCD(2);
printf("Kaushal Joshi ");
DelayL(80000);
LCD(1);
printf("Under guidance..");
LCD(2);
printf(" Radha Sivadas ");
// DelayL(80000);

if(RstPass==0)
{
WriteMem93CXX(0,'v');
WriteMem93CXX(1,'e');
WriteMem93CXX(2,'s');
WriteMem93CXX(3,'p');
WriteMem93CXX(4,' ');
DelayL(40000);
LCD(0);
LCD(1);
printf("Pass Resetted...");
LCD(2);

printf("%c%c%c%c%c",ReadMem93CXX(0),ReadMem93CXX(1),ReadMem93CXX(
2),ReadMem93CXX(3),ReadMem93CXX(4));
}

SetFBus();

while(1)
{
LCD(1);
printf(" System Ready. ");

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


LCD(2);
printf("Waiting for SMS.");

if(!(LenMsg=GetSMS(Msg,SrMN,SrCN,&MEM,1000)))
{
if(IR==0)
{
LCD(1);
printf("IR Breaked......");
LCD(2);
printf("Sending SMS.....");
sprintf(Temp,"%c%c%c%c%c%c%c%c IR Breaked!IR
Breaked!IR
Brealed!!!!!!!!.",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],Status[
7]);
SendSMS(Temp,50,MyCN,ToMN1);
DelayL(60000);
continue;
}
if(SW==0)
{
LCD(1);
printf("SW Breaked......");
LCD(2);
printf("Sending SMS.....");
sprintf(Temp,"%c%c%c%c%c%c%c%c SW Breaked!SW
Breaked!SW
Brealed!!!!!!!!.",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],Status[
7]);
SendSMS(Temp,50,MyCN,ToMN1);
DelayL(60000);
sprintf(Temp,"%c%c%c%c%c%c%c%c SW Breaked!SW
Breaked!SW

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Brealed!!!!!!!!.",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],Status[
7]);
SendSMS(Temp,50,MyCN,ToMN2);
DelayL(60000);
continue;
}
if(WA==0)
{
LCD(1);
printf("Water Set Level ");
LCD(2);
printf("Reached. ");
sprintf(Temp,"%c%c%c%c%c%c%c%c Water Set Level
Reached.
",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],Status[7]);
SendSMS(Temp,50,MyCN,ToMN1);
DelayL(60000);
continue;
}
if(TE==0)
{
LCD(1);
printf("Temp. Set Level ");
LCD(2);
printf("Reached. ");
sprintf(Temp,"%c%c%c%c%c%c%c%c Temp. Set Level
Reached.
",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],Status[7]);
SendSMS(Temp,50,MyCN,ToMN1);
DelayL(60000);
continue;
}
if(TI==0)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


{
LCD(1);
printf("Timer Count ");
LCD(2);
printf("Completed. ");
sprintf(Temp,"%c%c%c%c%c%c%c%c Timer Count Completed.
",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],Status[7]);
SendSMS(Temp,50,MyCN,ToMN1);
DelayL(60000);
continue;
}
continue;
}

LCD(0);
LCD(1);
printf("Got SMS!!!!!!!!!");
LCD(2);
for(i=5;i<LenMsg;i++)printf("%c",Msg[i]);
Beep(2,60000);
DeleteSMS(MEM);
///////////////////////////////////////////start processing on device

if(Msg[0]==ReadMem93CXX(0)&&Msg[1]==ReadMem93CXX(1)&&Msg[2]==ReadMem9
3CXX(2)&&Msg[3]==ReadMem93CXX(3)&&Msg[4]==ReadMem93CXX(4))
{
if(Msg[5]=='p')

{
WriteMem93CXX(0,Msg[6]);
WriteMem93CXX(1,Msg[7]);
WriteMem93CXX(2,Msg[8]);
WriteMem93CXX(3,Msg[9]);

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


WriteMem93CXX(4,Msg[10]);

LCD(1);
printf("Password Changed");
LCD(2);
printf("Successfully....");

sprintf(Temp,"%c%c%c%c%c%c%c%c Password Changed


Successfully............",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],
Status[7]);
SendSMS(Temp,50,MyCN,SrMN);
DelayL(60000);
}
else
{
NF=0;
for(i=5;i<LenMsg;i++)
{
if(Msg[i]=='n')NF=0xff;
if(Msg[i]=='f')NF=0x00;
if(Msg[i]=='a')
{
P0=NF;
if(NF==0)for(j=0;j<8;j++)Status[j]='0';else
for(j=0;j<8;j++)Status[j]='1';
}
switch(Msg[i])
{
case '1':P0_0=NF;if(NF==0)Status[0]='0';else
Status[0]='1';break;
case '2':P0_1=NF;if(NF==0)Status[1]='0';else
Status[1]='1';break;

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


case '3':P0_2=NF;if(NF==0)Status[2]='0';else
Status[2]='1';break;
case '4':P0_3=NF;if(NF==0)Status[3]='0';else
Status[3]='1';break;
case '5':P0_4=NF;if(NF==0)Status[4]='0';else
Status[4]='1';break;
case '6':P0_5=NF;if(NF==0)Status[5]='0';else
Status[5]='1';break;
case '7':P0_6=NF;if(NF==0)Status[6]='0';else
Status[6]='1';break;
case '8':P0_7=NF;if(NF==0)Status[7]='0';else
Status[7]='1';break;
}
}
LCD(1);
printf("Command Executed");
LCD(2);
printf("Successfully....");

sprintf(Temp,"%c%c%c%c%c%c%c%c Command Executed


Successfully............",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],
Status[7]);
SendSMS(Temp,50,MyCN,SrMN);
DelayL(60000);
}
}
else
{
LCD(1);
printf("Invalid Password");
LCD(2);
printf("Request Denied!!");
DelayL(60000);

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


}
///////////////////////////////////////////stoped processing on device
}// end of while 1
}//end of main

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Beep(unsigned char No, unsigned int Delay)
{
unsigned char tNo;

for(tNo=1;tNo<=No;tNo++)
{
Buzzer=0;
DelayI(Delay);
Buzzer=1;
DelayI(Delay);
}
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


BASICS
OF
MICROCONTROLLER

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Section-VI

Basics of C

Introduction to Microcontrollers
The 89V51 Microcontroller
Features of 89V51
Pin Diagram & Explanation
Architecture of 89V51
Memory Organization of 89V51
Introduction to Microcontrollers
Definition
An embedded microcontroller is a chip which has a computer processor with all its
support functions (clock & reset), memory (both program and data), and I/O (including bus
interface) built into the device. These built in functions minimize the need for external circuits
and devices to be designed in the final application.

Types of Microcontroller
Creating applications for microcontrollers is completely different than any other
development job in computing and electronics. In most other applications one probably have a
number of subsystem and interfaces already available for his/her use. This is not the case with a
microcontroller where one is responsible for

Power distribution
System clocking
Interface design and wiring
System programming
Application programming

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Device programming

Before selecting a particular device for an application, it s important to understand what the
different options and features are and what they can mean with regard to developing application.

Embedded Microcontroller
When all the hardware required to run the application is provided on the chip, it is
refer to as an Embedded Microcontroller. All that is typically required to operate the device is
power, reset, and a clock. Digital I/O pins are provided to allow interfacing with external devices.

External Memory Microcontroller


Sometimes, the program memory is insufficient for an application or, during debug; a
separate ROM (or even RAM) would make the work easier. Some microcontrollers including the
8051 allow the connection of external memory.

An external memory microcontroller seems to primarily differ from a microprocessor in the


areas of built-in-peripheral features. These features could include memory device selection
(avoiding the need for external address decoders or DRAM address multiplexers), timers,
interrupt controllers, DMA, and I/O devices like serial ports.

Microcontroller Memory Types


There are number of different types of control store (Program Memory) that are available in
different versions and different manufacturers 8051s. There is a fairly simple convention that is
used to identify what type of control store a device has.

The following is the list of conventions used for 8X51-

X value Control Store Type


0 None
3 Mask ROM
7 EPROM
9 EEPROM/FLASH

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


The P89V51 microcontroller

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


64Kbytes of Flash programmable and erasable read only memory (PEROM). The device is
manufactured using Phillipss high-density nonvolatile memory technology and is compatible
with the industry-standard MCS-51 instruction set and pin out. The on-chip Flash allows the
program memory to be reprogrammed in-system or by a conventional nonvolatile memory
programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Phillips
P89V51 is a powerful microcomputer which provides a highly-flexible and cost-effective
solution to many embedded control applications.

The P89V51 is designed with static logic for operation down to zero frequency and
supports two Software selectable power saving modes. The Idle Mode stops the CPU while
allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The
Power-down Mode saves the RAM contents but freezes the oscillator disabling all other chip
functions until the next Hardware reset.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Features of P89V51RD2BN

Following is the features of 89V51 microcontroller as per the datasheet given by


Phillips-
80C51 Central Processing Unit
On-chip Flash Program Memory with In-System Programming
(ISP) and In-Application Programming (IAP) capability
Boot ROM contains low level Flash programming routines for
downloading via the UART
Can be programmed by the end-user application (IAP)
Parallel programming with 87C51 compatible hardware interface
to programmer
Six clocks per machine cycle operation (standard)
12 clocks per machine cycle operation (optional)
Speed up to 20 MHz with 6 clock cycles per machine cycle
(40 MHz equivalent performance); up to 33 MHz with 12 clocks
per machine cycle
Fully static operation
RAM expandable externally to 64 kbytes
Four interrupt priority levels
Seven interrupt sources
Four 8-bit I/O ports
Full-duplex enhanced UART
Framing error detection
Automatic address recognition
Power control modes
Clock can be stopped and resumed
Idle mode
Power down mode
Programmable clock out
Second DPTR register
Asynchronous port reset
Low EMI (inhibit ALE)
Programmable Counter Array (PCA)
PWM
Capture/compare

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Pin Diagram of P89V51:

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Architecture of P89V51
Block Diagram

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Brief Description
The P89V51 is a low-power, high-performance CMOS 8-bit microcomputer with
64K bytes of Flash programmable and erasable read only memory (PEROM). The device is
manufactured using Phillipss high-density nonvolatile memory technology and is compatible
with the industry-standard MCS-51 instruction set and pinout. The on-chip Flash allows the
program memory to be reprogrammed in-system or by a conventional nonvolatile memory
programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Phillips
P89V51 is a powerful microcomputer which provides a highly-flexible and cost-effective
solution to many embedded control applications.

Pin Description
VCC Supply voltage.
GND Ground.
Port 0
Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high
impedance inputs. Port 0 may also be configured to be the multiplexed low order
address/data bus during accesses to external program and data memory. In this mode P0 has
internal pull-ups. Port 0 also receives the code bytes during Flash programming, and
outputs the code bytes during program verification. External pull-ups are required during
program verification.

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

Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled
high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2
emits the high-order address byte during fetches from external program memory and during
accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this
application, it uses strong internal pull-ups when emitting 1s. During accesses to external
data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2
Special Function Register.
Port 2 also receives the high-order address bits and some control signals during Flash
programming and verification.

Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can
sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the
internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being
pulled low will source Current (IIL) because of the pull-ups. Port 3 also serves the
functions of various special features of the P89V51 as listed below:

o Port Pin Alternate Functions

P3.0 RXD (serial input port)


P3.1 TXD (serial output port)
P3.2 INT0 (external interrupt 0)
P3.3 INT1 (external interrupt 1)
P3.4 T0 (timer 0 external input)
P3.5 T1 (timer 1 external input)
P3.6 WR (external data memory write strobe)
P3.7 RD (external data memory read strobe)

o Port 3 also receives some control signals for Flash programming and verification.

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

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


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

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

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

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

XTAL2
Output from the inverting oscillator amplifier

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Memory Organization

Program Memory

The TEMIC C51 Microcontroller Family has separate


address spaces for program Memory and Data Memory. The
program memory can be up to 64 K bytes long. The lower 4 K
for the 80C51 (8 K for the 80C52, 16 K for the 83 C154 and 32
K for the 83C154D) may reside on chip.

Data Memory

The C51 Microcontroller Family can address up to 64


K bytes of Data Memory to the chip. The MOVX instruction
is used to access the external data memory (refer to the C51
instruction set, in this chapter, for detailed description of
instructions). The 80C51 has 128 bytes of on-chip-RAM (256
bytes in the 80C52, 83C154 and 83C154D) plus a number of
Special Function Registers (SFR). The lower 128 bytes of
RAM can be accessed either by direct addressing (MOV data
addr). or by indirect addressing (MOV @Ri).

Internal Data Memory Organization


Internal data memory is shown in Figure. The memory space is divided into three blocks,
which are generally referred to as the Lower 128, the Upper 128, and SFR space.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Internal data memory addresses are always 1 byte wide, which implies an address space of only
256 bytes. However, the addressing modes for internal RAM can in fact accommodate 384 bytes.
Direct addresses higher than 7FH access one memory space, and indirect addresses higher than
7FH access a different memory space. Thus, Figure 7 shows the Upper 128 and SFR space
occupying the same block of addresses, 80H through FFH, although they are physically separate
entities.

Scratch Pad RAM Organization


Figure shows how the lower 128 bytes
of RAM are mapped. The lowest 32 bytes are
grouped into 4 banks of 8 registers. Program
instructions call out these registers as R0
through R7. Two bits in the Program Status
Word (PSW) select which register bank is in
use. This architecture allows more efficient use
of code space, since register instructions are
shorter than instructions that use direct
addressing.

The 1KByte Memory


The next 16 bytes above the register banks form a block of bit-addressable memory
space. The microcontroller instruction set includes a wide selection of single-bit instructions, and
these instructions can directly address the 128 bits in this area. These bit addresses are 00H
through 7FH. All of the bytes in the Lower 128 can be accessed by either direct or indirect
addressing. The Upper 128 (Figure 9) can only be accessed by indirect addressing. The Upper
128 bytes of RAM are only in the devices with 256 bytes of RAM.

The SFR
Figure gives a brief look at the Special Function Register (SFR) space. SFRs include Port
latches, timers, peripheral controls, etc. These registers can only be accessed by direct
addressing. In general, all Phillips microcontrollers have the same SFRs at the same addresses in
SFR space as the P89V51 and other compatible microcontrollers. However, upgrades to the
P89V51 have additional SFRs. Sixteen addresses in SFR space are both byte- and bitaddressable.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


The bit-addressable SFRs are those whose address ends in 000B. The bit addresses in this area
are 80H through FFH.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


DEVELOPMENT
TOOLS

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Section-VII

Developments Tools

The Keil (Vision2)


The Eagle 4.11
Keil (Vision 2)
Introduction to C51 Cross Compiler
The Keil C51 Cross Compiler is an ANSI C Compiler that is written specifically to
generate fast, compact code for the 8051 microcontroller family. The C51 Compiler generates
object code that matches the efficiency and speed
of assembly programming.

Using a high-level language like C has many advantages over assembly language
programming:
Knowledge of the processor instruction set is not required. Rudimentary knowledge of the
memory structure of the 8051 CPU is desirable (but not necessary).

Details like register allocation and addressing of the various memory types and data types is
managed by the compiler.

Programs get a formal structure (which is imposed by the C programming language) and can be
divided into separate functions. This contributes to source code reusability as well as better
overall application structure.

The ability to combine variable selection with specific operations improves program
readability.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Keywords and operational functions that more nearly resemble the human thought process may
be used.

Programming and program test time is drastically reduced.

The C run-time library contains many standard routines such as: formatted output, numeric
conversions, and floating-point arithmetic.

Existing program parts can be more easily included into new programs because of modular
program construction techniques.

The language C is a very portable language (based on the ANSI standard) that enjoys wide
popular support and is easily obtained for most systems. Existing program investments can be
quickly adapted to other processors as needed.

Software Development Cycle in Keil


When we use the Keil Software tools, the
project development cycle is roughly the same as
it is for any other software development project.

1. Create a project, select the target chip from the


device database, and configure the tool settings.

2. Create source files in C or assembly.

3. Build your application with the project


manager.

4. Correct errors in source files.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


5. Test the linked application. A block diagram of the complete 8051 tool set may best
illustrate the development cycle.

Eagle (Easily Applicable Graphical Layout Editor)

The EAGLE is an editor, which is easy-to-use, yet powerful tool for designing printed
circuit boards (PCBs). It is a complete platform for the development of any type of complicated
& sophisticated multilayered PCBs. This software consist of the following tool

Schematic Editor

In this one can develop & design circuits for the required PCB.

Layout Editor

In this one can develop & design actual PCB structure required. This is done automatically by
the software using the circuit in the schematic editor itself.

Library Editor

This is very useful in case of customized component design that does not occur in the
predefined library according to our need.

Auto Router

This is an artificial intelligence based tool or subroutine that can do auto routing of the PCB
tracks designed.

Cam Processor

This is used to finally print the various layers of the designed PCB viz. Top Layer, Bottom
Layer, Component Layer, Masking Layer etc.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Section-VIII

PCB Design

The PCB design starts right from the selection of the laminates .The two
main types of base laminate are epoxy glass and phenolic paper laminates are
generally used for simple circuits. Though it is very cheap and can easily be
drilled, phenolic paper has poor electrical characteristics and it absorbs more
moisture than epoxy glass. Epoxy glass has higher mechanical strength.
The important properties that have to be considered for selecting the
PCB substrate are the dielectric strength, insulation resistance, Water
absorption property, coeff. Of thermal expansion, shear strength, hardness,
dimensional stability etc.

Manufacturing Process

The steps involved in manufacture are


1. Artwork preparation.

2. Resist preparation.

3. Resist application a fixing.

4. Acid etches.

5. Cleaning and inspection.

6. Resist removal.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


PCB Fabrication

The fabrication of a PCB includes basically of four steps.

A. Preparing the PCB pattern.

B. Transferring the pattern onto the PCB.

C. Developing the PCB.

D. Finishing i.e.) drilling, cutting, smoothing, turning etc.

Pattern designing is the primary step in fabricating a PCB in this step,


all interconnection between the components in the given circuit are converted into
PCB tracks several factors such as positioning, the diameter of holes ,the area that
each component would occupy ,the type of end terminal should be considered.

Transferring the PCB Pattern

The copper side of the PCB should be thoroughly cleaned with the help of
alcoholic spirit or petrol must be completely free from dust and other contaminants.
The mirror image of the pattern must be carbon copied and to the laminate
the complete pattern may now be made each resistant with the help of paint and
thin brush.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


DEVELOPING

In this developing all excessive copper is removed from the board and only
the printed pattern is left behind. About 100ml of tape water should be heated to
75 C and 30.5 grams of FeCl3 added to it, the mixture should be thoroughly
stirred and a few drops of HCl may be added to speed up the process.
The board with its copper side facing upward, should be placed in a flat
bottomed plastic tray and the aqueous solution of FeCl 2 poured in the etching
process would take 40 to 60 min to complete.
After etching the board it should be washed under running water and then
held against light .the printed pattern should be cleanly visible. The paint should
be removed with the help of thinner.

Finishing Touches

After the etching is completed, hole of suitable diameter should be drilled,


then the PCB may be tin plated using an ordinary 35 Watts soldering rod along
with the solder core ,the copper side may be given a coat of varnish to prevent
oxidation.

Drilling
Drills for PCB use usually come with either a set of collects of various sizes or a
3-Jaw chuck. For accuracy however 3-jaw chunks arent brilliant and small drill
below 1 mm from grooves in the jaws preventing good grips.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Soldering

Begin the construction by soldering the resistors followed by the


capacitors and the LEDs diodes and IC sockets. Dont try soldering an IC directly
unless you trust your skill in soldering. All components should be soldered as
shown in the figure. Now connect the switch and then solder/screw if on the PCB
using multiple washers or spaces. Soldering it directly will only reduce its height
above other components and hamper in its easy fixation in the cabinet. Now
connect the battery lead.

Assembling
The circuit can be enclosed in any kind of cabinet. Before fitting the PCB
suitable holes must be drilled in the cabinet for the switch, LED and buzzer. Note
that a rotary switch can be used instead of a slide type.
Switch on the circuit to be desired range. It will automatically start its timing
cycles. To be sure that it is working properly watch the LED flash. The
components are selected to trigger the alarm a few minutes before the set limit.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Section-IX

Wireless automation and control


Alarm and notification systems
Remote monitoring
Data and event logging
Machine communication
FTP (file transfer) uploading
Telnet, email, text messaging communications

Mobile Mapping applications


The mobile applications could deliver the Map Information in different ways
such as a) Text: Address and phone of nearest bank, driving direction, Job dispatch
operations based on users location. b) Image: The path to the service location, on a map.
c) Voice: Driving directions, Job dispatch operations. d) Video: Fly-By movies, Traffic
congestion Status. There are multifarious applications for Mobile mapping of which the
most prominent applications are described below.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Routing applications
Routing could be one of the most popular GIS based solution on mobile
terminals. The mobile user could indicate his origin, destination and via locations to the
mapping system. Some inputs can also be taken from the GPS device directly. With good
transmission speeds (GPRS and higher), the mobile user can also have route guidance (If
GPS device is used along with the mobile terminal) on the move. The mobile terminal
would get the route result from the server in the form of a detailed way-description- the
way description itself can be a text-based display or a voice based directions. The route can
be highlighted on the map and shown on the Mobile Terminal. Routing applications can
result in the following data being delivered to the Mobile terminal.

Search facility applications


such location-based applications could search the map database for locations queried
according to the preferences given by the user. The user could request information
regarding any facility like Hotels, Banks etc around any given location within certain radius.
The users location itself can be taken from the GPS device if it is attached to the mobile
terminal.

Job dispatch and Fleet management applications


This is more of a messaging solution that works with a GPS device or a Mobile
positioning system. The field workers, sales people, trucks can be located on a
map. The system can track them, send them jobs, receive job progress and job
completed forms.

Live Traffic reports


Wireless cameras can be placed at important road crossings that record and
transmit the live traffic images to a web-server. This way the user on the move can
plan to take an alternative route, if required, to his destination by looking at the live
images that come to his mobile terminal. The images can be static images that keep
refreshing at regular intervals or as video.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


The "LOCATION" command enables the user to determine the geographic
location of the vehicle; this information is useful in a variety of situations including
monitoring the progress of the vehicle towards a destination and assisting in
locating the vehicle should the vehicle be stolen. Preferably the user's
communication device 10 is able to display a map on its screen showing the
location of the vehicle as determined by the received coordinates. Alternatively,
device 10 could store the received location coordinates and transmit these
coordinates to a separate device capable of determining and displaying the
coordinate information on an appropriate map. The illustrated commands are merely
exemplary of a variety of commands that could be utilized to remotely control
various functions and request information concerning the vehicle (or other
apparatus) to be transmitted to the user. It will be apparent that uses for the remote
control device are not limited to applications associated with a vehicle.

Thus, instead of the manual meter reading method by the meter man, one solution to
the problem proposes a method of automatically uploading a meter age of the meter
through a cable network. But this method preconditions that a dedicated line and a cable
network should be installed in each subscriber's household nationwide. This can be very
expensive.

The meter reading system, in one embodiment, comprises a meter reading unit
in communication with at least one utility meter; a converter unit for converting
meter age information provided by the utility meter into a digital signal; a
multiplexer for selecting the digital signal. A controller for controlling the
multiplexer's selection based on number of meters in communication with the meter
reading system, may be also included.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Section-X

Conclusion

Conclusion
By the realization of above proposed system we can learn many aspects of a digital
electronics circuit. This will give the complete knowledge of designing microcontroller based
system and developing embedded software.

Operational basics

System operation is quite straightforward when any of the digital inputs change state,
the controller sends a pre-programmed SMS message to the nominated mobile number.
Conversely, when you want to turn any of the outputs on or off, you send a message to the
controller.

The messages used in both directions are programmed during the setup procedure. This
allows the use of messages related to the task at hand. For example, you might want to assign
the message "pump" to turn on the first output and "nopump" to turn it off. This means that you
dont need to remember which output the pump is connected to or which state (high or low) is
on or off.

The controller also recognizes a number of unique messages, called "in-built


commands", that can be sent from another mobile to program the system during setup, as well as
modify system behavior during normal operation. A summary of all these commands appears in
Table.2. Before we look at how to set up the controller, lets look at each command in detail.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


SECURITY

While its not strictly necessary to program a password during setup and testing, we
recommend that you do so before "going live". A password is an effective way of preventing
someone else taking control of the module without your knowledge.

Once youve successfully logged in, the controller will only accept messages from your
mobile phone number. Messages from all other numbers are simply ignored. An exception to
this is the LOGIN command itself, which can be issued from any mobile number at any time,
regardless of whether youre already logged in or not. This allows you to regain control of the
system using a second phone should your current phone be lost or stolen.

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


Section-XI

Bibliography

http://www.google.co.in
http://www.imagesco.com/catalog/index.html
http://nationalsemiconductors.com
http://www.electronics-lab.com/projects/index.html
http://www.electronicsforu.com/electronicsforu/lab/

SMS BASED DEVICE SWITCHING AND STATUS MONITORING


SMS based device switching and
status monitoring

Project Report
Submitted
By
Yash Doshi
Vaibhav Doshi
Aniket Khedekar
Kaushal Joshi

Under Guidance Of
Mrs. Radha sivadas

DEPARTMENT OF INDUSTRIAL ELECTRONICS


VIVEKANAND EDUCATION SOCIETYS POLYTECHNIC,
SINDHI SOCEITY, CHEMBUR
MUMBAI-400071
YEAR: 2007-2008

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

You might also like