109
INTRODUCTION 1.1 OBJECTIVE OF THE WORK To provide people with a comfortable and convenient living environment, smart home has become an important research issue. Automatic and intelligent technologies are applied to the home environment to improve the quality of life. This reminding mechanism for the user in a smart home environment. We focus on objects that the user would bring along when he/she goes out. The RFID technology is used to sense the objects the user brings along at the front door. In the object database, an object is recorded not only by its name along with a unique RFID number, but also its class. When the user leaves home, the reminder system checks the objects in his/her bags and pockets, and compares the objects with a list of objects generated by the system according to the date of the week and the events on the calendar. The system then sends a reminder object list to the user by using speaker. The background setting of this system is in a general home environment. An RFID reader is installed near the front door and RFID tags are attached to the objects the user would take out. Whenever the user goes out, the objects he/she brings along with are detected by the reader and saved in the database. 1

jkm

Embed Size (px)

Citation preview

Page 1: jkm

INTRODUCTION

1.1 OBJECTIVE OF THE WORKTo provide people with a comfortable and convenient living environment,

smart home has become an important research issue. Automatic and intelligent

technologies are applied to the home environment to improve the quality of life.

This reminding mechanism for the user in a smart home environment. We

focus on objects that the user would bring along when he/she goes out. The RFID

technology is used to sense the objects the user brings along at the front door. In the

object database, an object is recorded not only by its name along with a unique RFID

number, but also its class. When the user leaves home, the reminder system checks

the objects in his/her bags and pockets, and compares the objects with a list of objects

generated by the system according to the date of the week and the events on the

calendar. The system then sends a reminder object list to the user by using speaker.

The background setting of this system is in a general home environment. An

RFID reader is installed near the front door and RFID tags are attached to the objects

the user would take out. Whenever the user goes out, the objects he/she brings along

with are detected by the reader and saved in the database.

We are using GSM for alerting the user by sending message or calling them.

We are using like fire sensor, gas sensor, smoke sensor, IR transmitter and receiver,

LDR which contributes in making a complete smart home.

1

Page 2: jkm

1.2 BLOCK DIAGRAM

Fig 1.1 Block Diagram

2

Page 3: jkm

INTRODUCTION TO EMBEDDED SYSTEMS

An embedded system is a special-purpose system in which the computer

is completely encapsulated by or dedicated to the device or system it controls.

Unlike a general-purpose computer, such as a personal computer, an embedded

system performs one or a few pre-defined tasks, usually with very specific

requirements. Since the system is dedicated to specific tasks, design engineers

can optimize it, reducing the size and cost of the product. Embedded systems

are often mass-produced, benefiting from economies of scale.

Personal digital assistants (PDAs) or handheld computers are generally

considered embedded devices because of the nature of their hardware design,

even though they are more expandable in software terms. This line of definition

continues to blur as devices expand.

Physically, embedded systems range from portable devices such as digital

watches and MP3 players, to large stationary installations like traffic lights,

factory controllers, or the systems controlling nuclear power plants. In terms of

complexity embedded systems can range from very simple with a single

microcontroller chip, to very complex with multiple units, peripherals and

networks mounted inside a large chassis or enclosure.

2.1 EXAMPLES OF EMBEDDED SYSTEMS1 .Automatic teller machines (ATMs)

2. Cellular telephones and telephone switches

3. Engine controllers and antilock brake controllers for automobiles

4. Handheld calculators, Handheld computers

5. Medical equipment

6. Personal digital assistant, Videogame consoles

7. Computer peripherals such as routers and printers

8. Industrial controllers for remote machine operation.

3

Page 4: jkm

RF-ID

3.1 INTRODUCTION TO RF-IDRadio Frequency Identification (RFID) is a general term that is used to

describe a system that transmits the identity (in the form of a unique serial number) of

an object wirelessly, using radio waves. RFID is evolving as a major technology

enabler for tracking goods and assets around the world. A great deal of attention is

being paid to RFID by the IT industry, media and analysts. According to studies by

Benchmark Research, in 2004 three quarters of manufacturing companies are now

aware of RFID, of which a third are already using, piloting or investigating RFID

applications for their organizations.

Fig 3.1 Radio Frequency Identification (RFID) Circuit

Anticipating the potential benefits of RFID, many of the world’s major

retailers are trialing RFID tagging for pallets and cases shipped into and out of their

distribution centres. The consequence of this RFID activity in the retail sector is likely

to impact on around 200,000 manufacturers and suppliers globally, and will fuel the

market for hardware and software to support RFID.

RFID has many applications outside of the retail supply chain including many

familiar ones such as vehicle security, commuter tags and security badges for access

control into buildings.

4

Page 5: jkm

3.2 THE DEVELOPMENT OF RFIDOver the years methods for capturing and storing information have evolved

from paper and card systems, through keyboard data entry, bar code data capture and

are now augmented by technological improvements such as touch screens on the shop

floor. All of these initiatives have been aimed at improving accuracy, completeness

and timeliness of information. However these all rely on access to a host computer

system to make use of data collected.

So, how does RFID differ from other methods of identification and data

capture? A typical RFID system is made up of three components: tags, readers and the

host computer system.

3.2.1 TAGS

An RFID tag is a tiny radio device that is also referred to as a transponder,

smart tag, smart label or radio barcode. The tag comprises a simple silicon microchip

(typically less than half a millimeter in size) attached to a small flat aerial and

mounted on a substrate. The whole device can then be encapsulated in different

materials (such as plastic) dependent upon its intended usage. The finished tag can be

attached to an object, typically an item, box or pallet and read remotely to ascertain its

identity, position or state.

3.2.2 READERS

The reader, sometimes called an interrogator or scanner, sends and receives

RF data to and from the tag via antennae.

A reader may have multiple antennae that are responsible for sending and

receiving radio waves. The readers can be fixed or mobile, can read information

stored on the tags and write information to them. This can be achieved without direct

line of sight and in environments where traditional data collection could not operate.

A major advantage is that information can be written to the tag multiple times so

storing a history that travels with the article.

5

Page 6: jkm

3.2.3 HOST COMPUTER

The data acquired by the readers is then passed to a host computer, which may

run specialist RFID software or middleware to filter the data

and route it to the correct application, to be processed into useful information.

RFID is not a new technology, in fact it was first used by the US military

during WWII, but wider deployment chain was slow due to the high costs of

equipment and its limited reliability in volume environments. RFID equipment has

steadily fallen in price as volumes increase and microchip unit production costs fall.

With the ability to store several kilobytes of data in addition to the ‘number plate’

identifier it could be viewed as a form of ‘mass distributed database’ that has the

potential to become ubiquitous - billions of tags in daily use throughout the world on

all objects that are produced, stored, moved, sold and maintained.

3.3 AUTOMATIC IDENTIFICATIONRFID technologies are grouped under the more generic Automatic

Identification (Auto-ID) technologies. Examples of other Auto-ID technologies

include Smartcards and Barcodes. RFID is often positioned as next generation bar-

coding because of its obvious advantages over barcodes. However, in many

environments it is likely to co-exist with the barcode for a long time. The barcode

labels that triggered a revolution in identification systems back in the 1970’s are now

cheap and commonly used, but have several limitations:

Low storage capacity

1. They only represent a family of items and not an individual or unique item

durability (as mostly printed paper)

2. Low read range

3. They can only be read when line of sight is established

4. They can only be read one at a time

5. They cannot be written to or reprogrammed

6

Page 7: jkm

3.4WHAT IS RFID AND HOW WILL IT HELP YOU?Radio Frequency Identification (RFID) is a silicon chip-based transponder that

communicates via radio waves. RFID has been commercially available for many

years, but the latest RFID developments now offer the compatibility with an express

logistics and transport system to enable the following potential improvements to

service:

1. Increased security of your package and items within your shipment.

2. Visibility of items within your shipment without opening the package

3. Later cut-offs due to automated and simultaneous identification

4. “Near” real time track and trace, which is dynamic, automated and proactiv

through links to GPS (global positioning system) and communications systems

5. Condition monitoring (eg, temperature, vibration, humidity) through links to micro

sensors

6. Counterfeit protection through validation of genuine goods throughout the logistics

process - Intellectual Property Rights (IPR).

3.5 WHY RFID TECHNOLOGY?Identification processes that rely on AIDC technologies are significantly

more reliable and less expensive than that are not automated.

RFID represents a technological advancement in AIDC because it offers

advantages that are not available in other AIDC systems such as bar codes. RFID

offers these advantages because it relies on radio frequencies to transmit information

rather than light, which is required for optical AIDC technologies.

RFID products often support other features that bar codes and other AIDC

technologies do not have, Without optical line of sight, because radio waves can

penetrate many materials, At greater speeds, because many tags can be read quickly,

whereas optical technology often requires time to manually reposition objects to

make their bar codes visible, and Over greater distances, because many radio

technologies can transmit and receive signals more effectively than optical

technology under most operating conditions. such as rewritable memory, security

features, and environmental sensors that enable the RFID technology to record a

history of events. The types of events that can be recorded include temperature

changes, sudden shocks, or high humidity. Today, people typically perceive the

7

Page 8: jkm

label identifying a particular object of interest as static, but RFID technology can

make this label dynamic or even “smart” by enabling the label to acquire data about

the object even when people are not present to handle it.

RFID is short for Radio Frequency Identification. Generally a RFID system

consists of 2 parts. A Reader, and one or more Transponders, also known as

Tags. RFID systems evolved from barcode labels as a means to automatically identify

and track products and people. You will be generally familiar with RFID systems as

seen in:

