Sie sind auf Seite 1von 76

WEATHER FORECASTING SYSTEM USING WIRELESS COMMUNICATION

INDEX
CHAPTER TITLE PAGE NO

DESCRIPTION
- ABSTRACT
- BLOCK DIAGRAM

CHAPTER 1 INTRODUCTION

1.0 WHAT IS DATA ACQUISITION


1.1 DIFFERENT TYPES OF DATA ACQUISITION
1.2 NETWORKING
1.3 AIM OF THE PROJECT

CHAPTER 2 EMBEDDED SYSTEMS

2.0 INTRODUCTION
2.1 APPLICATION

CHAPTER 3 DESIGN PROCEDURE

3.0 POWER SUPPLY


3.1 INTRODUCTION TO MICROCONTROLLERS
3.2 L293D IC
3.3 LCD
3.4 DC MOTOR
3.4 TEMPERATURE SENSOR

CHAPTER 4 SOFTWARE TOOLS

4.0 KEIL SOFTWARE


4.1 STEPS TO WRITE AN ASSEMBLY LANGUAGE PROGRAM
IN KEIL AND HOW TO COMPILE IT
4.2 PROLOAD

CHAPTER 5 ADVANTAGES AND APPLICATIONS

5.0 ADVANTAGES OF USING A DATA


ACQUISITION FOR COLLECTING DATA
5.1 DATA LOGGING VERSUS DATA ACQUISITION
5.2 APPLICATIONS

CHAPTER 6 CONCLUSION AND FUTURE DIRECTIONS

6.0 CONCLUSION
6.1 FUTURE DIRECTIONS

BIBLIOGRAPHY
AIM:
The original intention of design of short-range wireless communication network is to provide short-
distance broadband wireless access to mobile environment or formulation of temporary network; it is the
further development of internet in mobile environment.

PURPOSE:
The purpose is to provide short-range wireless communication network for lower cost and more
flexible use, wireless receiver module of multi-point short-range wireless data collection and
transmission network, which provides a low-powered and high-performance wireless data
communication system.
METHODOLOGY:
BLOCK DIAGRAM:
TRANSMITTER SECTION:

LCD
POWER SUPPLY

TEMPARATURE
H HC-05
MICRO LDR
C CONTROLLER T
D
RESET C
GAS SENSOR

CRYSTAL FIRE SENSOR


OSCILLATOR
RECEIVER SECTION:

SMART

MOBILE

PHONE

POWER SUPPLY:

Step Down Bridge Filter Regulator


Transformer Rectifier Circuit section

DESCRIPTION:
Data Acquisition system is an embedded system, which collects the data at predefined time
intervals from different sensors for different physical measurements like temperature, light, Smoke etc.,
This project presents a new development of wireless Communication for data transmission. These
systems not only provide the ability to easily design and develop, but also display the collected data in
transmitter and receiver.
This project consists of two sections. One is Transmitter section and the other is Receiver section.
In transmitter section, the sensors regarding the respective parameters are made to available such as
temperature sensor, Smoke Sensor, LDR etc. In the Receiver section, the parameters are displayed in
mobile phone.

SOFTWARES:

1. Embedded C
2. Keil IDE

3. Uc-Flash

HARDWARE COMPONENTS:

1. Microcontroller

2. Power supply

3. HC-05 BLUETOOTH MODEM

4. Temperature Sensor

5. LDR
6. GAS SENSOR

7. LCD

8. FIRE SENSOR

RESULT:
With this project we can implement data acquisition and transmission design.
CHAPTER 1
INTRODUCTION

INTRODUCTION TO DATA ACQUISITION:


1.0 WHAT IS A DATA ACQUISITION?
A Data Acquisition is an electronic instrument used to take measurements from
sensors and store those measurements for future use. Some common measurements
include temperature, pressure, current, velocity, strain, displacement, and other physical
phenomena.

This includes many data acquisition devices such as plug-in boards or serial
communication systems which use a computer as a real time data recording system. However,
most instrument manufacturers consider a data Acquisition a stand alone device that can read
various types of electrical signals and store the data in internal memory for later download to a
computer.

Data loggers vary between general purpose types for a range of measurement
applications to very specific devices for measuring in one environment only. It is common for
general purpose types to be programmable however many remains as static machines with only
a limited number of changeable parameters. Electronic data loggers have replaced chart records
in many applications.

1.1 DIFFERENT TYPES OF DATA ACQUISITION:


The differences between various data loggers are based on the way that data is
recorded and stored. The basic difference between the two data logger types is that one
type allows the data to be stored in a memory, to be retrieved at a later time, while the
other type automatically records the data on paper, for immediate viewing and analysis.
Many data loggers combine these two functions, usually unequally, with the emphasis on
either the ability to transfer the data or to provide a printout of it.

1.2HOW CAN NETWORKING BE USED FOR EXTENSIVE


ACQUISITION REQUIREMENTS?
For users who must acquire data over many locations, and wish to have a single
collection/recording point, networking is a truly viable solution. With a network, one
central location is responsible for data storage and recording; data is collected by remote
units in various locations, and then fed to this “master” unit for storage/recording. This is
a great convenience, in that an operator can retrieve the data from one location, rather
than having to go to each individual site for collection.

1.3 AIM OF PROJECT:


To capture the data (Temperature, Gas, Humidity etc) by using sensors for
maintaining the process control systems automatically.

COMPONENTS REQUIRED:

HARDWARE:
o Microcontroller (AT89S52)
o Gas Sensor
o Temperature Sensor
o Humidity Sensor
o Multi 10k Pot
o Reset switch
o LCD
CHAPTER 2
EMBEDDED SYSTEMS

EMBEDDED SYSTEMS

2.0 INTRODUCTION:
An embedded system is a system which is going to do a predefined specified task is the
embedded system and is even defined as combination of both software and hardware.

FIG: EMBEDDED SYSTEM

A general-purpose definition of embedded systems is that they are devices used to


