SMS Device Control and Monitoring System
SMS Device Control and Monitoring System
Project report
On
INDUSTRIAL ELECTRONICS
BY
Yash doshi
Vaibhav doshi
Aniket khedekar
Kaushal joshi
Under Guidance Of
2007-2008
Introductory-------------------------------------------------------
Introduction
Technology Used
Features
Section II
Overview-----------------------------------------------------------
Development Stages & Process
Section III
System Overview-------------------------------------------------
Connector Details
Brief Explanation
Section IV
Section V
Software-------------------------------------------------------
Flowchart
Coding
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 -----------------------------------------------
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.
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.
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.
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 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.
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.
Features
The following are the prominent features of SMS based device switching and status
monitoring
Overview
Testing
This time we tested our project for actual working, after loading the software into
the microcontroller. Any errors found were removed successfully.
Running
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 Overview
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.
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.
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.
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).
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.
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.
Now that we know how to send frames on the bus, we should look at sending an SMS
message.
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.
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)
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
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.
Circuit Diagram
This section provides the complete design details and circuit description of all the units used
in the project.
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.
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.
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.
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.
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.
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
FEATURES OF ULN2803
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.
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.
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.
Software
The Flowchart
Software Instruction
The Flowchart
If pass
Change pass
Change
Greeting on LCD
Check Password
Send IR msg If
SW
X
IF match
Print Invalid pass found Y Send SW msg
X X
#include <stdio.h>
#include "P89V51.h"
#include "Delay.h"
#include "LCD.h"
#include "Serial.h"
#include "FBus.h"
#include "Mem93CXX.h"
//Mobile Variables/////////////////////////////////////////////////////////////
unsigned char xdata ToMN2[6]={0x19,0x99,0x96,0x06,0x77,0x95};
unsigned char xdata ToMN1[6]={0x19,0x99,0x76,0x86,0x27,0x68};
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);
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. ");
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
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]);
LCD(1);
printf("Password Changed");
LCD(2);
printf("Successfully....");
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
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);
}
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
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
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.
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.
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
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 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.
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
Program Memory
Data Memory
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.
Developments Tools
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.
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.
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.
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
2. Resist preparation.
4. Acid etches.
6. Resist removal.
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.
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
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.
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.
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.
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.
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.
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/
Project Report
Submitted
By
Yash Doshi
Vaibhav Doshi
Aniket Khedekar
Kaushal Joshi
Under Guidance Of
Mrs. Radha sivadas