3.5.1ACCESS CONTROL FID Readers placed at entrances that require a person to pass their proximity

card (RF tag) to be “read' before the access can be made.

3.5.2CONTACT LESS PAYMENT SYSTEMS

RFID tags used to carry payment information. RFIDs are particular suited to

electronic Toll collection systems. Tags attached to vehicles, or carried by

people transmit payment information to a fixed reader attached to a Toll station.

Payments are then routinely deducted from a users account, or information is changed

directly on the RFID tag.

3.5.3PRODUCT TRACKING AND INVENTORY CONTROL

RFID systems are commonly used to track and record the movement of

ordinary items such as library books, clothes, factory pallets, electrical goods and

numerous items.

3.6 HOW DO RFIDS WORKShown below is a typical RFID system. In every RFID system the transponder

Tags contain information. This information can be as little as a single binary bit , or

be a large array of bits representing such things as an identity code, personal medical

information, or literally any type of information that can be stored in digital binary

format

Shown is a RFID transceiver that communicates with a passive Tag. Passive tags

have no power source of their own and instead derive power from the incident

electromagnetic field. Commonly the heart of each tag is a microchip. When the Tag

8

Page 9: jkm

enters the generated RF field it is able to draw enough power from the field to access

its internal memory and transmit its stored information. When the transponder Tag

draws power in this way the resultant interaction of the RF fields causes the voltage at

the transceiver antenna to drop in value. This effect is utilized by the Tag to

communicate its information to the reader. The Tag is able to control the amount of

power drawn from the field and by doing so it can modulate the voltage sensed at the

Transceiver according to the bit pattern it wishes to transmit.

Fig3.2 RFID System

3.6 HISTORY OF RFIDRadio frequency identification has been around for decades. It’s generally said

that the roots of radio frequency identification technology can be traced back to

World War II. The Germans, Japanese, Americans and British were all using radar—

which had been discovered in 1935 by Scottish physicist Sir Robert Alexander

Watson-Watt—to warn of approaching planes while they were still miles away. The

problem was there was no way to identify which planes belonged to the enemy and

which were a country’s own pilots returning from a mission. The Germans discovered

that if pilots rolled their planes as they returned to base, it would change the radio

9

Page 10: jkm

signal reflected back. This crude method alerted the radar crew on the ground that

these were German planes and not Allied aircraft (this is, essentially, the first passive

RFID system).

INTRODUCTION TO GSM

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

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

mobile operator perspective, a GSM modem looks just like a mobile phone. When a

GSM modem is connected to a computer, this allows the computer to use the GSM

modem to communicate over the mobile network. While these GSM modems are

most frequently used to provide mobile internet connectivity, many of them can also

be used for sending and receiving SMS and MMS messages. A GSM modem can be a

dedicated modem device with a serial, USB or Bluetooth connection, or it can be a

mobile phone that provides GSM modem capabilities.

A GSM modem exposes an interface that allows applications such as Now

SMS to send and receive messages over the modem interface. The mobile operator

charges for this message sending and receiving as if it was performed directly on a

mobile phone. To perform these tasks, a GSM modem must support an “extended AT

command set” for sending/receiving SMS messages.

Fig 4.1 GSM Modem

GSM modems can be a quick and efficient way to get started with SMS,

because a special subscription to an SMS service provider is not required. In most

parts of the world, GSM modems are a cost effective solution for receiving SMS

messages, because the sender is paying for the message delivery.

10

Page 11: jkm

4.1 ARCHITECTURE OF GSM SYSTEM A GSM network is composed of several functional entities, whose functions

and interfaces are specified. Figure 1 shows the layout of a generic GSM network.

The GSM network can be divided into three broad parts. The Mobile Station is carried

by the subscriber. The Base Station Subsystem controls the radio link with the Mobile

Station. The Network Subsystem, the main part of which is the Mobile services

Switching Center (MSC), performs the switching of calls between the mobile users,

and between mobile and fixed network users. The MSC also handles the mobility

management operations. The Mobile Station and the Base Station Subsystem

communicate across the air so known as the air interface or radio link.

Architecture of GSM system consist of three parts .They Are

(i)Base Station Subsystem (BSS)

(ii)Network Switching Subsystem (NSS)

(Iii)Operation Support Subsystem (OSS)

Fig: 4.2 Architecture of GSM

11

Page 12: jkm

4.1.1MOBILE STATION

The mobile station (MS) consists of the mobile equipment (the terminal) and a

smart card called the Subscriber Identity Module (SIM). The SIM provides personal

mobility, so that the user can have access to subscribed services irrespective of a

specific terminal. By inserting the SIM card into another GSM terminal, the user is

able to receive calls at that terminal, make calls from that terminal, and receive other

subscribed services. The mobile equipment is uniquely identified by the International

Mobile Equipment Identity (IMEI). The SIM card contains the International Mobile

Subscriber Identity (IMSI) used to identify the subscriber to the system, a secret key

for authentication, and other information. The IMEI and the IMSI are independent,

thereby allowing personal mobility. The SIM card may be protected against

unauthorized use by a password or personal identity number.

4.1.2 BASE STATION SUBSYSTEM

The Base Station Subsystem is composed of two parts, the Base Transceiver

Station (BTS) and the Base Station Controller (BSC). These communicate across the

standardized Abis interface, allowing (as in the rest of the system) operation between

components made by different suppliers. The Base Transceiver Station houses the

radio transceivers that define a cell and handles the radio-link protocols with the

Mobile Station. In a large urban area, there will potentially be a large number of BTSs

deployed, thus the requirements for a BTS are ruggedness, reliability, portability, and

minimum cost. The Base Station Controller manages the radio resources for one or

more BTSs. It handles radio-channel setup, frequency hopping, and handovers, as

described below. The BSC is the connection between the mobile station and the

Mobile service Switching Center (MSC).

4.1.3 NETWORK SWITCHING SUBSYSTEM

The central component of the Network Subsystem is the Mobile services

Switching Center (MSC). It acts like a normal switching node of the PSTN or ISDN,

and additionally provides all the functionality needed to handle a mobile subscriber,

such as registration, authentication, location updating, handovers, and call routing to a

12

Page 13: jkm

roaming subscriber. These services are provided in conjunction with several

functional entities, which together form the Network Subsystem.

The MSC provides the connection to the fixed networks (such as the PSTN or

ISDN). Signalling between functional entities in the Network Subsystem uses

Signalling System Number 7 (SS7), used for trunk signalling in ISDN and widely

used in current public networks. There are three different data bases in the NSS. They

are

1. Home Location Register (HLR): The Home Location Register (HLR) and

Visitor Location Register (VLR), together with the MSC, provide the call-routing and

roaming capabilities of GSM. The HLR contains all the administrative information of

each subscriber registered in the corresponding GSM network, along with the current

location of the mobile. The location of the mobile is typically in the form of the

signaling address of the VLR associated with the mobile as a distributed database

station. The actual routing procedure will be described later. There is logically one

HLR per GSM network, although it may be implemented

2. Visitor Location Register VLR): The Visitor Location Register (VLR)

contains selected administrative information from the HLR, necessary for call control

and provision of the subscribed services, for each mobile currently located in the

geographical area controlled by the VLR. Although each functional entity can be

implemented as an independent unit, all manufacturers of switching equipment to date

implement the VLR together with the MSC, so that the geographical area controlled

by the MSC corresponds to that controlled by the VLR, thus simplifying the

signalling required.

3. Authentication Center (AUC): The other two registers are used for

authentication and security purposes. The Equipment Identity Register (EIR) is a

database that contains a list of all valid mobile equipment on the network, where each

mobile station is identified by its International Mobile Equipment Identity (IMEI). An

IMEI is marked as invalid if it has been reported stolen or is not type approved. The

Authentication Center (AUC) is a protected database that stores a copy of the secret

key stored in each subscriber's SIM card, which is used for authentication and

encryption over the radio channel.4.2 GSM NETWORK OPERATORS

13

Page 14: jkm

T-Mobile and Cingular operate GSM networks in the United States on the

1,900 MHz band. GSM networks in other countries operate at 900, 1,800, or 1,900

MHz

4.3 GSM CARRIER FREQUENCIES GSM networks operate in a number of different carrier frequency ranges

(separated into GSM frequency ranges for 2G and UMTS frequency bands for 3G),

with most 2G GSM networks operating in the 900 MHz or 1800 MHz bands. Where

these bands were already allocated, the 850 MHz and 1900 MHz bands were used

instead (for example in Canada and the United States). In rare cases the 400 and

450 MHz frequency bands are assigned in some countries because they were

previously used for first-generation systems. Most 3G networks in Europe operate

in the 2100 MHz frequency band. Regardless of the frequency selected by an

operator, it is divided into timeslots for individual phones to use. This allows eight

full-rate or sixteen half-rate speech channels per radio frequency. These eight radio

timeslots (or eight burst periods) are grouped into a TDMA frame. Half rate channels

use alternate frames in the same timeslot. The channel data rate for all 8 channels is

270.833 Kbit/s, and the frame duration is 4.615 ms. The transmission power in the

handset is limited to a maximum of 2 watts in GSM850/900 and 1 watt in

GSM1800/1900.

4.4 GSM AT COMMANDS AT Commands are used to perform different operations is GSM module

Short message commands

4 .4.1PREFERRED MESSAGE FORMAT +CMGF DESCRIPTION

The message formats supported are text mode and PDU mode. In PDU mode, a

complete SMS Message including all header information is given as a binary string

(in hexadecimal format).Therefore, only the following set of characters is allowed:

{‘0’,’1’,’2’,’3’,’4’,’5’,’6’,’7’,’8’,’9’, ‘A’,‘B’,’C’,’D’,’E’,’F’}. Each pair or characters

are converted to a byte (e.g.: ‘41’ is converted to the ASCII character ‘A’, whose

ASCII code is 0x41 or 65). In Text mode, all commands and responses are in ASCII

characters.

The format selected is stored in EEPROM by the +CSAS command.Syntax:

Command syntax: AT+CMGF

Command Possible responses

14

Page 15: jkm

AT+CMGF?

Note :possible message format

+CMGF=1

Ok

Note :Text mode

Table 4.1 Command syntax: AT+CMG

4.4.2 SEND MESSAGE + CMGS

To send a message in text mode CMGS command usedDescription:

The <address> field is the address of the terminal to which the message is

sent. To send the message, simply type, <ctrl-Z> character (ASCII 26). The text can

contain all existing characters except <ctrl-Z> and <ESC> (ASCII 27). This command

can be aborted using the <ESC> character when entering text. In PDU mode, only

hexadecimal characters are used (‘0’…’9’,’A’…’F’).

Syntax: In SMS text mode, the syntax of the +CMGS AT command is: (Optional

parameters are enclosed in square brackets.)

+CMGS= address[, address _type]<CR> sms_ message _body<Ctrl+z>Before we

discuss each of the parameters, let's see an example that gives you some idea of how

an actual command line should look like:

AT+CMGS="+85291234567",145<CR>This is an example for illustrating the syntax

of the +CMGS AT command in SMS text mode.<Ctrl+z>

The address Parameter

The first parameter of the +CMGS AT command, address, specifies the

destination address to send the SMS message to. Usually it is a mobile number

formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163). For

example, "+85291234567", "91234567", etc. Note that the value passed to the address

parameter should be a string, i.e. it should be enclosed in double quotes.

The address type parameter to The second parameter of the +CMGS AT command,

address type, specifies the type of the address assigned to the address parameter. Two values

are commonly used. They are 129 and 145.As address type is an optional parameter, it can be

omitted. If you do so, the GSM/GPRS modem or mobile phone will use the default value of

the address type parameter, which is.

1. 129 if the value of address does not start with a "+" character. For example,

"85291234567".

15

Page 16: jkm

2. 145 if the value of address starts with a "+" character. For example,

"+85291234567".

The <CR> Character <CR>, which represents the carriage return character,

follows the address_type parameter. When the GSM/GPRS modem or mobile phone

receives the carriage return character, it will send back a prompt formed by these four

characters: the carriage return character, the linefeed character, the ">" character and

the space character.

The sms_message_body Parameter

The third parameter of the +CMGS AT command, sms_message_body, specifies the

body of the SMS message to be sent. Entering the <Esc> character will cancel the

+CMGS AT command.

The <Ctrl+z> Character

When you finish entering the SMS message body, you have to enter the <Ctrl+z>

character to mark the end of the SMS message body. The GSM/GPRS modem or

mobile phone will then attempt to send the SMS message the SMS center

4.4.3 READ MESSAGE +CMGR

The AT command +CMGR (command name in text: Read Message) is used

to read a message from a message storage area. The location of the message to be read

from the message storage area is specified by an index number. The message to be

retrieved by the AT command +CMGR does not necessarily have to be an SMS

message. It can be of other message types such as status reports and cell broadcast

messages, but we will only focus on SMS messages here.

Format of the Information Response of the +CMGR AT Command in SMS Text

Mode:

If the GSM/GPRS modem or mobile phone successfully reads the SMS

message from message storage, it will return an information response to the

computer / PC. In SMS text mode, the format of the information response of the

+CMGR AT command is different for different message types. In the sections that

follow, we assume the message to be read is an SMS message but not of other

message types like status reports and cell broadcast messages.

16

Page 17: jkm

ATMEL MICROCONTROLLER5.1 GENERAL DESCRIPTION

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

with 8K bytes of Flash programmable and erasable read only memory (PEROM). The

device is manufactured using Atmel’s high density nonvolatile memory technology

and is compatible with the industry standard 80S51 and 80S52 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 Atmel AT89C52 is a powerful

microcomputer which provides a highly flexible and cost effective solution to many

embedded control applications.

5.2 FEATURES OF MICROCONTROLLERThe AT89S52 provides the following standard features: 8Kbytes of Flash, 256

bytes of RAM, 32 I/O lines, three 16-bittimer/counters, a six-vector two-level

interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry.

In addition, the AT89S52 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.

5.3 PIN CONFIGURATION

Fig 5.1 Pin Diagram

17

Page 18: jkm

5.4 PIN DESCRIPTIONVCC: Supply voltage.

GND: Ground.

Port 0: Port 0 is an 8-bit open drain bidirectional 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 can 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 pullups. Port 0 also receives the code bytes during Flash

programming and outputs the code bytes during program verification. External

pullups are required during program verification.

Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pullups.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 pullups 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

pullups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2

external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX),

respectively, as shown in the following table.

Port Pin Alternate Functions: P1.0 T2 (external count input to Timer/Counter 2),

clock-out P1.1 T2EX (Timer/Counter 2 capture/reload trigger and direction control)

Port 1 also receives the low-order address bytes during Flash programming and

program verification.

Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pullups. 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 pullups and can be used as inputs. As inputs, Port

2 pins that are externally being pulled low will source current (IIL) because of the

internal pullups. Port 2 emits the high-order address byte during fetches from external

program memory and during accesses to external data memories that use 16-bit

addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pullups

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 bidirectional I/O port with internal pullups. The Port 3

output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins,

18

Page 19: jkm

they are pulled high by the internal pullups and can be used as inputs. As inputs, Port

3 pins that are externally being pulled low will source current (IIL) because of the

pullups. Port 3 also serves the functions of various special features of the AT89S2, as

shown in the following table.

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)

Port 3 also receives some control signals for Flash programming and programming

verification.

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

running resets the device.

ALE/PROG: Address Latch Enable is an 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 AT89S52 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 when 12-volt programming is selected.

19

Page 20: jkm

XTAL1: Input to the inverting oscillator amplifier and input to the internal clock

operating circuit.

XTAL2: Output from the inverting oscillator amplifier.

5.5 89S52 BLOCK DIAGRAM

Fig 5.2Block diagram of AT89S52 microcontroller

5.6 INTERNAL MEMORY

Data Memory: The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers (SFR). That means the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space.

The AT89S52 is a low power, high performance CMOS 8-bit microcontroller