control, monitor or assist the operation of equipment, machinery or plant. "Embedded"
reflects the fact that they are an integral part of the system. In many cases their
embeddedness may be such that their presence is far from obvious to the casual observer
and even the more technically skilled might need to examine the operation of a piece of
equipment for some time before being able to conclude that an embedded control system
was involved in its functioning. At the other extreme a general-purpose computer may be
used to control the operation of a large complex processing plant, and its presence will be
obvious.
All embedded systems are including computers or microprocessors. Some of these
computers are however very simple systems as compared with a personal computer.
The very simplest embedded systems are capable of performing only a single function or
set of functions to meet a single predetermined purpose. In more complex systems an
application program that enables the embedded system to be used for a particular purpose
in a specific application determines the functioning of the embedded system. The ability
to have programs means that the same embedded system can be used for a variety of
different purposes. In some cases a microprocessor may be designed in such a way that
application software for a particular purpose can be added to the basic software in a
second process, after which it is not possible to make further changes. The applications
software on such processors is sometimes referred to as firmware.
The simplest devices consist of a single microprocessor (often called a "chip”), which
may itself be packaged with other chips in a hybrid system or Application Specific
Integrated Circuit (ASIC). Its input comes from a detector or sensor and its output goes to
a switch or activator which (for example) may start or stop the operation of a machine or,
by operating a valve, may control the flow of fuel to an engine.
As the embedded system is the combination of both software and hardware

Embedded
System

Software
Hardware

ALP Processor
C Peripherals
VB memory
Etc.,

FIG: BLOCK DIAGRAM OF EMBEDDED SYSTEM

Software deals with the languages like ALP, C, and VB etc., and Hardware deals with
Processors, Peripherals, and Memory.

Memory: It is used to store data or address.

Peripherals: These are the external devices connected

Processor: It is an IC which is used to perform some task

Processors are classified into four types like:


1. Micro Processor (µp)
2. Micro controller (µc)
3. Digital Signal Processor (DSP)
4. Application Specific Integrated Circuits (ASIC)

Micro Processor (µp): It is an electronic chip which performs arithmetic and logical
operations with assistance of internal memory.

ALU ALU

CU

MEMORY

BLOCK DIAGRAM OF MICRO PROCESSOR (µP)

Micro Controller (µc): It is a highly integrated micro processor designed for specific use
in embedded systems.

ALU

CU

MEMORY

EEPROM,
ADC,
DAC,
TIMERS,
USART,

OSCILLATORS
Etc.
BLOCK DIAGRAM OF MICRO CONTROLLER (µC)
2.1 APPLICATIONS OF EMBEDDED SYSTEM:

Embedded controllers may be found in many different kinds of system and are used for
many different applications. The list, which follows, is indicative rather than exhaustive.
An item in the list may be relevant to a particular company because either (a) it is or
involves a core process or product, (b) it is or involves an ancillary function or service
performed by the company or (c) it refers to a product or service provided by a contractor
under some form of agreement and the vulnerability of the supplier may need to be
considered.

LIST OF APPLICATIONS OF EMBEDDED SYSTEMS:


 Manufacturing and process control
 Construction industry
 Transport
 Buildings and premises
 Domestic service
 Communications
 Office systems and mobile equipment
 Banking, finance and commercial
 Medical diagnostics, monitoring and life support
 Testing, monitoring and diagnostic systems

INDUSTRIAL FUNCTIONS OF EMBEDDED SYSTEMS:


A manufacturing company has provided the following list of embedded systems:

Multi-loop control and monitoring - DCS, SCADA, telemetry Panel mounted devices -
Control, display, recording and operations.

Safety and security - Alarm and trip systems, fire and gas systems, buildings and facilities
security.

Field devices - measurement, actuation.

Analytical systems - Laboratory systems; on-line/ plant systems.

Electrical supply - supply, measurement, control, protection.

Tools - for design, documentation, testing, maintenance.


EMBEDDED SYSTEMS COMPARED WITH COMMERCIAL SYSTEMS:

The Year 2000 problem in embedded systems differs from the problem in
commercial / database / transaction processing systems (often referred to as IT systems)
in a number of ways. Firstly the user's problem may much lie much deeper than packages
or applications software. It may lie in and be inseparable from systems and operating
software and from hardware, i.e. in the platform on which the application software is
based. When users of IT systems have hardware or operating software problems they can
and should be made the concern of the computer supplier: typically, this is not the case
with microprocessors and devices based on them.

Secondly in embedded systems the concern is often with intervals rather than with
specific dates: the need may be for an event to occur at 100-day intervals rather than on
the 5th day of each month. This has the implication that Year 2000 problems may reveal
themselves both before and for some time after 1 January 2000 and not at all on the date
itself.

The lifetime of embedded systems tends to be greater than that of commercial


data processing systems: they remain in use for longer without alteration to their
software. Because their software may therefore be older they are rendered more liable to
Year 2000 problems.
CHAPTER 3
DESIGN PROCESS

3.0 POWER SUPPLY

POWER SUPPLY:

The input to the circuit is applied from the regulated power supply. The a.c. input i.e.,
230V from the mains supply is step down by the transformer to 12V and is fed to a
rectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order to
get a pure d.c voltage, the output voltage from the rectifier is fed to a filter to remove any
a.c components present even after rectification. Now, this voltage is given to a voltage
regulator to obtain a pure constant dc voltage.

BLOCK DIAGRAM OF POWER SUPPLY:

230V AC D.C
50Hz Output

Step down Bridge


transformer Fil Regulator
Rectifier
ter
STEP DOWN TRANSFORMER:

The step down transformer is used to step down the main supply voltage from 230V AC
to lower value. This 230V AC voltage cannot be used directly, thus it is stepped down. The
transformer consists of primary and secondary coils. To reduce or step down the voltage the
transformer is designed to contain less number of turns in its secondary core. The output from
the secondary coil is also in AC form. Thus the conversion from AC to DC is essential. This
conversion is achieved by using the rectifier circuit.

FIG: TRANSFORMER

RECTIFIER:

The rectifier circuit is used to convert the AC voltage into its corresponding DC voltage. There
are half wave and full wave rectifiers available for this specific function. The most important
simple device used in rectifier circuit is the diode the simple function of the diode is to conduct
when forward biased and not to conduct in reverse bias. The efficient circuit used is the full wave
bridge rectifier circuit. The output voltage of the rectifier is in ripple form. The ripples from the
obtained DC voltages are removed by using the filter circuit.

FIG: BRIDGE RECTIFIER DB107

INPUT FILTER:

Capacitors are used as filters. The ripples from the DC voltage are removed and pure DC
voltage is obtained. The primary action performed by capacitor is charging and discharging; it
charges in positive half cycle of the AC voltage and discharges during the negative half cycle. So
it allows only the AC voltage and does not allow DC voltage. This filter is fixed before the
regulator thus the output is free from ripples.

REGULATOR UNIT:
Regulator regulates the output voltage to be always constant. The output voltage is
maintained constant irrespective of the fluctuations in the input AC voltage. When the internal
resistance of the power supply is greater than 30ohms the output gets fluctuated. Thus this can be
successfully reduced here. The regulators are mainly classified for low voltage and for high
voltage.
Positive regulator – regulates the positive voltage.
Negative regulator – regulates the negative voltage.

FIG: VOLTAGE REGULATOR LM7805

FIXED POSITIVE VOLTAGE REGULATORS:

FIG: VOLTAGE REGULATOR

The series 78XX regulators provide fixed regulated voltages from +5V to +24V. Figure shows
how one such IC, a 7805, is connected to provide voltage regulation with output from this unit
of +5V DC. An unregulated input voltage Vi is filtered by capacitor Ci and connected to the IC’s
IN terminal. The IC’s OUT terminal provides a regulated +5V, which is filtered by capacitor Co
(mostly for any high frequency noise). The third terminal of IC is connected to ground (GND).
While the input voltage may vary over some permissible voltage range and the output load may
vary over some acceptable range, the output voltage remains constant within specified voltage
variation limits. These limitations are spelled out in the manufacturer’s specification sheets.

A table of positive voltage regulated ICs is provided in the following table:

POSITIVE VOLTAGE REGULATOR IN 7800 SERIES:

IC PART OUTPUT
MINIMUM Vi(V)
VOLTAGE(V)
7805 +5 7.3
7806 +6 8.3
7808 +8 10.5
7810 +10 12.5
7812 +12 14.6
7815 +15 17.7
7818 +18 21.0
7824 +24 27.1

OUTPUT FILTER:

The filter circuit is often fixed after the regulator circuit. Capacitor is most often used as
filter. The principle of the capacitor is to charge and discharge. It charges during the positive half
cycle of the AC voltage and discharges during the negative half cycle. So it allows only the AC
voltage and does not allow the DC voltage. This filter is fixed after the regulator circuit to filter
any of the possibly found ripples in the output received finally. The output at this stage is 5V and
is given to the micro controller PIC16F877.
3.1 INTRODUCTION TO MICROCONTROLLER:
Microcontroller is a true computer on a chip the design incorporates all
of the features found in a microprocessor CPU: arithmetic and logic unit, stack
pointer, program counter and registers. It has also had added additional features
like RAM, ROM, serial I/O, counters and clock circuit.

Like the microprocessor, a microcontroller is a general purpose device,


but one that is meant to read data, perform limited calculations on that data and
control it’s environment based on those calculations. The prime use of a
microcontroller is to control the operation of a machine using a fixed program
that is stored in ROM and that does not change over the lifetime of the system.

The design approach of a microcontroller uses a more limited set of


single byte and double byte instructions that are used to move code and data
from internal memory to ALU. Many instructions are coupled with pins on the
IC package; the pins are capable of having several different functions
depending on the wishes of the programmer.

The microcontroller is concerned with getting the data from and on to its
own pins; the architecture and instruction set are optimized to handle data in bit
and byte size.

FEATURES:

 Compatible with MCS-51® Products


• 8K Bytes of In-System Programmable (ISP) Flash Memory
– Endurance: 1000 Write/Erase Cycles
• 4.0V to 5.5V Operating Range
• Fully Static Operation: 0 Hz to 33 MHz
• Three-level Program Memory Lock
• 256 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Three 16-bit Timer/Counters
• Eight Interrupt Sources
• Full Duplex UART Serial Channel
• Low-power Idle and Power-down Modes
• Interrupt Recovery from Power-down Mode
• Watchdog Timer
• Dual Data Pointer
• Power-off Flag

DESCRIPTION:

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


8K bytes of in-system programmable Flash memory. The device is manufactured using
Atmel’s high-density nonvolatile memory technology and is compatible with the
industry- standard 80C51 instruction set and pinout. The on-chip Flash allows the
program memory to be reprogrammed in-system or by a conventional nonvolatile
memory programmer. By combining a versatile 8-bit CPU with in-system programmable
Flash on a monolithic chip, the Atmel AT89S52 is a poweIRul microcontroller which
provides a highly-flexible and cost-effective solution to many embedded control
applications.
The AT89S52 provides the following standard features: 8K bytes of Flash, 256
bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit
timer/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.
FIG: MICROCONTROLLER AT89S52

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
interrupt or hardware reset.
PIN CONFIGURATION:

PIN DESCRIPTION:

VCC:
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 1 also receives the low-order address bytes during Flash
programming and 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 memory that use 16-bit addresses (MOVX @ DPTR). In this
application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to
external data memory that use 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, 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 AT89S52, as shown in the following table.
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. This pin drives High for 96 oscillator periods after the Watchdog times
out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In
the default state of bit DISRTO, the RESET HIGH out feature is enabled.

ALE/PROG:

Address Latch Enable (ALE) 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 (PSEN) 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.

XTAL1:

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

XTAL2:

Output from the inverting oscillator amplifier. XTAL1 and XTAL2 are the input and
output, respectively, of an inverting amplifier that can be configured for use as an on-chip
oscillator, as shown in Figure. Either a quartz crystal or ceramic resonator may be used.
To drive the device from an external clock source, XTAL2 should be left unconnected
while XTAL1 is driven, as shown in the below figure. There are no requirements on the
duty cycle of the external clock signal, since the input to the internal clocking circuitry is
through a divide-by-two flip-flop, but minimum and maximum voltage high and low time
specifications must be observed.
FIG: OSCILLATOR CONNECTIONS

C1, C2 = 30 pF ± 10 pF for Crystals


= 40 pF ± 10 pF for Ceramic Resonators

FIG: EXTERNAL CLOCK DRIVE CONFIGURATION

8052 MICROCONTROLLER MEMORY ORGANIZATION:

The microcontroller memory is divided into Program Memory and Data Memory.
Program Memory (ROM) is used for permanent saving program being executed, while
Data Memory (RAM) is used for temporarily storing and keeping intermediate results
and variables. Depending on the model in use (still referring to the whole 8052
microcontroller family) at most a few Kb of ROM and 128 or 256 bytes of RAM can be
used. However…
All 8052 microcontrollers have 16-bit addressing bus and can address 64 kb memory. It is
neither a mistake nor a big ambition of engineers who were working on basic core
development. It is a matter of very clever memory organization which makes these
controllers a real “programmers’ tidbit“.

PROGRAM MEMORY :

The oldest models of the 8052 microcontroller family did not have any internal program
memory. It was added from outside as a separate chip. These models are recognizable by
their label beginning with 803 (for ex. 8031 or 8032). All later models have a few Kbytes
ROM embedded, Even though it is enough for writing most of the programs, there are
situations when additional memory is necessary. A typical example of it is the use of so
called lookup tables. They are used in cases when something is too complicated or when
there is no time for solving equations describing some process. The example of it can be
totally exotic (an estimate of self-guided rockets’ meeting point) or totally common
(measuring of temperature using non-linear thermo element or asynchronous motor speed
control). In those cases all needed estimates and approximates are executed in advance
and the final results are put in the tables (similar to logarithmic tables).
How does the microcontroller handle external memory depend on the pin EA logic
state?
EA=0 In this case, internal program memory is completely ignored, only a program
stored in external memory is to be executed.
EA=1 In this case, a program from built-in ROM is to be executed first (to the last
location). Afterwards, the execution is continued by reading additional memory.
in both cases, P0 and P2 are not available to the user because they are used for data and
address transmission. Besides, the pins ALE and PSEN are used too.

DATA MEMORY :

As already mentioned, Data Memory is used for temporarily storing and keeping data and
intermediate results created and used during microcontroller’s operating. Besides, this
microcontroller family includes many other registers such as: hardware counters and
timers, input/output ports, serial data buffers etc. The previous versions have the total
memory size of 256 locations, while for later models this number is incremented by
additional 128 available registers. In both cases, these first 256 memory locations
(addresses 0-FFh) are the base of the memory common to all types of the 8052
microcontrollers. Locations available to the user occupy memory space with addresses
from 0 to 7Fh. First 128 registers and this part of RAM is divided in several blocks.
The first block consists of 4 banks each including 8 registers designated as R0 to R7.
Prior to access them, a bank containing that register must be selected. Next memory
block (in the range of 20h to 2Fh) is bit- addressable, which means that each bit being
there has its own address from 0 to 7Fh. Since there are 16 such registers, this block
contains in total of 128 bits with separate addresses (The 0th bit of the 20h byte has the
bit address 0 and the 7th bit of the 2Fh byte has the bit address 7Fh). The third groups of
registers occupy addresses 2Fh-7Fh (in total of 80 locations) and does not have any
special purpose or feature.

ADDITIONAL MEMORY BLOCK OF DATA MEMORY :

In order to satisfy the programmers’ permanent hunger for Data Memory, producers have
embedded an additional memory block of 128 locations into the latest versions of the
8052 microcontrollers. Naturally, it’s not so simple…The problem is that electronics
peIRorming addressing has 1 byte (8 bits) on disposal and due to that it can reach only
the first 256 locations. In order to keep already existing 8-bit architecture and
compatibility with other existing models a little trick has been used.
Using trick in this case means that additional memory block shares the same addresses
with existing locations intended for the SFRs (80h- FFh). In order to differentiate
between these two physically separated memory spaces, different ways of addressing are
used. A direct addressing is used for all locations in the SFRs, while the locations from
additional RAM are accessible using indirect addressing.
FIG: MICROCONTROLLER INTERNAL STRUCTURE
How to extend memory?

In case on-chip memory is not enough, it is possible to add two external memory chips
with capacity of 64Kb each. I/O ports P2 and P3 are used for their addressing and data
transmission.

From the users’ perspective, everything functions quite simple if properly connected
because the most operations are peIRormed by the microcontroller itself. The 8052
microcontroller has two separate reading signals RD#(P3.7) and PSEN#. The first one is
activated byte from external data memory (RAM) should be read, while another one is
activated to read byte from external program memory (ROM). These both signals are
active at logical zero (0) level. A typical example of such memory extension using special
chips for RAM and ROM is shown on the previous picture. It is called Harward
architecture.
Even though the additional memory is rarely used with the latest versions of the
microcontrollers, it will be described here in short what happens when memory chips are
connected according to the previous scheme. It is important to know that the whole
process is performed automatically, i.e. with no intervention in the program.
 When the program during execution encounters the instruction which resides
in external memory (ROM), the microcontroller will activate its control output ALE and
set the first 8 bits of address (A0-A7) on P0. In this way, IC circuit 74HCT573 which
"lets in" the first 8 bits to memory address pins is activated.
 A signal on the pin ALE closes the IC circuit 74HCT573 and immediately
afterwards 8 higher bits of address (A8-A15) appear on the port. In this way, a desired
location in additional program memory is completely addressed. The only thing left over
is to read its content.
 Pins on P0 are configured as inputs, the pin PSEN is activated and the
microcontroller reads content from memory chip. The same connections are used both for
data and lower address byte.
Similar occurs when it is a needed to read some location from external Data Memory.
Now, addressing is performed in the same way, while reading or writing is performed via
signals which appear on the control outputs RD or WR.

ADDRESSING :

While operating, processor processes data according to the program instructions. Each
instruction consists of two parts. One part describes what should be done and another part
indicates what to use to do it. This later part can be data (binary number) or address
where the data is stored. All 8052 microcontrollers use two ways of addressing depending
on which part of memory should be accessed:

DIRECT ADDRESSING :

On direct addressing, a value is obtained from a memory location while the address of
that location is specified in instruction. Only after that, the instruction can process data
(how depends on the type of instruction: addition, subtraction, copy…). Obviously, a
number being changed during operating a variable can reside at that specified address.
For example:
Since the address is only one byte in size ( the greatest number is 255), this is how only
the first 255 locations in RAM can be accessed in this case the first half of the basic
RAM is intended to be used freely, while another half is reserved for the SFRs.
INDIRECT ADDRESSING:

On indirect addressing, a register which contains address of another register is specified


in the instruction. A value used in operating process resides in that another register. For
example:
Only RAM locations available for use are accessed by indirect addressing (never in the
SFRs). For all latest versions of the microcontrollers with additional memory block
(those 128 locations in Data Memory), this is the only way of accessing them. Simply,
when during operating, the instruction including “@” sign is encountered and if the
specified address is higher than 128 (7F hex.), the processor knows that indirect
addressing is used and jumps over memory space reserved for the SFRs.
On indirect addressing, the registers R0, R1 or Stack Pointer are used for specifying 8-bit
addresses. Since only 8 bits are available, it is possible to access only registers of internal
RAM in this way (128 locations in former or 256 locations in latest versions of the
microcontrollers). If memory extension in form of additional memory chip is used then
the 16-bit DPTR Register (consisting of the registers DPTRL and DPTRH) is used for
specifying addresses. In this way it is possible to access any location in the range of 64K.

SFRs (SPECIAL FUNCTION REGISTERS):

SFRs are a kind of control table used for running and monitoring microcontroller’s
operating. Each of these registers, even each bit they include, has its name, address in the
scope of RAM and clearly defined purpose ( for example: timer control, interrupt, serial
connection etc.). Even though there are 128 free memory locations intended for their
storage, the basic core, shared by all types of 8052 controllers, has only 21 such registers.
Rest of locations are intensionally left free in order to enable the producers to further
improved models keeping at the same time compatibility with the previous versions. It
also enables the use of programs written a long time ago for the microcontrollers which
are out of production now.
A REGISTER (ACCUMULATOR)

This is a general-purpose register which serves for storing intermediate results during
operating. A number (an operand) should be added to the accumulator prior to execute an
instruction upon it. Once an arithmetical operation is preformed by the ALU, the result is
placed into the accumulator. If a data should be transferred from one register to another, it
must go through accumulator. For such universal purpose, this is the most commonly
used register that none microcontroller can be imagined without (more than a half 8052
microcontroller's instructions used use the accumulator in some way).

B REGISTER :

B register is used during multiply and divide operations which can be


performed only upon numbers stored in the A and B registers. All other instructions in the
program can use this register as a spare accumulator (A).

During programming, each of registers is called by name so that their exact address
is not so important for the user. During compiling into machine code (series of
hexadecimal numbers recognized as instructions by the microcontroller), PC will
automatically, instead of registers’ name, write necessary addresses into the
microcontroller.

R REGISTERS (R0-R7) :

This is a common name for the total 8 general purpose registers (R0, R1, R2 ...R7). Even
they are not true SFRs, they deserve to be discussed here because of their purpose. The
bank is active when the R registers it includes are in use. Similar to the accumulator, they
are used for temporary storing variables and intermediate results. Which of the banks will
be active depends on two bits included in the PSW Register. These registers are stored in
four banks in the scope of RAM.

DESCRIPTION:

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


with 4K bytes of Flash programmable memory. The device is manufactured using
Atmel’s high-density nonvolatile memory technology and is compatible with the
industry-standard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash
on a monolithic chip, the Atmel AT89S52 is a powerful microcomputer, which provides a
highly flexible and cost-effective solution to many embedded control applications.
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.
MACHINE CYCLE FOR THE 8052:

The CPU takes a certain number of clock cycles to execute an instruction. In the 8052
family, these clock cycles are referred to as machine cycles. The length of the machine
cycle depends on the frequency of the crystal oscillator. The crystal oscillator, along with
on-chip circuitry, provides the clock source for the 8052 CPU.
The frequency can vary from 4 MHz to 30 MHz, depending upon the chip rating and
manufacturer. But the exact frequency of 11.0592 MHz crystal oscillator is used to make
the 8052 based system compatible with the serial port of the IBM PC.
In the original version of 8052, one machine cycle lasts 12 oscillator periods. Therefore,
to calculate the machine cycle for the 8052, the calculation is made as 1/12 of the crystal
frequency and its inverse is taken.

LIGHT-EMITTING DIODE (LED):


Light-emitting diodes are elements for light signalization in electronics. They are
manufactured in different shapes, colors and sizes. For their low price, low consumption
and simple use, they have almost completely pushed aside other light sources- bulbs at
first place. They perform similar to common diodes with the difference that they emit
light when current flows through them.

It is important to know that each diode will be immediately destroyed unless its current is
limited. This means that a conductor must be connected in parallel to a diode. In order to
correctly determine value of this conductor, it is necessary to know diode’s voltage drop
in forward direction, which depends on what material a diode is made of and what color
it is. Values typical for the most frequently used diodes are shown in table below: As
seen, there are three main types of LEDs. Standard ones get full brightness at current of
20mA. Low Current diodes get full brightness at ten times lower current while Super
Bright diodes produce more intensive light than Standard ones.
Since the 8052 microcontrollers can provide only low input current and since their pins
are configured as outputs when voltage level on them is equal to 0, direct connecting to
LEDs is carried out as it is shown on figure (Low current LED, cathode is connected to
output pin).

3.3 LCD SCREEN:


LCD screen consists of two lines with 16 characters each. Each character consists
of 5x7 dot matrix. Contrast on display depends on the power supply voltage and whether
messages are displayed in one or two lines. For that reason, variable voltage 0-Vdd is
applied on pin marked as Vee. Trimmer potentiometer is usually used for that purpose.
Some versions of displays have built in backlight (blue or green diodes). When used
during operating, a resistor for current limitation should be used (like with any LE diode).

FIG: LCD SCREEN

The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line
LCDs which have only 1 controller and support at most of 80 characters, whereas LCDs
supporting more than 80 characters make use of 2 HD44780 controllers.
FIG: PIN DESCRIPTION OF LCD

Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins
(two pins are extra in both for back-light LED connections). Pin description is shown in
the table below

FIG: CHARACTER LCD TYPE HD44780 PIN DIAGRAM

PIN DESCRIPTION OF CHARACTER LCD:


Pin No. Name Description

Pin no. 1 VSS Power supply (GND)

Pin no. 2 VCC Power supply (+5V)

Pin no. 3 VEE Contrast adjust


0 = Instruction input
Pin no. 4 RS
1 = Data input

Pin no. 5 R/W 0 = Write to LCD module


1 = Read from LCD module

Pin no. 6 EN Enable signal

Pin no. 7 D0 Data bus line 0 (LSB)

Pin no. 8 D1 Data bus line 1

Pin no. 9 D2 Data bus line 2

Pin no. 10 D3 Data bus line 3

Pin no. 11 D4 Data bus line 4

Pin no. 12 D5 Data bus line 5

Pin no. 13 D6 Data bus line 6

Pin no. 14 D7 Data bus line 7 (MSB)

TABLE 1: CHARACTER LCD PINS WITH 1 CONTROLLER


Pin No.
Name Description

Pin no. 1 D7 Data bus line 7 (MSB)

Pin no. 2 D6 Data bus line 6

Pin no. 3 D5 Data bus line 5

Pin no. 4 D4 Data bus line 4

Pin no. 5 D3 Data bus line 3

Pin no. 6 D2 Data bus line 2

Pin no. 7 D1 Data bus line 1

Pin no. 8 D0 Data bus line 0 (LSB)

Pin no. 9 EN1 Enable signal for row 0 and 1


(1stcontroller)

Pin no. 10 R/W 0 = Write to LCD module


1 = Read from LCD module

Pin no. 11 RS 0 = Instruction input


1 = Data input

Pin no. 12 VEE Contrast adjust

Pin no. 13 VSS Power supply (GND)

Pin no. 14 VCC Power supply (+5V)

Pin no. 15 EN2 Enable signal for row 2 and 3


(2ndcontroller)

Pin no. 16 NC Not Connected


TABLE 2: CHARACTER LCD PINS WITH 2 CONTROLLER
3.3.0 LCD OPERATION:

In recent years the LCD is finding widespread use replacing LED s (seven-segment
LED s or other multi-segment LED s).This is due to the following reasons:
1. The declining prices of LCDs.
2. The ability to display numbers, characters and graphics. This is in contrast to
LED which is limited to numbers and a few characters.
3. Incorporation of a refreshing controller into the LCD, there by relieving the
CPU of the task of refreshing the LCD. In the case of LED s, they must be
refreshed by the CPU to keep on displaying the data.
4. Ease of programming for characters and graphics.

3.3.1 LCD BASIC COMMANDS:

All data transferred to LCD through outputs D0-D7 will be interpreted as commands or
as data, which depends on logic state on pin RS:
RS = 1 - Bits D0 - D7 are addresses of characters that should be displayed. Built in
processor addresses built in “map of characters” and displays corresponding symbols.
Displaying position is determined by DDRAM address. This address is either previously
defined or the address of previously transferred character is automatically incremented.
RS = 0 - Bits D0 - D7 are commands which determine display mode. List of commands
which LCD recognizes are given in the table below:
3.3.2 LCD CONNECTION :
Depending on how many lines are used for connection to the microcontroller, there
are 8-bit and 4-bit LCD modes. The appropriate mode is determined at the beginning of
the process in a phase called “initialization”. In the first case, the data are transferred
through outputs D0-D7 as it has been already explained. In case of 4-bit LED mode, for
the sake of saving valuable I/O pins of the microcontroller, there are only 4 higher bits
(D4-D7) used for communication, while other may be left unconnected.
Consequently, each data is sent to LCD in two steps: four higher bits are sent first
(that normally would be sent through lines D4-D7), four lower bits are sent afterwards.
With the help of initialization, LCD will correctly connect and interpret each data
received. Besides, with regards to the fact that data are rarely read from LCD (data
mainly are transferred from microcontroller to LCD) one more I/O pin may be saved by
simple connecting R/W pin to the Ground. Such saving has its price. Even though
message displaying will be normally performed, it will not be possible to read from busy
flag since it is not possible to read from display.

3.3.3 LCD INITIALIZATION:


Once the power supply is turned on, LCD is automatically cleared. This process lasts for
approximately 15mS. After that, display is ready to operate. The mode of operating is set
by default. This means that:
1. Display is cleared
2. Mode
DL = 1 Communication through 8-bit interface
N = 0 Messages are displayed in one line
F = 0 Character font 5 x 8 dots
3. Display/Cursor on/off
D = 0 Display off
U = 0 Cursor off
B = 0 Cursor blink off
4. Character entry
ID = 1 Addresses on display are automatically incremented by 1
S = 0 Display shift off
Automatic reset is mainly performed without any problems. Mainly but not always! If for
any reason power supply voltage does not reach full value in the course of 10mS, display
will start perform completely unpredictably. If voltage supply unit cannot meet this
condition or if it is needed to provide completely safe operating, the process of
initialization by which a new reset enabling display to operate normally must be applied.
Algorithm according to the initialization is being performed depends on whether
connection to the microcontroller is through 4- or 8-bit interface. All left over to be done
after that is to give basic commands and of course- to display messages.
FIG: PROCEDURE ON 8-BIT INITIALIZATION.

3.3.4 CONTRAST CONTROL:


To have a clear view of the characters on the LCD, contrast should be adjusted. To adjust
the contrast, the voltage should be varied. For this, a preset is used which can behave like
a variable voltage device. As the voltage of this preset is varied, the contrast of the LCD
can be adjusted.

FIG: VARIABLE RESISTOR

3.3.5 POTENTIOMETER:

Variable resistors used as potentiometers have all three terminals connected.


This arrangement is normally used to vary voltage, for example to set the switching
point of a circuit with a sensor, or control the volume (loudness) in an amplifier circuit. If
the terminals at the ends of the track are connected across the power supply, then the
wiper terminal will provide a voltage which can be varied from zero up to the maximum
of the supply.
POTENTIOMETER SYMBOL

3.3.6 PRESETS:

These are miniature versions of the standard variable resistor. They are designed to
be mounted directly onto the circuit board and adjusted only when the circuit is built. For
example to set the frequency of an alarm tone or the sensitivity of a light-sensitive circuit.
A small screwdriver or similar tool is required to adjust presets.
Presets are much cheaper than standard variable resistors so they are sometimes used in
projects where a standard variable resistor would normally be used.

MULTITURN PRESETS:

These are used where very precise adjustments must be made. The screw must be turned
many times (10+) to move the slider from one end of the track to the other, giving very
fine control.

PRESET SYMBOL
3.3.7 LCD INTERFACING WITH THE MICROCONTROLLER:

3.5.1 SERIAL PORT:

SERIAL CORDS:

The serial cables are required to interface the PC to the transmitter circuit. It is a 9-pin
serial extension cord. They are connected to the pc comport via male-female connector.
The cords serially transmit the data. The schematic of connector is shown in the figure
[1].

FIG.1 SERIAL PORT CONNECTOR

3.5.2 MAX 232 DRIVER:

The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to


supply EIA-232 voltage levels from a single 5-V supply. Each receiver converts EIA-232
inputs to 5-V TTL/CMOS levels. These receivers have a typical threshold of 1.3 V and a
typical hysteresis of 0.5 V, and can accept ±30-V inputs. Each driver converts
TTL/CMOS input levels into EIA-232 levels.

The pin diagram is shown in the following figure [2]. It is 16 pin IC package. It can also
formed by using pair of transistors. But we have used specialized interface IC like the
MAX232.
FIG.2 PIN DIAGRAM

It receives the data from comport and transfer it serially to the RF modulator. The
schematic of interfacing of pc with max 232 driver circuit is shown in fig.[2.3]. This
circuit features the best noise rejection and is very reliable and protected against
discharges and short-circuits. RS-232 is simple, universal and well understood. RS232
data is bi-polar.... +3 TO +12 volts indicates an "ON or 0-state (SPACE) condition" while
A -3 to -12 volts indicates an "OFF" 1-state (MARK) condition. Modern computer
equipment ignores the negative level and accepts a zero voltage level as the "OFF" state.
In fact, the "ON" state may be achieved with lesser positive potential. This means circuits
powered by 5 VDC are capable of driving RS232 circuits directly.
FIG.3 INTERFACING OF PC WITH MAX 232 DRIVER CIRCUIT

3.6 LM35 TEMPERATURE SENSOR

LM35 is a precision IC temperature sensor with its output proportional to the


temperature (in oC). The sensor circuitry is sealed and therefore it is not subjected to
oxidation and other processes. With LM35, temperature can be measured more
accurately than with a thermistor. It also possess low self heating and does not cause
more than 0.1 oC temperature rise in still air.
The operating temperature range is from -55°C to 150°C. The output voltage varies by
10mV in response to every oC rise/fall in ambient temperature, i.e., its scale factor is
0.01V/ oC

Pin No Function Name


1 Supply voltage; 5V (+35V to -2V) Vcc
2 Output voltage (+6V to -1V) Output
3 Ground (0V) Ground
FIG: TEMPERATURE SENSOR LM35

3.7 TEMPERATURE SENSOR

This project uses IC LM35 as a sensor for detecting accurate centigrade temperature. Linearity
defines how well over a range of temperature a sensor’s output consistently changes. Unlike thermistor,
Linearity of a precision IC Sensors are very good of 0.5°C accuracy and has wide temperature range. its
output voltage is linearly proportional to the Celsius (Centigrade) temperature.
The LM35 is rated to operate over a -55° to +150°C temperature range.It draws only 60 µA from its
supply, it has very low self-heating, less than 0.1°C in still air. LM35 Operates from 4 to 30 volts.

Output of IC is 10mv/degree centigrade for eg if the output of sensor is 280 mV then temperature is 28
degree C. so by using a Digital multimeter we can easily calculate the degree temperature. For trigger
point you should set the voltage of pin 2 of IC 741 by using preset or potentiometer.
Our aim of this project is not to construct a thermometer but to activate or deactivate a device at a
particular margin temperature. For simplicity we have used 2 LED for indication of both low (Green) and
high (Red) temperature.
Circuit Diagram of temperature sensor
Working: The output of IC2 increases in proportion to the temperature by 10 mV per degree. This
varying voltage is feed to a comparator IC 741 (OP Amplifier). OP Amplifier are among the most widely
used electronic devices today.The op-amp is one type of differential amplifier. It has two input inverting
(-) and non-inverting (+) and one output pin. We have used IC741 as non-inverting amplifier which
means pin 3 is the input and the output is not reversed. This circuit amplifies the difference between its
input terminals.

As a comparator, Bistable output of an op amplifier is as follows :-

Part list:
IC LM35, IC LM741
Resistance: 10K Ohms, 470 Ohms X 2Pcs
Preset or P.O.T of 2K Ohms
LED 2pcs (Red and Green)
9V Battery with Snap
Switch, wire
*By making this Temperature Sensor Project, student will be capable of making many similar project i.e
Automatic room heater controller, determine hotness of Tea or Coffee to avoid burning your
tongue,Automatic Fan Controller etc.
3.8 LDR

LIGHT DEPENDENT RESISTOR


INTRODUCTION:
An LDR (Light dependent resistor), as its name suggests, offers resistance in response to the ambient
light. The resistance decreases as the intensity of incident light increases, and vice versa. In the absence
of light, LDR exhibits a resistance of the order of mega-ohms which decreases to few hundred ohms in
the presence of light. It can act as a sensor, since a varying voltage drop can be obtained in accordance
with the varying light. It is made up of cadmium sulphide (CdS).
An LDR has a zigzag cadmium sulphide track. It is a bilateral device, i.e., conducts in both directions in
same fashion.

A Light Dependent Resistor (aka LDR, photoconductor, or photocell) is a device which has a
resistance which varies according to the amount of light falling on its surface.
Crystal Oscillator:

It provide clock pulses of 11.0592 Mhz frequency. It can be used as UART clock
(6×1.8432 MHz). It allows integer division to common baud rates (96×115200 baud or
96×96×1,200 baud). It is a common clock for Intel 8051 microprocessors It uses the
mechanical resonance of a vibrating crystal of piezoelectric material to create an
electrical signal with a very precise frequency. This frequency is commonly used to keep
track of time, to provide a stable clock signal for digital integrated circuits, and to
stabilize frequencies for radio transmitters and receivers. The most common type of
piezoelectric resonator used is the quartz crystal, so oscillator circuits incorporating them
became known as crystal oscillators. The crystal oscillator circuit sustains oscillation by
taking a voltage signal from the quartz resonator, amplifying it, and feeding it back to the
resonator. The rate of expansion and contraction of the quartz is the resonant frequency,
and is determined by the cut and size of the crystal. When the energy of the generated
output frequencies matches the losses in the circuit, an oscillation can be sustained. One
of the most important traits of the crystal oscillator is that it exhibits very low phase
noise. In the crystal oscillator, the crystal mostly vibrates in one axis, therefore only one
phase is dominant. This property of low phase noise makes them particularly useful in
telecommunications where stable signals are needed, and in scientific equipment where
very precise time references are needed. The result is that a quartz crystal behaves like a
circuit composed of an inductor, capacitor and resistor, with a precise resonant frequency
FEATURES:

- The crystal oscillator circuit sustains oscillation by taking a voltage signal from the
quartz resonator, amplifying it, and feeding it
back to the resonator
- It provides clock pulses of 11.0592 MHz frequency.
- The popularity of the crystals is due to low cost.
FIRE SENSOR

There are several types of flame detector. The optical flame detector is a detector that uses optical
sensors to detect flames. There are also ionization flame detectors, which use current flow in the flame
to detect flame presence, and thermocouple flame detectors.
Infrared Flame Detector

Infrared (IR) flame detectors work within the infrared spectral band. Hot gases emit a specific spectral
pattern in the infrared region, which can be sensed with a thermal imaging camera (TIC) a type
of thermo graphic. False alarms can be caused by other hot surfaces and background thermal radiation in
the area as well as blinding from water and solar energy. A typical frequency where single frequency IR
flame detector is sensitive is in the 4.4 micrometer range. Typical response time is 3-5 seconds.

GAS DETECTOR:

A Gas detector also called a smoke alarm is a device that detects smoke, typically as an indicator of fire.
Commercial, industrial, and mass residential devices issue a signal to a fire alarm system, while
household detectors, known as smoke alarms, generally issue a local audible or visual alarm from the
detector itself.
INCLUDEPICTURE "http://i00.i.aliimg.com/wsphoto/v1/595802680_1/MQ-2-Gas-Sensor-LPG-i-
butane-propane-methane-alcohol-13073.jpg_350x350.jpg" \* MERGEFORMATINET
INCLUDEPICTURE "http://i00.i.aliimg.com/wsphoto/v1/595802680_1/MQ-2-Gas-Sensor-LPG-i-
butane-propane-methane-alcohol-13073.jpg_350x350.jpg" \* MERGEFORMATINET

INCLUDEPICTURE
"http://www.elecfreaks.com/wiki/images/thumb/d/d2/MQ-0205-04.jpg/500px-MQ-0205-04.jpg" \*
MERGEFORMATINET INCLUDEPICTURE
"http://www.elecfreaks.com/wiki/images/thumb/d/d2/MQ-0205-04.jpg/500px-MQ-0205-04.jpg" \*

MERGEFORMATINET

Gas detectors are typically housed in a disk-shaped plastic enclosure about 150 millimeters (6 in) in
diameter and 25 millimeters (1 in) thick, but the shape can vary by manufacturer or product line. Most
smoke detectors work either by optical detection (photoelectric) or by physical process (ionization),
while others use both detection methods to increase sensitivity to smoke. Sensitive alarms can be used to
detect, and thus deter, smoking in areas where it is banned such as toilets and schools. Smoke detectors
in large commercial, industrial, and residential buildings are usually powered by a central fire alarm
system, which is powered by the building power with a battery backup. However, in many single family
detached and smaller multiple family housings, a smoke alarm is often powered only by a single
disposable battery.

In the United States, the National Fire Protection Association estimates that nearly two-thirds of deaths
from home fires occur in properties without working smoke alarms/detectors.

CHAPTER-4
SOFTWARE TOOLS
4.0 KEIL SOFTWARE:
Keil compiler is a software used where the machine language code is written and
compiled. After compilation, the machine source code is converted into hex code which
is to be dumped into the microcontroller for further processing. Keil compiler also
supports C language code.

4.1 STEPS TO WRITE AN ASSEMBLY LANGUAGE PROGRAM IN KEIL


AND HOW TO COMPILE IT:

1. Install the Keil Software in the PC in any of the drives.

2. After installation, an icon will be created with the name “Keil uVision3”. Just drag this
icon onto the desktop so that it becomes easy whenever you try to write programs in keil.

3. Double click on this icon to start the keil compiler.

4. A page opens with different options in it showing the project workspace at the leftmost
corner side, output window in the bottom and an ash coloured space for the program to be
written.

5. Now to start using the keil, click on the option “project”.

6. A small window opens showing the options like new project, import project, open
project etc. Click on “New project”.

7. A small window with the title bar “Create new project” opens. The window asks the
user to give the project name with which it should be created and the destination location.
The project can be created in any of the drives available. You can create a new folder and
then a new file or can create directly a new file.
8. After the file is saved in the given destination location, a window opens where a list of
vendors will be displayed and you have to select the device for the target you have
created.

9. The most widely used vendor is Atmel. So click on Atmel and now the family of
microcontrollers manufactured by Atmel opens. You can select any one of the
microcontrollers according to the requirement.
10. When you click on any one of the microcontrollers, the features of that particular
microcontroller will be displayed on the right side of the page. The most appropriate
microcontroller with which most of the projects can be implemented is the AT89S52.
Click on this microcontroller and have a look at its features. Now click on “OK” to select
this microcontroller.

11. A small window opens asking whether to copy the startup code into the file you have
created just now. Just click on “No” to proceed further.

12. Now you can see the TARGET and SOURCE GROUP created in the project
workspace.

13. Now click on “File” and in that “New”. A new page opens and you can start writing
program in it.

14. After the program is completed, save it with any name but with the .asm extension.
Save the program in the file you have created earlier.

15. You can notice that after you save the program, the predefined keywords will be
highlighted in bold letters.

16. Now add this file to the target by giving a right click on the source group. A list of
options open and in that select “Add files to the source group”. Check for this file where
you have saved and add it.
17. Right click on the target and select the first option “Options for target”. A window
opens with different options like device, target, output etc. First click on “target”.

18. Since the set frequency of the microcontroller is 11.0592 MHz to interface with the
PC, just enter this frequency value in the Xtal (MHz) text area and put a tick on the Use
on-chip ROM. This is because the program what we write here in the keil will later be
dumped into the microcontroller and will be stored in the inbuilt ROM in the
microcontroller.

19. Now click the option “Output” and give any name to the hex file to be created in the
“Name of executable” text area and put a tick to the “Create HEX file” option present in
the same window. The hex file can be created in any of the drives. You can change the
folder by clicking on “Select folder for Objects”.
20. Now to check whether the program you have written is errorless or not, click on the
icon exactly below the “Open file” icon which is nothing but Build Target icon. You can
even use the shortcut key F7 to compile the program written.

21. To check for the output, there are several windows like serial window, memory
window, project window etc. Depending on the program you have written, select the
appropriate window to see the output by entering into debug mode.

22. The icon with the letter “d” indicates the debug mode.

23. Click on this icon and now click on the option “View” and select the appropriate
window to check for the output.

24. After this is done, click the icon “debug” again to come out of the debug mode.
25. The hex file created as shown earlier will be dumped into the microcontroller with the
help of another software called Proload.

4.2 PROLOAD:

Proload is a software which accepts only hex files. Once the machine code is
converted into hex code, that hex code has to be dumped into the microcontroller placed
in the programmer kit and this is done by the Proload. Programmer kit contains a
microcontroller on it other than the one which is to be programmed. This microcontroller
has a program in it written in such a way that it accepts the hex file from the keil
compiler and dumps this hex file into the microcontroller which is to be programmed. As
this programmer kit requires power supply to be operated, this power supply is given
from the power supply circuit designed above. It should be noted that this programmer kit
contains a power supply section in the board itself but in order to switch on that power
supply, a source is required. Thus this is accomplished from the power supply board with
an output of 12volts or from an adapter connected to 230 V AC.

1. Install the Proload Software in the PC.

2. Now connect the Programmer kit to the PC (CPU) through serial cable.

3. Power up the programmer kit from the ac supply through adapter.

4. Now place the microcontroller in the GIF socket provided in the programmer kit.
5. Click on the Proload icon in the PC. A window appears providing the information like
Hardware model, com port, device type, Flash size etc. Click on browse option to select
the hex file to be dumped into the microcontroller and then click on “Auto program” to
program the microcontroller with that particular hex file.
6. The status of the microcontroller can be seen in the small status window in the bottom
of the page.After this process is completed, remove the microcontroller from the
programmer kit and place it in your system board. Now the system board behaves
according to the program written in the microcontroller.

Loading the Projects


The example projects for this book are NOT loaded automatically when you install the KEIL compiler.
These files are stored on the CD in a directory “/Pont”. The files are arranged by chapter: for example,
the project discussed in Chapter 3 is in the directory “/Pont/Ch03_00-Hello”. Rather than using the
projects on the CD (where changes cannot be saved), please copy the files from CD onto an appropriate
directory on your hard disk.

Note: you will need to change the file properties after copying: file transferred from the CD will be ‘read
only’.

Configuring the Simulator


Open the KEIL Vision2
Go to Project – Open Project and browse for Hello in Ch03_00 in Pont and open it.

Go to Project – Select Device for Target ‘Target1’


Select 8052(all variants) and click OK

Now we need to check the oscillator frequency:


Go to project – Options for Target ‘Target1’
Make sure that the oscillator frequency is 12MHz.

Building the Target. Build the target as illustrated in the figure below
Running the Simulation. Having successfully built the target, we are now ready to start the debug
session and run the simulator. First start a debug session

The flashing LED we will view will be connected to Port 1. We therefore want to observe the

activity on this port


To ensure that the port activity is visible, we need to start the ‘periodic window update’ flag

Go to Debug - Go
While the simulation is running, view the performance analyzer to check the delay durations.

Go to Debug – Performance Analyzer and click on it


Double click on DELAY_LOOP_Wait in Function Symbols: and click Define button
CHAPTER 5
ADVANTAGES & APPLICATIONS
5.0 ADVANTAGES OF USING A DATA ACQUISITION FOR
COLLECTING DATA:
A data acquisition is an attractive alternative to either a recorder or data
acquisition system in many applications. When compared to a recorder, data loggers have
the ability to accept a greater number of input channels, with better resolution and
accuracy. Also, data loggers usually have some form of on-board intelligence, which
provides the user with diverse capabilities. For example, raw data can be analyzed to give
flow rates, differential temperatures, and other interpreted data that otherwise would
require manual analysis by the operator.

The major difference between a data acquisition and a recorder, however, is the
way the data itself is stored, analyzed and recorded. A common recorder accepts an input,
and compares it to a full scale value. The pen arm is then deflected across the recording
width, to produce the appropriate ratio of the actual input to the full scale input.

For example, using a recorder with a 1 Volt full scale, an input of 0.5 Volts would
move the pen 0.5/1 or 50% of the distance across the recording width. In comparison, a
data logger accepts an input which is fed into an analog-to-digital converter prior to
analysis and storage. This method has advantages in accuracy and resolution, while only
a recorder can provide a truly continuous trend recording.

5.1 DATA LOGGING VERSUS DATA ACQUISITION:


The terms data logging and data acquisition are often used interchangeably. However, in
a historical context they are quite different. A data logger is a data acquisition system, but a data
acquisition system is not necessarily a data logger.
 Data loggers typically have slower sample rates. A maximum sample rate of 1 Hz may be
considered to be very fast for a data logger, yet very slow for a typical data acquisition system.

 Data loggers are implicitly stand-alone devices, while typical data acquisition system
must remain tethered to a computer to acquire data. This stand-alone aspect of data loggers
implies on-board memory that is used to store acquired data. Sometimes this memory is very
large to accommodate many days, or even months, of unattended recording. This memory may
be battery-backed static random access memory, flash memory or EEPROM. Earlier data
loggers used magnetic tape punched paper tape, or directly viewable records such as “strip chart
recorders”.

 Given the extended recording times of data loggers, they typically feature a time-and
date-stamping mechanism to ensure that each recorded data value is associated with a date and
time of acquisition. As such, data loggers typically employ built-in real-time clocks whose
published drift can be an important consideration when choosing between data loggers.

 Data logger range from simple single-channel input to complex multi-channel


instruments. Typically, the simpler the device the less programming flexibility. Some more
sophisticated instruments allow for cross-channel computations and alarms based on
predetermined conditions. The newest of data loggers can serve web pages, allowing numerous
people to monitor a system remotely.

 The unattended and remote nature of many data logger applications implies the need in
some applications to operate from a DC power source, such as battery. Solar power may be used
to supplement these power sources. These constraints have generally led the data logger industry
to ensure that the devices they market are extremely power efficient relative to computers. In
many cases they are required to operate in harsh environmental conditions where computers will
not function reliably.
 This unattended nature also dictates that the data loggers must be extremely reliable.
Since they may operate for long periods nonstop with little or no human supervision, and may
be installed in harsh or remote locations, it is imperative that so long as they have power, they
will not fail to log data for any reason. Manufacturers go to great length to ensure that the
devices can be depended on in these applications. As such data loggers are almost completely
immune to the problems that might affect a general-purpose computer in the same application,
such as program crashes and the instability of some operating systems.

5.2 APPLICATIONS OF DATA ACQUISITION:


 Unattended weather station recording (such as wind speed / direction, temperature,
relative humidity, solar radiation)

 Unattended hydrographic recording (such as water level, water depth, water flow, water
PH, water conductivity).

 Unattended soil moisture level recording.

 Unattended gas pressure recording.

 Road traffic counting.

 Measure temperatures (humidity etc) of perishables during shipments.

 Process monitoring for maintenance and troubleshooting applications

 Wild life research.

 Measure vibration handling (drop height) environment of distribution packaging.

 Tank level monitoring.


 Deformation monitoring of any object with geodetic or geotechnical sensors controlled
by an automatic deformation monitoring system.

 Environmental monitoring.

 Vehicle testing

 Monitoring of relay status in railway signaling.

 For science education enabling ‘measurement’,’ scientific investigation ‘and an


appreciation of ‘change’.

 Record trend data at regular intervals in veterinary vital signs monitoring

DISADVANTAGES
 Continuous Monitoring has to be done
 Cost of equipment is high.

CHAPTER 6.
CONCLUSION &
FUTURE DIRECTIONS
6.0 CONCLUSION:

Data Acquisition is not limited for any particular application, it can be used any
where in a process industries with little modifications in software coding according to the
requirements. This concept not only ensures that our work will be usable in the future but
also provides the flexibility to adapt and extend, as needs change.

Basically, Data Acquisition is a stand alone device but we can even connect it to a
PC by using RS232.We can also use Agilent VEE Pro software which is a graphical
programming environment optimized for use with electronic instruments for providing
the lab view of the parameters measured using Data Acquisition

6.1 FUTURE DIRECTIONS:


Data Acquisition are changing more rapidly now than ever before. The original
model of a stand alone data logger is changing to one of a device that collects data but
also has access to wireless communications for alarming of events, automatic reporting of
data and remote control. Data Acquisition are beginning to serve web pages for current
readings e-mail their alarms and FTP their daily results into databases or direct to the
users.
BIBLIOGRAPHY
The 8051 Micro controller and embedded systems
Muhammad Ali Mazidi
Janice Gillispie Mazidi
The 8051 Micro controller Architecture, Programming & Applications
Kenneth J. Ayala
Fundamentals of Micro processors and Micro computers
B. Ram
Micro processor Architecture, Programming & Applications
Ramesh S. Gaonkar
Electronic Components
D.V. Prasad
References on the Web:
www.national.com
www.atmel.com
www.microsoftsearch.com
www.geocities.com

Das könnte Ihnen auch gefallen