with 8Kbytes of Flash programmable and erasable read only memory (PEROM

pinout. The on-chip Flash allows the program memory to be quickly reprogrammed

using a nonvolatile memory programmer such as the PG302 (with the ADT87

adapter). By combining an industry standard 8-bit CPU with Flash on a monolithic

chip, the 8952 is a powerful microcomputer which provides a highly flexible and cost

effective solution to many embedded control applications.

20

Page 21: jkm

LIQUID CRYSTAL DISPLAY

6.1 INTRODUCTIONLiquid crystal display a type of display used in digital watches and many

portable computers. LCD displays utilize two sheets of polarizing material with a

liquid crystal solution between them. An electric current passed through the liquid

causes the crystals to align so that light cannot pass through them. Each crystal,

therefore, is like a shutter, either allowing light to pass through or blocking the light.

LCDs have become very popular over recent years for information display in

many smart ’appliances. They are usually controlled by microcontrollers. They make

complicated equipment easier to operate. LCDs come in many shapes and sizes but

the most common is the 20 character x 4 line display with no backlight. It requires

only 11 connections – eight bits for data (which can be reduced to four if necessary)

and three control lines (we have only used two here). It runs off a 5V DC supply and

only needs about 1mA of current. The display contrast can be varied by changing the

voltage into pin 3 of the display, usually with a trim pot.

Fig 6.1 Liquid Crystal Display

LCD adds a lot to our application in terms of providing a useful interface for

the user, debugging an application or just giving it a "Professional" look. The most

common type of LCD controller is the Hitachi 44780, which provides a relatively

simple interface between a processor and an LCD.

21

Page 22: jkm

6.1DESCRIPTION FOR INTERFACING OF LCDTo get the display working requires eight bits of data, a register select line

(RS) and a strobe line (E). A third input, R/W, is used to read or write data to/from the

LCD. The eight bits of data are supplied from the controller port data lines and two

controller port control lines are used for RS (‘auto’) and E (‘strobe’). Basically the

LCD has two registers, a data register and a command register. Data is written into the

command register when RS is low and into the data register when RS is high. Data is

latched into the LCD register on the falling edge of Enable’.

6.2 PIN DESCRIPTION OF LCD

Table 6.1 Pin description of LCD

From this description, the interface is a parallel bus, allowing simple and fast

reading/writing of data to and from the LCD. This waveform will write an ASCII

Byte out to the LCD's screen. The ASCII code to be displayed is eight bits long and is

sent to the LCD either four or eight bits at a time. If four bit mode is used, two

"nibbles" of data (Sent high four bits and then low four bits with an "E" Clock pulse

with each nibble) are sent to make up a full eight bit transfer. The "E" Clock is used to

initiate the data transfer within the LCD.

Sending parallel data, as either four or eight bits are the two primary modes of

operation. While there are secondary considerations and modes, deciding how to send

the data to the LCD is most critical decision to be made for an LCD interface

application.

Eight-bit mode is best used when speed is required in an application and at

least ten I/O pins are available. Four bit mode requires a minimum of six bits. To wire

a microcontroller to an LCD in four bit mode, just the top four bits (DB4-7) are

written to. The "R/S" bit is used to select whether data or an instruction is being

22

Page 23: jkm

transferred between the microcontroller and the LCD. If the Bit is set, then the byte at

the current LCD "Cursor" Position can be reader written. When the Bit is reset, either

an instruction is being sent to the LCD or the execution status of the last instruction is

read back (whether or not it has completed).

6.3 INSTRUCTION SET TO PROGRAM LCD

Table 6.2 Instruction set of LCD

The bit descriptions for the different commands are: - Not used/Ignored. This bit can

be either "1" or "0"

Set Cursor Move Direction:

ID - Increment the Cursor After Each Byte Written to Display if Set

S - Shift Display when Byte Written to Display

Enable Display/Cursor

D - Turn Display On (1)/Off (0)

C - Turn Cursor On (1)/Off (0)

B - Cursor Blink On (1)/Off (0)

Move Cursor/Shift Display

SC - Display Shift On (1)/Off (0)s

RL - Direction of Shift Right (1)/Left (0)

Set Interface Length

DL - Set Data Interface Length 8(1)/4(0)

23

Page 24: jkm

N - Number of Display Lines 1(0)/2(1)

F - Character Font 5x10(1)/5x7(0)

Poll the "Busy Flag"

BF - This bit is set while the LCD is processing

Move Cursor to CGRAM/Display

A – Address

Read/Write ASCII to the Display:

D – Data

Reading Data back is used in this application, which requires data to be moved

back and forth on the LCD. The "Busy Flag" is polled to determine whether the last

instruction that has been sent has completed processing. Before we send commands or

data to the LCD module, the Module must be initialized. For eight bit mode, this is

done using the following series of operations:Wait more than 15 msec after power is

applied.

1. Write 0x030 to LCD and wait 5 msecs for the instruction to complete

2. Write 0x030 to LCD and wait 160 usecs for instruction to complete

3. Write 0x030 AGAIN to LCD and wait 160 usecs or Poll the Busy Flag

4. Set the Operating Characteristics of the LCD

5. Write "Set Interface Length"

6. Write 0x010 to turn off the Display

7. Write 0x001 to Clear the Display

8. Write "Set Cursor Move Direction" Setting Cursor Behavior Bits

9. Write "Enable Display/Cursor" & enable Display and Optional Cursor

6.4 IR REMOTE CONTROL THEORYThe cheapest way to remotely control a device within a visible range is via

Infra-Red light. Almost all audio and video equipment can be controlled this way

nowadays. Due to this wide spread use the required components are quite cheap, thus

making it ideal for us hobbyists to use IR control for our own projects. This part of

my knowledge base will explain the theory of operation of IR remote control, and

some of the protocols that are in use in consumer electronics.

24

Page 25: jkm

6.5 INFRA_RED LIGHTInfra-Red actually is normal light with a particular colour. We humans can't

see this colour because its wave length of 950nm is below the visible spectrum. That's

one of the reasons why IR is chosen for remote control purposes, we want to use it but

we're not interested in seeing it. Another reason is because IR LEDs are quite easy to

make, and therefore can be very cheap. Although we humans can't see the Infra-Red

light emitted from a remote control doesn't mean we can't make it visible. A video

camera or digital photo camera can "see" the Infra-Red light as you can see in this

picture. If you own a web cam you're in luck, point your remote to it, press any button

and you'll see the LED flicker.

Unfortunately for us there are many more sources of Infra-Red light. The sun

is the brightest source of all, but there are many others, like: light bulbs, candles,

central heating system, and even our body radiates Infra-Red light. In fact everything

that radiates heat, also radiates Infra-Red light. Therefore we have to take some

precautions to guarantee that our IR message gets across to the receiver without

errors.

6.5.1MODULATION

Modulation is the answer to make our signal stand out above the noise. With

modulation we make the IR light source blink in a particular frequency. The IR

receiver will be tuned to that frequency, so it can ignore everything else. You can

think of this blinking as attracting the receiver's attention. We humans also notice the

blinking of yellow lights at construction sites instantly, even in bright daylight.

Fig 6.2 Modulated Signal Driving The IR LED Of The Transmitter On The

Left Side

In the picture above you can see a modulated signal driving the IR LED of the

transmitter on the left side. The detected signal is coming out of the receiver at the

other side. In serial communication we usually speak of 'marks' and 'spaces'. The

25

Page 26: jkm

'space' is the default signal, which is the off state in the transmitter case. No light is

emitted during the 'space' state. During the 'mark' state of the signal the IR light is

pulsed on and off at a particular frequency. Frequencies between 30kHz and 60kHz

are commonly used in consume electronics. At the receiver side a 'space' is

represented by a high level of the receiver's output. A 'mark' is then automatically

represented by a low level. Please note that the 'marks' and 'spaces' are not the 1-s and

0-s we want to transmit. The real relationship between the 'marks' and 'spaces' and the

1-s and 0-s depends on the protocol that's being used. More information about that can

be found on the pages that describe the

protocols.

6.5.2 THE TRANSMITTER

Fig 6.3 IR Transmitter Circuit

The transmitter usually is a battery powered handset. It should consume as

little power as possible, and the IR signal should also be as strong as possible to

achieve an acceptable control distance. Preferably it should be shock proof as well.

Many chips are designed to be used as IR transmitters. The older chips were dedicated

to only one of the many protocols that were invented. Nowadays very low power

microcontrollers are used in IR transmitters for the simple reason that they are more

flexible in their use. When no button is pressed they are in a very low power sleep

mode, in which hardly any current is consumed. The processor wakes up to transmit

the appropriate IR command only when a key is pressed.

Quartz crystals are seldom used in such handsets. They are very fragile and

tend to break easily when the handset is dropped. Ceramic resonators are much more

suitable here, because they can withstand larger physical shocks. The fact that they

are a little less accurate is not important.

26

Page 27: jkm

The current through the LED (or LEDs) can vary from 100mA to well over

1A! In order to get an acceptable control distance the LED currents have to be as high

as possible. A trade-off should be made between LED parameters, battery lifetime and

maximum control distance. LED currents can be that high because the pulses driving

the LEDs are very short. Average power dissipation of the LED should not exceed the

maximum value though. You should also see to it that the maximum peek current for

the LED is not exceeded. All these parameters can be found in the LED's data sheet.

A simple transistor circuit can be used to drive the LED. A transistor with a

suitable HFE and switching speed should be selected for this purpose. The resistor

values can simply be calculated using Ohm's law. Remember that the nominal voltage

drop over an IR LED is approximately 1.1V. The normal driver, described above, has

one disadvantage. As the battery voltage drops, the current through the LED will

decrease as well. This will result in a shorter control distance that can be covered. An

emitter follower circuit can avoid this. The 2 diodes in series will limit the pulses on

the base of the transistor to 1.2V. The base-emitter voltage of the transistor subtracts

0.6V from that, resulting in a constant amplitude of 0.6V at the emitter. This constant

amplitude across a constant resistor results in current pulses of a constant magnitude.

Calculating the current through the LED

6.5.3 THE RECEIVER

Fig 6.4 IR Receiver

Many different receiver circuits exist on the market. The most important

selection criteria are the modulation frequency used and the availability in you region.

27

Page 28: jkm

Fig 6.5 Block Diagram of IR Receiver

In the picture above you can see a typical block diagram of such an IR

receiver. Don't be alarmed if you don't understand this part of the description, for

everything is built into one single electronic component. The received IR signal is

picked up by the IR detection diode on the left side of the diagram. This signal is

amplified and limited by the first 2 stages. The limiter acts as an AGC circuit to get a

constant pulse level, regardless of the distance to the handset.

As you can see only the AC signal is sent to the Band Pass Filter. The Band

Pass Filter is tuned to the modulation frequency of the handset unit. Common

frequencies range from 30kHz to 60kHz in consumer electronics.

The next stages are a detector, integrator and comparator. The purpose of these three

blocks is to detect the presence of the modulation frequency. If this modulation

frequency is present the output of the comparator will be pulled low.

This concludes the theory of operation for IR remote control systems intended

for use in consumer electronics. I realize that other ways exist to implement IR

control, but I will limit myself to the description above. One of the issues not covered

here is security. Security is of no importance if I want to control my VCR or TV set.

But when it comes to opening doors or cars it literally becomes a 'key' feature! Maybe

I will cover this issue later, but not for now.

You can find the protocols of some manufacturers in the link section at the top of this

page. This concludes the theory of operation for IR remote control systems intended

for use in consumer electronics. I realize that other ways exist to implement IR

control, but I will limit myself to the description above. One of the issues not covered

here is security. Security is of no importance if I want to control my VCR or TV set.

But when it comes to opening doors or cars it literally becomes a 'key' feature! Maybe

I will cover this issue later, but not for now.

28

Page 29: jkm

I also realize that my small list of manufacturers is far from being complete. It is

hardly possible to list every manufacturer here. You can send me an e-mail if you

have details about other protocols that you feel should be added to my pages.

This page only described the basic theory of operation of IR remote control. It did not

describe the protocols that are involved in communication between transmitter and

receiver. Many protocols are designed by different manufacturers. You can find the

protocols of some manufacturers in the link section at the top of this page.

This pair of High power directional IR LED and Filtered photodiode can be used in

various kinds of sensing circuits. The narrow beam width IR LED emits focused IR

light and the filtered photodiode filters out ambient light without the need of any

external circuit. When used with proper circuit it can give upto 200 mm of reflective

sensing and can also be used in high speed applications like encoders. atures

IR LED (TSFF5210 - Vishay Semiconductor.

1 High reliability

2 High radiant power

3 High radiant intensity

4 Angle of half intensity:  = ± 10°

5 Low forward voltage

6 Suitable for high pulse current operation

7 High modulation bandwidth: fc = 24 MHz 8 Good spectral matching with Si photo detectors

IR Photodiode (BPV10NF - Vishay Semiconductor)

9 High radiant sensitivity

10 Daylight blocking filter matched with 870 nm to 890 nm emitters

11 High bandwidth: > 100 MHz at VR = 12 V

12 Fast response times

13 Angle of half sensitivity: ± 20° 

29

Page 30: jkm

LIGHT DEPENDENT RESISTORS (LDR)

LDRs or Light Dependent Resistors are very useful especially in light/dark

sensor circuits. Normally the resistance of an LDR is very high, sometimes as high as

1000 000 ohms, but when they are illuminated with light resistance drops

dramatically.

Fig 7.1 Basic Model of LDR

The animation above shows that when the torch is turned on, the

resistance of the LDR falls, allowing current to pass through it.

7.1 THIS IS AN EXAMPLE OF A LIGHT SENSOR CIRCUIT When the light level is low the resistance of the LDR is high. This

prevents current from flowing to the base of the transistors. Consequently The

LED does not light.

30

Page 31: jkm

Fig 7.2 Example of Light sensor circuit

However, when light shines onto the LDR its resistance falls and

current flows into the base of the first transistor and then the second transistor.

the LED lights. The preset resistor can be turned up or down to increase or

decrease resistance, in this way it can make the circuit more or less sensitive.

31

Page 32: jkm

A/D CONVERTER (MCP 3201)

8.1 INTRODUCTION TO A/D CONVERTERS The usual method of bringing analog inputs into a microprocessor is to use an

analog-to-digital converter (ADC). Here are some tips for selecting such a part and

calibrating it to fit our needs. In analog-to-digital converter (ADC) accepts an analog

input-a voltage or a current-and converts it to a digital value that can be read by a

Microprocessor. This hypothetical part has two inputs: a reference and the signal to be

measured. It has one output, an 8-bit digital word that represents the input value. The

reference voltage is the maximum value that the ADC can convert. Our example 8-bit

ADC can convert values from 0V to the reference voltage. This voltage range is

divided into 256 values, or steps.

The size of the step is given by: Vref/256

8.2 DESCRIPTIONThe Microchip Technology Inc.MCP3201 is a successive approximation 12-

bit Analog-to-Digital (A/D) Converter with on-board sample and hold circuitry. The

device provides a single pseudo-differential input. Differential Nonlinearity (DNL) is

specified at ±1 LSB, and Integral Nonlinearity (INL) is offered in ±1 LSB

(MCP3201-B) and ±2 LSB (MPC3201-C) versions. Communication with the device

is done using a simple serial interface compatible with the SPI protocol. The device is

capable of sample rates of up to 100ksps at a clock rate of 1.6MHz. The MCP3201

operates over a broad voltage range (2.7V - 5.5V).

8.3FEATURES1.12-bit resolution

2. ±1 LSB max DNL

3. On-chip sample and hold

4. SPI ® serial interface (modes 0,0 and 1,1)

5. Single supply operation: 2.7V - 5.5V

6. 100ksps max. Sampling rate at VDD= 5V

7. 50ksps max. Sampling rate at VDD= 2.7V

32

Page 33: jkm

8. Low power CMOS technology

9. Industrial temp range: -40°C to +85°C

10. Pin PDIP, SOIC and TSSOP packages

8.4 APPLICATION1. Sensor Interface

2. Process Control

3. Data Acquisition

4. Battery Operated System

8.5 PIN DIAGRAM

Fig 8.1Pin Diagram of MCP3201

33

Page 34: jkm

Table 8.1 Pin Function Table Of MCP 3201

8.6 PIN DESCRIPTIONSIN+Positive analog input. This input can vary from IN- to VREF + IN-.

IN-Negative analog input. This input can vary ±100Mv from VSS.

8.6.1 CS/SHDN (CHIP SELECT/SHUTDOWN)

The CS/SHDN pin is used to initiate communication with the device when

pulled low and will end a conversion and put the device in low power standby when

pulled high. The CS/SHDN pin must be pulled high between conversions.

8.6.2 CLK (SERIAL CLOCK)

The SPI clock pin is used to initiate a conversion and to clock out each bit of the

conversion as it takes place.

34

Page 35: jkm

8.6.3 DOUT (SERIAL DATA OUTPUT)

The SPI serial data output pin is used to shift out the results of the A/D

conversion. Data will always change on the falling edge of each clock as the

conversion takes place.

Fig 8.2 Functional Block Diagram

8.7 COMBUSTIBLE GAS SENSOR – ANALOG OUT

Fig 8.3 Gas Sensor

35

Page 36: jkm

Used in gas leakage detecting equipments for detecting of

LPG, iso-butane, propane, LNG combustible gases. The

sensor does not get trigger with the noise of alcohol,

cooking fumes and cigarette smoke.

Applications

1. Gas leak detection system

2. Fire/Safety detection system

3. Gas leak alarm / Gas detector Features

4. Simple analog output

5. High sensitivity to LPG, iso-butane, propane

6. Small sensitivity to alcohol, smoke

7. Fast response

8. Wide detection range

9. Stable performance and long life Specification Parameter Value Unit

10. Target Gas iso-butane, Propane, LPG

11. Detection Range 100 to 10000 PPM PPM (part per millions) Output Voltage

Range 0 to 5 VDC

12. Working Voltage 5 VDC

13. Current Consumption ≤180 mA

14. Warmup Time 10 Minutes

15. Calibrated Gas 1000ppm iso-butane

16. Response Time ≤10s Seconds

17. Resume Time ≤30s Seconds

18. Standard Working Condition Temperature:-10 to 65 deg C. Humidity:

≤95%RH

19. Storage Condition Temperature: -20-70 deg C Hum: ≤ 70%RH

PIN OUTS

# Pin Details

1. GND Power Supply Ground.

2. A.OUT Analog Voltage Out

3 +5V Supply voltage DC +5V regulated

Warm up Time

36

Page 37: jkm

The sensor needs 10 minutes of warm up time after first power is applied.

After 10 minutes you can take its readings. During warm up time the output analog

voltage would go up from 4.5V to 0.5V in variation down gradually. During this

warm up time the sensor reading should be ignored. Using the Sensor .The sensor

needs 5V to operate, Give regulated +5V DC supply, The sensor will take around

180mA supply. The sensor will heat a little bit since it has internal heater that heats

the sensing element.

Testing the sensor Measure the output voltage through multi-meter between

A.OUT and Ground pins or Use microcontroller to measure the voltage output. Take

the sensor near combustible gas place like cooking gas stove with flame off or near

bottle of after shave liquid or cigarette light with flame off. You will notice sudden

jump in analog voltage output since the gas concentration will increase Sensitivity

Typical Sensitivity Characteristics of sensor for several gases in their

Temp 20 deg C

Humidity 65%

Oxygen concentration 21%

RL = 10K Ohm

Ro = Sensor resistance at 1000 ppm of LPG

in clean air

Rs = Sensor resistance at various concentrations of gases

Deriving Gas concentration from Output Voltage

Here is a the equation which convert analog output to PPM gas concentration

PPM = Analog Voltage in mV x 2

Example: Gas sensor voltage is giving output as

2500mV(2.5V) So the gas contentration in PPM = 2500x2 = 5000 PPM

Here is the table for your reference

PPM: 200 300 500 1000 2000 3000 5000 9000 10000

Voltage( mV) 100 150 250 500 1000 1500 2500 4500 500

37

Page 38: jkm

SERIAL COMMUNICATION

9.1 INTRODUCTION TO SERIAL COMMUNICATIONIn telecommunication and computer science, the concept of serial

communication is the process of sending data one bit at a time, sequentially, over a

communication channel or computer bus. This is in contrast to parallel

communication, where several bits are sent as a whole, on a link with several parallel

channels. Serial communication is used for all long-haul communication and most

computer networks, where the cost of cable and synchronization difficulties make

parallel communication impractical. Serial computer buses are becoming more

common even at shorter distances, as improved signal integrity and transmission

speeds in newer serial technologies have begun to outweigh the parallel bus's

advantage of simplicity (no need for serializer and deserializer, or SerDes) and to

outstrip its disadvantages (clock skew, interconnect density).

9.2 SERIAL BUSESIntegrated circuits are more expensive when they have more pins. To reduce

the number of pins in a package, many ICs use a serial bus to transfer data when

speed is not important. Some examples of such low-cost serial buses include SPI, I²C,

UNI/O, and 1-Wire.

9.3 ASYNCHRONOUS SERIAL COMMUNICATIONAsynchronous serial communication describes an asynchronous, serial

transmission protocol in which a start signal is sent prior to each byte, character or

code word and a stop signal is sent after each code word. The start signal serves to

prepare the receiving mechanism for the reception and registration of a symbol and

the stop signal serves to bring the receiving mechanism to rest in preparation for the

reception of the next symbol. A common kind of start-stop transmission is ASCII over

RS-232, for example for use in teletypewriter operation.

38

Page 39: jkm

In the diagram, two bytes are sent, each consisting of a start bit, followed by seven

data bits (bits 0-6), a parity bit (bit 7), and one stop bit, for a 10-bit character frame.

The number of data and formatting bits, the order of data bits, and the transmission

speed must be pre-agreed by the communicating parties.

The "stop bit" is actually a "stop period"; the stop period of the transmitter may be

arbitrarily long. It cannot be shorter than a specified amount, usually 1 to 2 bit times.

The receiver requires a shorter stop period than the transmitter. At the end of each

character, the receiver stops briefly to wait for the next start bit. It is this difference

which keeps the transmitter and receiver synchronized.

9.4 MAX 232 PIN DIAGRAM

Fig 9.1 MAX 232 Pin Diagram

9.5 SPECIFICATIONS1. .Meets or Exceeds TIA/EIA-232-F and ITU Recommendation V.28

2. Operates from a Single 5-V Power Supply With 1.0-_F Charge-Pump

Capacitors

3. Operates up To 120 kbit/s

4. Two Drivers and Two Receivers

5. 30-V Input Levels

6. Low Supply Current 8 mA Typical

7. 2000-V Human-Body Model (A114-A)

39

Page 40: jkm

9.6 DESCRIPTIONThe MAX232 is a dual driver/receiver that includes a capacitive voltage

generator to supply TIA/EIA-232-F Voltage levels from a single 5-V supply. Each

receiver converts TIA/EIA-232-F inputs to 5-V TTL/CMOS levels. These receivers

have a typical threshold of 1.3 V, a typical hysteresis of 0.5 V, and can accept 30-V

inputs. Each driver converts TTL/CMOS input levels into TIA/EIA-232-F levels. The

driver, receiver, and voltage-generator functions are available as cells.

9.7 LOGIC DIAGRAM

Fig 9.2 Logic Diagram

9.8 DB-9 CONNECTORThe RS-232c standard is based on a low/false voltage between +3 to +15V,

and an high/true voltage between -3 to -15V (+/-12V is commonly used). Figure 27.4

shows some of the common connection schemes. In all methods the txd and rxd lines

are crossed so that the sending txd outputs are into the listening rxd inputs when

communicating between computers. When communicating with a communication

device (modem), these lines are not crossed. In the modem connection the dsr and dtr

lines are used to control the flow of data. In the computer the cts and rts lines are

connected. These lines are all used for handshaking, to control the flow of data from

sender to receiver. The null-modem configuration simplifies the handshaking between

computers. The three wire configuration is a crude way to connect to devices, and

data can be lost.

40

Page 41: jkm

Fig 9.3 DB-9 Connector

9.9 COMMON RS232 CONNECTION SCHEMESCommon connectors for serial communications are shown in Figure 27.5.

These connectors are either male (with pins) or female (with holes), and often use the

assigned pins shown. In any connection the RXD and TXD pins must be used to

transmit and receive data. The COM must be connected to give a common voltage

reference. All of the remaining pins are used for handshaking.

41

Page 42: jkm

9.10 RS232 PIN ASSIGNMENTS

Fig 9.4 RS232 Pin Assignments

The handshaking lines are to be used to detect the status of the sender and

receiver, and to regulate the flow of data. It would be unusual for most of these pins to

be connected in any one application. The most common pins are provided on the DB-

9 connector, and are also described below.

TXD/RXD - (transmit data, receive data) - data lines

DCD - (data carrier detect) - this indicates when a remote device is present

RI - (ring indicator) - this is used by modems to indicate when a connection is about

to be made.

CTS/RTS - (clear to send, ready to send)

DSR/DTR - (data set ready, data terminal ready) these handshaking lines indicate

when the remote machine is ready to receive data.

COM - a common ground to provide a common reference voltage for the TXD and

RXD.

When a computer is ready to receive data it will set the CTS bit, the remote machine

will notice this on the RTS pin.

42

Page 43: jkm

REGULATED POWER SUPPLY

10.1 DESCRIPTIONA variable regulated power supply, also called a variable bench power supply,

is one where you can continuously adjust the output voltage to your requirements.

Varying the output of the power supply is the recommended way to test a project after

having double checked parts placement against circuit drawings and the parts

placement guide.

This type of regulation is ideal for having a simple variable bench power

supply. Actually this is quite important because one of the first projects a hobbyist

should undertake is the construction of a variable regulated power supply. While a

dedicated supply is quite handy e.g. 5V or 12V, it's much handier to have a variable

supply on hand, especially for testing.

Most digital logic circuits and processors need a 5 volt power supply. To use

these parts we need to build a regulated 5 volt source. Usually you start with an

unregulated power supply ranging from 9 volts to 24 volts DC (A 12 volt power

supply is included with the Beginner Kit and the Microcontroller Beginner Kit.). To

make a 5 volt power supply, we use a LM7805 voltage regulator IC (Integrated

Circuit). The IC is shown below.

Fig 10.1 LM7805 voltage regulator IC

43

Page 44: jkm

The LM7805 is simple to use. You simply connect the positive lead of your

unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin,

connect the negative lead to the Common pin and then when you turn on the power,

you get a 5 volt supply from the Output pin.

10.2 CIRCUIT FEATURES1. Brief description of operation: Gives out well regulated +5V output, output

current capability of 100 mA

2. Circuit protection: Built-in overheating protection shuts down output when

regulator IC gets too hot

3. Circuit complexity: Very simple and easy to build

4. Circuit performance: Very stable +5V output voltage, reliable operation

5. Availability of components: Easy to get, uses only very common basic

components

6. Design testing: Based on datasheet example circuit, I have used this circuit

succesfully as part of many electronics projects

7. Applications: Part of electronics devices, small laboratory power supply

8. Power supply voltage: Unreglated DC 8-18V power supply

9. Power supply current: Needed output current + 5 mA

10. Component costs: Few dollars for the electronics components + the input

transformer cost

10.3 BLOCK DIAGRAM

Fig10.2 Block Diagram of Typical Linear Power Supply

44

Page 45: jkm

10.4 CIRCUIT DIAGRAM

Fig 10.3 Circuit diagram of Regulated Power Supply

45

Page 46: jkm

KEIL U V2 SOFTWARE

11.1 KEIL SOFTWARE PROGRAMING PROCEDUREHow to write Embedded C Program in Keil Software.

11.2 PROCEDURE STEPS

Step-1: Install Keil MicroVision-2 in your PC, Then after Click on that “Keil UVision-2”

icon. After opening the window go to toolbar and select Project Tab then close

previous project.

46

Page 47: jkm

Step-2:Next select New Project from Project Tab.

Step-3:

Then it will open “Create New Project” window. Select the path where you

want to save project and edit project name.

47

Page 48: jkm

Step-4:Next it opens “Select Device for Target” window, It shows list of companies

and here you can select the device manufacturer company.

Step-5:

For an example, for your project purpose you can select the chip as 89c51/52

from Atmel Group. Next Click OK Button, it appears empty window here you can

observe left side a small window i.e, “Project Window”. Next create a new file.

48

Page 49: jkm

Step-6:

From the Main tool bar Menu select “File” Tab and go to New, then it will open a

window, there you can edit the program.

Step-7:

Here you can edit the program as which language will you prefer either Assembly or

C.

49

Page 50: jkm

Step-8:

After editing the program save the file with extension as “.c” or “.asm”, if you write a

program in Assembly Language save as “.asm” or if you write a program in C Language save

as “.c” in the selected path. Take an example and save the file as “test.c”.

Step-9:

Then after saving the file, compile the program. For compilation go to project

window select “source group” and right click on that and go to “Add files to Group”.

50

Page 51: jkm

Step-9:

Here it will ask which file has to Add. For an example here you can add “test.c” as

you saved before.

Step-9:

After adding the file, again go to Project Window and right click on your “c file” then

select “Build target” for compilation. If there is any “Errors or Warnings” in your program

you can check in “Output Window” that is shown bottom of the Keil window.

51

Page 52: jkm

Step-10:

Here in this step you can observe the output window for “errors and warnings”.

Step-11:

If you make any mistake in your program you can check in this slide for which error

and where the error is by clicking on that error.

52

Page 53: jkm

Step-12:

After compilation then next go to Debug Session. In Tool Bar menu go to “Debug”

tab and select “Start/Stop Debug Session”.

Step-13:

Here a simple program for “Leds Blinking”. LEDS are connected to PORT-1. you

can observe the output in that port.

53

Page 54: jkm

Step-14:

To see the Ports and other Peripheral Features go to main toolbar menu and select

peripherals.

Step-15:

In this slide see the selected port i.e, PORT-1.

54

Page 55: jkm

Step-16:

Start to trace the program in sequence manner i.e, step by step execution and observe

the output in port window.

Step-17:

After completion of Debug Session Create an Hex file for Burning the Processor.

Here to create an Hex file go to project window and right click on Target next select “Option

for Target”.

55

Page 56: jkm

Step-18:

It appears one window; here in “target tab” modify the crystal frequency as you

connected to your microcontroller.

Step-19:

Next go to “Output’ tab. In that Output tab click on “Create HEX File” and then click OK.

56

Page 57: jkm

Step-20:

Finally Once again compile your program. The Created Hex File will appear in your

path folder.

57

Page 58: jkm

ISP FLASH MICROCONTROLLER PROGRAMMER

12.1 FEATURES

Complete In-System Programming Solution for AVR Microcontrollers

Covers All AVR Microcontrollers with In-System Programming Support

Reprogram Both Data Flash and Parameter EEPROM Memories

Complete Schematics for Low-cost In-System Programmer

Simple Three-wire SPI Programming Interface

12.2 INTRODUCTION

In-System Programming allows programming and reprogramming of any

AVR microcontroller Positioned inside the end system. Using a simple three-wire SPI

interface, the In-System Programmer communicates serially with the AVR

microcontroller, reprogramming all non-volatile memories on the chip.

In-System Programming eliminates the physical removal of chips from the

system.This will save time, and money, both during development in the lab, and when

updating

The software or parameters in the field. This application note shows how to

design the system to support In-System Programming. It also shows how a low-cost

In-System Programmer can be made, that will allow the target AVR microcontroller

to be programmed from any PC equipped with a regular 9-pin serial port.

Alternatively, the entire In-System Programmer can be built into the system allowing

It To Reprogram Itself.

58

Page 59: jkm

Fig 12.1 ISP_ programmer interface

12.3 THE PROGRAMMING INTERFACEFor In-System Programming, the programmer is connected to the target using

as few wires as possible. To program any AVR microcontroller in any target system, a

simple Six-wire interface is used to connect the programmer to the target PCB.

Below shows the connections needed.

The Serial Peripheral Interface (SPI) consists of three wires: Serial Clock

(SCK), Master In – Slave Out (MISO) and Master Out – Slave In (MOSI). When

programming the AVR, the In-System Programmer always operate as the Master, and

the target system Always operate as the Slave.

The In-System Programmer (Master) provides the clock for the

communication on the SCK Line. Each pulse on the SCK Line transfers one bit from

the Programmer (Master) To the Target (Slave) on the Master out – Slave in (MOSI)

line. Simultaneously, Each pulse on the SCK Line transfers one bit from the target

(Slave) to the Programmer (Master) on the Master in – Slave out (MISO) line.

59

Page 60: jkm

EMBEDDED C

Embedded C (As a beginner when you start working with controller you might

be in a bit confused about the difference between C and Embedded C? Where shall I

write a code for my controller? This article will bring out the differences between C &

embedded C

When you start working with embedded C then you may feel that the

embedded C is quite similar to the conventional C. Then why it is been named

asembedded C?

·         The C language is used for desktop application while embedded C is used for

microcontroller application.

·         The C language uses the desktop OS memory, while embedded C uses the

controllers inbuilt or any externally attached memory. In the case of controller we

have very limited resources (controllers RAM, ROM, IO ports, etc.) so one must be

very careful about declaring and using the variable. At any instant of time you need to

be care full that you are not using the space more than the available one in the

controller or else the program will get crash, or you may not get the exact result.

·         The embedded C needs a different platform then C. Almost every family of

controllers need a different platform to write their codes.

·         A convention C code generates an OS compatible .exe file while embedded C

code generates a .hex file which has the machine codes to be dumped in the memory

of the controller.

·         In C we use header files like stdio.h, which yield the output to be visible on OS

itself. In embedded C everything is same but the output files are directly loaded on the

controllers to test them.

·         The C language is use to make a program for host interaction while embedded

C is use to implement the host on the controller which interact with the other

peripherals.

60

Page 61: jkm

SOURCE CODE

#include<reg52.h>

#include<intrins.h>

#include<string.h>

//////////////////////////////////////////////////////////////////

#define LCD P0

void init_lcd(void);

void cmd_lcd(unsigned char);

void data_lcd(unsigned char);

void display_lcd(unsigned char *);

void delay_ms(int);

void integer_lcd(int);

void float_lcd(float);

/////////////////////////////////////////////////////////////////

void adc_convert (void);

unsigned char byte_read(void);

unsigned char byte0,byte1;

unsigned int num;

float val;

////////////////////////////////////////////////////////////////////

void serial_send(unsigned char);

void SEND_STR(unsigned char *);

////////////////////////////////////////////////////////////////

int i=0;int J=0;int L=0;

bit receive=0;

char k;

bit t_flag=0;

bit flag = 0;

unsigned char buff[10];

sbit DCLK = P1^0;

sbit SDAT= P1^1;

61

Page 62: jkm

sbit CS =P1^2;

////////////////////////////////////////////////////////

sbit IR1=P1^5;///////////////////CHECKING

sbit IR2=P1^4;//////////////////LDR

sbit IR3=P1^3;/////////////////FIRE

sbit LED=P2^1;/////////////////LED

sbit SP1=P3^2;///////////////////CELL

sbit SP2=P3^3;//////////////////PURSE

sbit SP3=P3^4;/////////////////FIRE

sbit SP4=P3^5;/////////////////LIGHT

sbit SP5=P3^6;///////////////////SMOKE

sbit SP6=P3^7;///////////////////SMOKE

////////////////////////////////////////////////////////////

void serial_int(void)interrupt 4

{

flag=0;

if(RI)

{

receive=1;

RI = 0;

if(k<10)buff[k++]=SBUF;

}

else

{

t_flag=1;

TI=0;

}

}

////////////////////////////////////////////////////////////////////

void main(void)

{

SP1=SP2=SP3=SP4=SP6=SP5=1;

62

Page 63: jkm

LED=0;

SCON = 0x50;

TMOD = 0x20;

TH1 = -3;

TR1 = 1;

IE=0x91;

i = 0;

init_lcd();cmd_lcd(0x80);

display_lcd("RF-ID & GSM BASED ");

cmd_lcd(0xC0);

display_lcd("SMART HOME REMINDER SYSTEM");

delay_ms(1000);

cmd_lcd(0x01);

while(1)

{

cmd_lcd(0xc0);

adc_convert();

delay_ms(100);

flag=1;

if(receive==1)

{

cmd_lcd(0x01);

for(i=0;i<10;i++);

cmd_lcd(0x01);

k=0;buff[i]='\0';

cmd_lcd(0xc9);

display_lcd(buff);

if(!strcmp(buff,"3000FFC668"))

{

J=J+1;

strcpy(buff,"CELL");

cmd_lcd(0xC9);

display_lcd("CELL");

delay_ms(10);

63

Page 64: jkm

}

if(!strcmp(buff,"3000FFCE9C"))

{

L=L+1;

strcpy(buff,"PURSE");

cmd_lcd(0xC9);

display_lcd("PURSE");

delay_ms(10);

}

}

////////////////////////////////////////////////////////////

if(IR1==1)

{

cmd_lcd(0x80);

display_lcd("REMINDER SYSTEM ");

delay_ms(10);

if(J==1)

{

cmd_lcd(0x80);

display_lcd("CELL ");

delay_ms(100);

SP1=0;SP6=1;

}

if(L==1)

{

cmd_lcd(0x80);

display_lcd("PURSE ");

delay_ms(100);

SP2=0;SP6=1;

}

if(J==1 & L==1)

{

cmd_lcd(0x80);

display_lcd("CELL PURSE ");

64

Page 65: jkm

delay_ms(100);

SP6=0;SP1=0;SP2=0;

}

}

if(IR2==0)

{

cmd_lcd(0x80);

display_lcd("NOLIGHT AVALABLE ");

delay_ms(100);

LED=1;SP4=1;

}

if(IR2==1)

{

cmd_lcd(0x80);

display_lcd("LIGHT AVALABLE ");

delay_ms(100);LED=0;

SP4=0;

SEND_STR("AT+CMGS=");

serial_send('"');

SEND_STR("7702272106");

serial_send('"');

SEND_STR("\r\n");

SEND_STR("LIGHT AVALABLE ");

SEND_STR("\r\n");

serial_send(0x1A);delay_ms(500);

////////////////////////////////////////////////

SEND_STR("AT+CMGS=");

serial_send('"');

SEND_STR("8886313963");

serial_send('"');

SEND_STR("\r\n");

SEND_STR("LIGHT AVALABLE ");

SEND_STR("\r\n");

65

Page 66: jkm

serial_send(0x1A);delay_ms(500);

}

if(IR3==0)

{

cmd_lcd(0x80);

display_lcd("FIRE OCCURED ");

delay_ms(100);

SP3=0;

SEND_STR("AT+CMGS=");

serial_send('"');

SEND_STR("7702272106");

serial_send('"');

SEND_STR("\r\n");

SEND_STR("FIRE OCCURED ");

SEND_STR("\r\n");

serial_send(0x1A);delay_ms(500);

/////////////////////////////////////////////////////

SEND_STR("AT+CMGS=");

serial_send('"');

SEND_STR("8886313963");

serial_send('"');

SEND_STR("\r\n");

SEND_STR("FIRE OCCURED ");

SEND_STR("\r\n");

serial_send(0x1A);delay_ms(500);

}

if(IR3==1)

{

cmd_lcd(0x80);

display_lcd("N0 FIRE OCCURED ");

delay_ms(100);

SP3=1;

}

i = 0;receive=0;

66

Page 67: jkm

delay_ms(100);

}

}

////////////////////////////////////////////////////////////////////

void adc_convert (void)

{

DCLK=1;

CS=1; //low to high to start conversion

CS=0;

byte1=byte_read(); //msb result from adc

byte0=byte_read(); //lsb result from adc

CS=1;

num=(byte1&0x1f); //

num=((num<<8)|byte0)>>1;

val=(num*5.00)/4096;

float_lcd(val);

display_lcd("V");

if(val > 4.00)

{

cmd_lcd(0x80);

display_lcd("GAS OCCURED ");

delay_ms(100);

SP5=0;

SEND_STR("AT+CMGS=");

serial_send('"');

SEND_STR("7702272106");

serial_send('"');

SEND_STR("\r\n");

SEND_STR("GAS OCCURED ");

SEND_STR("\r\n");

serial_send(0x1A);delay_ms(500);

///////////////////////////////////////////

SEND_STR("AT+CMGS=");

serial_send('"');

67

Page 68: jkm

SEND_STR("8886313963");

serial_send('"');

SEND_STR("\r\n");

SEND_STR("GAS OCCURED ");

SEND_STR("\r\n");

serial_send(0x1A);delay_ms(500);

}

if(val<4.00)

{

cmd_lcd(0x80);

display_lcd("N0 GAS OCCURED ");

delay_ms(100);

SP5=1;

}

}

////////////////////////////////////////////////////////////////////

unsigned char byte_read (void)

{

unsigned char i,c=0,mask=0x80;

for (i=0;i<8;i++)

{

DCLK=0;

if (SDAT==1)

c|=mask;

DCLK=1;

mask>>=1;

}

return c;

}

////////////////////////////////////////////////////////////////////////

void init_lcd(void)

{

68

Page 69: jkm

cmd_lcd(0x28);

cmd_lcd(0x28);

cmd_lcd(0x28);

cmd_lcd(0x0C);

cmd_lcd(0x06);

cmd_lcd(0x01);

}

void cmd_lcd(unsigned char var)

{

LCD = ((var & 0xF0) | 0x08);

LCD = 0;

LCD = ((var << 4) | 0x08);

LCD = 0;

delay_ms(2);

}

void data_lcd(unsigned char var)

{

LCD = ((var & 0xF0) | 0x0a);

LCD = 0;

LCD = ((var << 4) | 0x0a);

LCD = 0;

delay_ms(2);

}

void display_lcd(char *str)

{

while(*str)

data_lcd(*str++);

}

void delay_ms(int cnt)

{

int i;

while(cnt--)

for(i=0;i<500;i++);

}

69

Page 70: jkm

void SEND_STR(unsigned char *s)

{

while(*s)

serial_send(*s++);

}

void serial_send(unsigned char buf)

{

t_flag= 0;

SBUF = buf;

while(t_flag == 0);

}

void integer_lcd(int n)

{

unsigned char c[6];

unsigned int i=0;

if(n<0)

{

data_lcd('-');

n=-n;

}

if(n==0)

data_lcd('0');

while(n>0)

{

c[i++]=(n%10)+48;

n/=10;

}

while(i-->=1)

data_lcd(c[i]);

}

70

Page 71: jkm

void float_lcd(float f)

{

int n;

float temp;

n=f;

integer_lcd(n);

data_lcd('.');

temp=f-n;

if(temp>=0.00&&temp<=0.09)

data_lcd('0');

f=temp*100;

n=f;

integer_lcd(n);

}

71

Page 72: jkm

SCHEMATIC DIAGRAM

LE D TX

123456789

1011121314

G N DV C CV E ER SR WE ND 0D 1D 2D 3D 4D 5D 6D 7

H

c lk

F R O M IS P

GND

s m o k e s e n s o r o / p

10uf/63v

10uf/63v

- +

B R I D G E R E C TI F I E R1

4

3

2

123

LE D

F R O M IS PD 4

10K PULLUP

1 2 3 4 5 6 7 8 9

Vcc

R1

R2

R3

R4

R5

R6

R7

R8

H

V C CV C C

p1 . 1

P 1^5

V C C

V C C

D 5

G N D

B

10uf/63v

GND

V C C

R E G U LA TO R78 0 51 3

2

V I N V O U T

GN

D

8 . 2 K

22 0 oh m s

P 0 . 4

L D R

5K

LE D TX

4 . 7 K

P 0 .3

f ire s e ns o r

P 1^3

11 . 0 59 2 M H z

C R Y S TA L

V C C

P 3. 1 (TXD )

V C C

M A X232

1

34

5

2

6

12

9

11

10

13

8

14

7

1516

C 1 +

C 1 -C 2 +

C 2 -

V +

V -

R 1 O U T

R 2 O U T

T1 I N

T2 I N

R 1 I N

R 2 I N

T1 O U T

T2 O U T

GN

DV

CC

P1^4

V C C

S W 1

GND

V C C

A T8 9 S 52

231817

20 2119

9101112

1413

1615

383736353433323130292827262524

22

12345678

3940

P 2 . 2 (A 10 )XTA L 2P 3 . 7 (R D )

G N D P 2. 0 (A 87 )XTA L 1

R S TP 3 . 0 (R XD )P 3 . 1 (TXD )P 3 . 2 (I N T0 )

P 3 . 4 (T0 )P 3 . 3 (I N T1 )

P 3 . 6 (W R )P 3 . 5 (T1 )

P 0 . 1 (A D 1 )P 0 . 2 (A D 2 )P 0 . 3 (A D 3 )P 0 . 4 (A D 4 )P 0 . 5 (A D 5 )

P O . 6 (A D 6 )P 0 . 7 (A D 7 )

E E / V D DA LE / P R O G

P S E NP 2. 7 (A 15 )P 2 . 6 (A 14 )P 2 . 5 (A 13 )P 2 . 4 (A 12 )P 2 . 3 (A 11 )

P 2 .1 (A 9 )

P 1 . 0 (T2 )P 1 . 1 (T2E X)P 1 . 2P 1 . 3P 1 . 4P 1 . 5P 1 . 6P 1 . 7

P 0 . 0 (A D 0 )V C C

10K PULLUP

123456789

VccR

1R

2R

3R

4R

5R

6R

7R

8

33 p f

p1 . 0

c s / s hd n

GND

5K

GND GND

10K PULLUP

123456789

Vcc

R1

R2

R3

R4

R5

R6

R7

R8

R S

XTA L -1

XTA L -1

1000

uf

GND

R S T

XTA L -2

V C C

10 4 p f

P 0 . 6

I R R E C I V E R c h e c k in g

E N

D 7

GND

220

10uf

MCP 3201

2

3

5

6

7

1 8

4

I N +

I N -

C S / S H D N

D O U T

C L K

V R E F V C C

V S S

F R O M IS P

D 6

J 2

t o t ra n s f o rm er

12

10 K

V C C

GND

GSM MODEM

P 0. 5

V C C

GND GND

33 p f

IN +

do u t

XTA L -2

4

5

6

1

2

3

GND

A

G N D

P 0. 7

10uf/63v

V C C

R S T

33 p f

V C C

p1 . 2

220

GND

P 0.1

72

Page 73: jkm

RESULT

73

Page 74: jkm

ADVANTAGES AND DISADVANTAGES

ADVANTAGES1. Power consumption is less as we are using only 5 volt power supply.

2. Because of its versatility we can use in home automation, industry automation etc.

3. It is easy to use.

4. By the use of this project we can save energy.

5. It is cost effective due to advancement of VLSI.

6. It is easily available in the market.

7. With the use of the remainder system in the project we can save our time. .

8. It makes life easier and comfortable

9. Buzzer is replaced by voice IC.

DISADVANTAGES1 .If power is cut then the system will not work

2. GSM fails to alert the user when network coveraging area is poor

3. LDR is highly sensitive so light becomes off even in full moon night.

4. We need RFID tag for every goods

5. Gas sensor detects even small amount of smoke like cigarette smoke and alert the

user which is undesirable.

6. When large numbers of products with RFID tags are stored together in the same

scanning field, the reader can energize multiple tags at once..

74

Page 75: jkm

APPLICATIONS

1. It can be applied for home, industries and shopping mall.

2. It can be applied in coil mines.

3. It can be used for security purpose.

4. We can use the project for gas leakage detection in coil mines, home and industries.

5. LDR can be used in street light, coil mines, tunnels and industries.

6. Fire sensor can be used for fire detection in home, industries, forest fire.

8. User can instantly determine the general location of tagged assets anywhere

within the facility with the help of active RFID technology.

9. The project can be used as remainder system for those people who forget their

utilities.

10. It makes life easier and comfortable.

11. Smoke sensor can be used in petrol pumps where smoke is strictly prohibited.

12. In shopping malls we can use for detecting stolen goods and instead of giving

buzzer it gives voice which makes easier to detects.

.

75

Page 76: jkm

FUTURE SCOPE

In future we can go for full fledged environment which cover more distance

and sense the tag automatically means no need to show the tag. Now we are using this

project as a reminding and monitoring purpose but in future we can control the device

using advance technologies. Microcontroller AT89S52 can be replaced by higher

microcontroller where both transmission and reception can be simultaneously.

Here we are using SI300 module which is capable of only sending, receiving and

calling purpose but in future we can use GSM900 module for sending the pictorial

view of the particular place to respective user which is used for security purpose

.We can introduce Relay switch for operating the device from distant place.

In future we can use RF-ID in hospital for tracking their special patients. It will be

mainly very useful in mental care hospitals where doctors can track each and every

activity of the patient.

76

Page 77: jkm

CONCLUSION

This project presents an approach based on RF-ID and GSM based remainder

system for smart home. Through the use of this project we can make life easier and

comfortable. In this project we have used Gas sensor for detection of gas leakage, fire

and smoke which overcome the problem of occurrence of fire. We are also using RF-

ID card for reminding purpose which helps people to save their valuable time.

Here we are using LDR for saving power and GSM module for sending

messages to alert the user. In our project we have implemented voice IC instead of

buzzer for reminding purpose.

At the end we can conclude that this project is going to play a remarkable role

in forthcoming days in making life easier and sophisticated.

77

Page 78: jkm

BIBLIOGRAPHY

REFERRENCE BOOK1. “The AVR Microcontroller and Embedded Systems” By Muhammad Ali Mazidi

and Janice Gillispie Mazidi. Pearson Education.

2. ATMEL AVR Data sheets

3. Hand book for Digital IC’s from Analogic Devices

4. Jonathan Westhues's Proximity Website

5. microID 125 kHz RFID System Design Guide

6. FCC Rules

WEBSITES1. www.atmel.com

2. www.howstuffworks.com

3. www.google.com

4. www.wikipedia.com

5. www.maxim-ic.com

78