67
S.NO. TOPIC PAGE NO. CERTIFICATES ABSTRACT 1 CHAPTER1:INTRODUCTION 01 INTRODUCTION OF PROJECT PROJECT OVERVIEW THESIS 2 CHAPTER2:HARDWARE DESCRIPTION 07 INTRODUCTION WITH BLOCK DIAGRAM MICROCONTROLLER REGULATED POWER SUPPLY LED INDICATOR POTENTIOMETER(POT) 3 CHAPTER3:SOFTWARE DESCRIPTION 35 PIC C COMPILER PROTEUS SOFTWARE PROCEDURAL STEPS FOR COMPILATION SIMULATION AND DUMPING 4 CHAPTER4:PROJECT DESCRIPTION 41 5 CHAPTER5:ADVANTAGES,DISADVANTAGE AND APPLICATIONS 43 6 CHAPTER6:RESLTS,CONCLUSION,FUTURE PROSPECTS 44

Final Copy

Embed Size (px)

DESCRIPTION

Final Copy

Citation preview

Page 1: Final Copy

S.NO. TOPIC PAGE NO.CERTIFICATES

ABSTRACT

1 CHAPTER1:INTRODUCTION 01INTRODUCTION OF PROJECT

PROJECT OVERVIEW

THESIS

2 CHAPTER2:HARDWARE DESCRIPTION 07INTRODUCTION WITH BLOCK DIAGRAM

MICROCONTROLLER

REGULATED POWER SUPPLY

LED INDICATOR

POTENTIOMETER(POT)

3 CHAPTER3:SOFTWARE DESCRIPTION 35PIC C COMPILER

PROTEUS SOFTWARE

PROCEDURAL STEPS FOR COMPILATION

SIMULATION AND DUMPING4 CHAPTER4:PROJECT DESCRIPTION 415 CHAPTER5:ADVANTAGES,DISADVANTAGE

AND APPLICATIONS

43

6 CHAPTER6:RESLTS,CONCLUSION,FUTURE

PROSPECTS

44

REFERENCES

CHAPTER 1: INTRODUCTION

Page 2: Final Copy

The purpose of the project is to design a Micro controller based heart beat monitor, it is used to

give the signs and symptoms of heart disease which is very useful in early detection. It is a micro

controller based device, which gives the heart rate of any person at various time and various

conditions, which indicates the sign of every prospects of heart disease.

Early diagnosis for heart disease is typically based on tape recording of Electrocardiogram

(ECG) signal which is then studied and analyzed using a microcomputer. This paper however,

presents the design and implementation of a compact microcontroller-based portable system used

for control of heart rate on real time. Diagnosis of heart disease using ECG signals, may be

achieved by either correlating the pattern of the ECG signal with a typical healthy signal,

characterizing the typical ECG signal using basic logical decisions, or more complicated

algorithms to process in depth the heart disease. The first approach requires complicated

mathematical analysis to obtain the required diagnosis, while the second one involves only

simple analysis in most cases. A long-term study of ECG signal during everyday activity is

required to obtain a broad spectrum of heart disease categories based on heart rate changing.

Many techniques have been implemented, such as the use of a minicomputer in intensive care to

observe patients,or microprocessor-based card in portable system. In this case, the disadvantage

is the restriction of patient movement. A wire-free system connected to a hospital minicomputer

allows patient mobility within restricted area in the hospital. Tape systems for recording ECG

signals are bulky, heavy and prone to mechanical failure. In addition, these systems need large

batteries. In order to reduce the size, weight and power consumption of the system, a single chip

Reduced Instruction Set Computer (RISC) architecture microcontroller was chosen. To keep the

patient free of movement at home a data transmission protocol using e-mail is implemented in

the system. Aspects that have been carefully considered are:

The logic and arithmetic involved in the data acquisition and the analysis of the ECG signals.

The nature of the information to be stored.

Most single-chip microcontrollers are characterized by the limitations of the arithmetic instruction.

Page 3: Final Copy

It is therefore advantageous to use a simple mathematical analysis of the ECG signal. Regarding

memory, representation of the complete ECG signal by an equivalent diagnostic word

appreciably reduces the memory size required. Figure 1 shows the P, Q, R, S and T waves on an

electrocardiogram tracing (lead 1) illustrating the three normally recognizable deflection waves

and the important intervals. The method in storing information related to the ECG signal is

considered in this paper. In this method, only the time and type of variation compared to the

reference heart rate are registered. At the same time, the rate is processed to detect any disease,

such as, bradycardia or tachycardia either for adult or children. The system connected to the

parallel port of a microcomputer is able to transmit the information or the collected data to the

cardiologist by e-mail every end of the day. Further on, provision for storing number of ECG

signals assists the cardiologist to formulate his personal analysis and to be more confident of

system performance.

The main features of this project are:

1. User-friendly interaction with the user.

2. Highly sensitive.

3. Reliable

4. Easy to operate.

1.2 Project Overview: embedded system is a combination of software and hardware to

perform a dedicated task. Some of the main devices used in embedded products are

Microprocessors and Microcontrollers.

Microprocessors are commonly referred to as general purpose processors as they simply accept

the inputs, process it and give the output. In contrast, a microcontroller not only accepts the data

as inputs but also manipulates it, interfaces the data with various devices, controls the data and

thus finally gives the result.

The “Heart rate monitor with display on LCD” using PIC16F876 microcontroller is an

exclusive project which is used to help the people to know the heart rate whenever they want.

The main aim of the project is to provide a user-friendly interaction for the people.

Page 4: Final Copy

1.3 Thesis: The thesis explains the implementation of “Micro Controller based heart rate monitor

with display on LCD” using PIC16F876microcontroller.

CHAPTER 2: HARDWARE DESCRIPTION

2.1 Introduction:

Page 5: Final Copy

In this chapter the block diagram of the project and design aspect of independent

modules are considered. Block diagram is shown in fig: 3.1.1:

The main blocks of this project are:

1. Micro controller (16F876)

2. Reset button

3. Crystal oscillator

4. Regulated power supply (RPS)

5. LED indicator.

6. Switch.

7. control button

8. Potentiometer

9. Switch mode power supply

Microcontroller system(saving and diagnosis the heart rate)

ICST

Attached to pc parallel port

PC/LCD DISPLAY

Page 6: Final Copy

2.1.2 Micro controller:

Introduction to Microcontrollers:

Circumstances that we find ourselves in today in the field of microcontrollers had their

beginnings in the development of technology of integrated circuits. This development has made

it possible to store hundreds of thousands of transistors into one chip. That was a prerequisite for

production of microprocessors, and the first computers were made by adding external peripherals

such as memory, input-output lines, timers and other. Further increasing of the volume of the

package resulted in creation of integrated circuits. These integrated circuits contained both

processor and peripherals. That is how the first chip containing a microcomputer, or what would

later be known as a microcontroller came about.

Microprocessors and microcontrollers are widely used in embedded systems products.

Microcontroller is a programmable device. A microcontroller has a CPU in addition to a fixed

amount of RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed amount

of on-chip ROM, RAM and number of I/O ports in microcontrollers makes them ideal for many

applications in which cost and space are critical.

The microcontroller used in this project is PIC16F876. The PIC families of

microcontrollers are developed by Microchip Technology Inc. Currently they are some of the

most popular microcontrollers, selling over 120 million devices each year. There are basically

four families of PIC microcontrollers:

PIC12CXXX 12/14-bit program word

Page 7: Final Copy

PIC 16C5X 12-bit program word

PIC16CXXX and PIC16FXXX 14-bit program word

PIC17CXXX and PIC18CXXX 16-bit program word

The features, pin description of the microcontroller used are discussed in the following sections.

2.2.2 Description:

Introduction to PIC Microcontrollers:

PIC stands for Peripheral Interface Controller given by Microchip Technology to identify its

single-chip microcontrollers. These devices have been very successful in 8-bit microcontrollers.

The main reason is that Microchip Technology has continuously upgraded the device

architecture and added needed peripherals to the microcontroller to suit customers' requirements.

Low - end PIC Architectures:

Microchip PIC microcontrollers are available in various types. When PIC microcontroller MCU

was first available from General Instruments in early 1980's, the microcontroller consisted of a

simple processor executing 12-bit wide instructions with basic I/O functions. These devices are

known as low-end architectures. They have limited program memory and are meant for

applications requiring simple interface functions and small program & data memories. Some of

the low-end device numbers are

12C5XX

16C5X

16C505

Mid range PIC Architectures:

Page 8: Final Copy

Mid range PIC architectures are built by upgrading low-end architectures with more number of

peripherals, more number of registers and more data/program memory. Some of the mid-range

devices are

16C6X

16C7X

16F87X

Program memory type is indicated by an alphabet.

C = EPROM, F = Flash, RC = Mask ROM

Popularity of the PIC microcontrollers is due to the following factors.

Speed: Harvard Architecture, RISC architecture, 1 instruction cycle = 4 clock cycles.

Instruction set simplicity: The instruction set consists of just 35 instructions (as opposed to 111

instructions for 8051).

Power-on-reset and brown-out reset. Brown-out-reset means when the power supply goes below

a specified voltage (say 4V), it causes PIC to reset; hence malfunction is avoided. A watch dog

timer (user programmable) resets the processor if the software/program ever malfunctions and

deviates from its normal operation.

PIC microcontroller has four optional clock sources.

Low power crystal

Mid range crystal

High range crystal

RC oscillator (low cost).

Programmable timers and on-chip ADC.

Page 9: Final Copy

1. Up to 12 independent interrupt sources.

2. Powerful output pin control (25 mA (max.) current sourcing capability per pin.)

3. EPROM/OTP/ROM/Flash memory option.

4. I/O port expansion capability.

CPU Architecture:

The CPU uses Harvard architecture with separate Program and Variable (data) memory

interface. This facilitates instruction fetch and the operation on data/accessing of variables

simultaneously. Architecture of PIC microcontroller

Fig.2.3.Architecture of PIC microcontroller

Microcontroller Core Features:

• High performance RISC CPU

• Only 35 single word instructions to learn

• All single cycle instructions except for program branches which are two cycle

• Operating speed: DC - 20 MHz clock input DC - 200 ns instruction cycle

• Up to 8K x 14 words of FLASH Program Memory, Up to 368 x 8 bytes of Data Memory (RAM)Up to 256 x 8 bytes of EEPROM Data Memory

• Pinout compatible to the PIC16C73B/74B/76/77

Page 10: Final Copy

• Interrupt capability (up to 14 sources)

• Eight level deep hardware stack

• Direct, indirect and relative addressing modes

• Power-on Reset (POR)

• Power-up Timer (PWRT) and Oscillator Start-up Timer (OST)

• Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation

• Programmable code protection

• Power saving SLEEP mode

• Selectable oscillator options

• Low power, high speed CMOS FLASH/EEPROM technology

• Fully static design

• In-Circuit Serial Programming (ICSP) via two pins

• Single 5V In-Circuit Serial Programming capability

• In-Circuit Debugging via two pins

• Processor read/write access to program memory

• Wide operating voltage range: 2.0V to 5.5V

Pin Diagram:

Page 11: Final Copy
Page 12: Final Copy

Peripheral Features:

• Timer0: 8-bit timer/counter with 8-bit prescaler

• Timer1: 16-bit timer/counter with prescaler, can be incremented during SLEEP via external

Crystal/clock

• Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler

• Two Capture, Compare, PWM modules

- Capture is 16-bit, max. resolution is 12.5 ns

- Compare is 16-bit, max. resolution is 200 ns

- PWM max. resolution is 10-bit

• 10-bit multi-channel Analog-to-Digital converter

• Synchronous Serial Port (SSP) with SPI (Master mode) and I2C (Master/Slave)

• Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit address

Detection

• Parallel Slave Port (PSP) 8-bits wide, with external RD, WR and CS controls (40/44-pin only)

• Brown-out detection circuitry for Brown-out Reset (BOR)

Page 13: Final Copy

2.3 REGULATED POWER SUPPLY:

2.3.1 Introduction:

Power supply is a supply of electrical power. A device or system that supplies electrical or other

types of energy to an output load or group of loads is called a power supply unit or PSU. The

term is most commonly applied to electrical energy supplies, less often to mechanical ones, and

rarely to others.

A power supply may include a power distribution system as well as primary or secondary

sources of energy such as

Conversion of one form of electrical power to another desired form and voltage, typically

involving converting AC line voltage to a well-regulated lower-voltage DC for electronic

devices. Low voltage, low power DC power supply units are commonly integrated with the

devices they supply, such as computers and household electronics.

Batteries.

Chemical fuel cells and other forms of energy storage systems.

Solar power.

Generators or alternators.

Page 14: Final Copy

2.3.2 Block Diagram:

The basic circuit diagram of a regulated power supply (DC O/P) with led connected as load is

shown in fig: 2.3.3.

Fig 2.3.3 Circuit diagram of Regulated Power Supply with Led connection

Page 15: Final Copy

The components mainly used in above figure are

230V AC MAINS

TRANSFORMER

BRIDGE RECTIFIER(DIODES)

CAPACITOR

VOLTAGE REGULATOR(IC 7805)

RESISTOR

LED(LIGHT EMITTING DIODE)

The detailed explanation of each and every component mentioned above is as follows:

Transformation: The process of transforming energy from one device to another is called

transformation. For transforming energy we use transformers.

Transformers:

A transformer is a device that transfers electrical energy from one circuit to another

through inductively coupled conductors without changing its frequency. A varying current in the

first or primary winding creates a varying magnetic flux in the transformer's core, and thus a

varying magnetic field through the secondary winding. This varying magnetic field induces a

varying electromotive force (EMF) or "voltage" in the secondary winding. This effect is

called mutual induction.

If a load is connected to the secondary, an electric current will flow in the secondary winding and

electrical energy will be transferred from the primary circuit through the transformer to the load.

This field is made up from lines of force and has the same shape as a bar magnet.

If the current is increased, the lines of force move outwards from the coil. If the current is

reduced, the lines of force move inwards.

If another coil is placed adjacent to the first coil then, as the field moves out or in, the moving

lines of force will "cut" the turns of the second coil. As it does this, a voltage is induced in the

Page 16: Final Copy

second coil. With the 50 Hz AC mains supply, this will happen 50 times a second. This is called

MUTUAL INDUCTION and forms the basis of the transformer.

The input coil is called the PRIMARY WINDING; the output coil is the SECONDARY

WINDING. Fig: 3.3.4 shows step-down transformer.

Fig 2.3.4: Step-Down Transformer

The voltage induced in the secondary is determined by the TURNS RATIO.

For example, if the secondary has half the primary turns; the secondary will have half the

primary voltage.

Another example is if the primary has 5000 turns and the secondary has 500 turns,

then the turn’s ratio is 10:1.

If the primary voltage is 240 volts then the secondary voltage will be x 10 smaller

= 24 volts. Assuming a perfect transformer, the power provided by the primary must equal the

power taken by a load on the secondary. If a 24-watt lamp is connected across a 24 volt

secondary, then the primary must supply 24 watts.

To aid magnetic coupling between primary and secondary, the coils are wound on

a metal CORE. Since the primary would induce power, called EDDY CURRENTS, into this

Page 17: Final Copy

core, the core is LAMINATED. This means that it is made up from metal sheets insulated from

each other. Transformers to work at higher frequencies have an iron dust core or no core at all.

Note that the transformer only works on AC, which has a constantly changing

current and moving field. DC has a steady current and therefore a steady field and there would be

no induction.

Some transformers have an electrostatic screen between primary and secondary.

This is to prevent some types of interference being fed from the equipment down into the mains

supply, or in the other direction. Transformers are sometimes used for IMPEDANCE

MATCHING.

We can use the transformers as step up or step down.

Step Up transformer:

In case of step up transformer, primary windings are every less compared to

secondary winding.

Because of having more turns secondary winding accepts more energy, and it

releases more voltage at the output side.

Step down transformer:

Incase of step down transformer, Primary winding induces more flux than the

secondary winding, and secondary winding is having less number of turns because of that it

accepts less number of flux, and releases less amount of voltage.

Battery power supply:

A battery is a type of linear power supply that offers benefits that traditional

line-operated power supplies lack: mobility, portability and reliability. A battery consists of

multiple electrochemical cells connected to provide the voltage desired. Fig: 3.3.5 shows Hi-

Watt 9V battery.

Page 18: Final Copy

Fig 2.3.5: Hi-Watt 9V Battery

The most commonly used dry-cell battery is the carbon-zinc dry cell battery. Dry-

cell batteries are made by stacking a carbon plate, a layer of electrolyte paste, and a zinc plate

alternately until the desired total voltage is achieved. The most common dry-cell batteries have

one of the following voltages: 1.5, 3, 6, 9, 22.5, 45, and 90. During the discharge of a carbon-

zinc battery, the zinc metal is converted to a zinc salt in the electrolyte, and magnesium dioxide

is reduced at the carbon electrode. These actions establish a voltage of approximately 1.5 V.

The lead-acid storage battery may be used. This battery is rechargeable; it consists

of lead and lead/dioxide electrodes which are immersed in sulfuric acid. When fully charged, this

type of battery has a 2.06-2.14 V potential (A 12 volt car battery uses 6 cells in series). During

discharge, the lead is converted to lead sulfate and the sulfuric acid is converted to water. When

the battery is charging, the lead sulfate is converted back to lead and lead dioxide A nickel-

cadmium battery has become more popular in recent years. This battery cell is completely sealed

and rechargeable. The electrolyte is not involved in the electrode reaction, making the voltage

constant over the span of the batteries long service life. During the charging process, nickel

oxide is oxidized to its higher oxidation state and cadmium oxide is reduced. The nickel-

cadmium batteries have many benefits. They can be stored both charged and uncharged. They

have a long service life, high current availabilities, constant voltage, and the ability to be

recharged. Fig: 3.3.6 shows pencil battery of 1.5V.

Page 19: Final Copy

Fig 2.3.6: Pencil Battery of 1.5V

RECTIFICATION:

The process of converting an alternating current to a pulsating direct current is

called as rectification. For rectification purpose we use rectifiers.

Rectifiers:

A rectifier is an electrical device that converts alternating current (AC) to direct

current (DC),A process known as rectification. Rectifiers have many uses including as

components of power supplies and as detectors of radio signals. Rectifiers may be made of solid-

state diodes, vacuum tube diodes, mercury arc valves, and other components.

A device that it can perform the opposite function (converting DC to AC) is

known as an inverter.

When only one diode is used to rectify AC (by blocking the negative or positive

portion of the waveform), the difference between the term diode and the term rectifier is merely

one of usage, i.e., the term rectifier describes a diode that is being used to convert AC to DC.

Almost all rectifiers comprise a number of diodes in a specific arrangement for more efficiently

converting AC to DC than is possible with only one diode. Before the development of silicon

semiconductor rectifiers, vacuum tube diodes and copper (I) oxide or selenium rectifier stacks

were used.

Page 20: Final Copy

Bridge full wave rectifier:

The Bridge rectifier circuit is shown in fig: 3.3.7, which converts an ac voltage

to dc voltage using both half cycles of the input ac voltage. The Bridge rectifier circuit is shown

in the figure. The circuit has four diodes connected to form a bridge. The ac input voltage is

applied to the diagonally opposite ends of the bridge. The load resistance is connected between

the other two ends of the bridge.

For the positive half cycle of the input ac voltage, diodes D1 and D3 conduct,

whereas diodes D2 and D4 remain in the OFF state. The conducting diodes will be in series with

the load resistance RL and hence the load current flows through RL.

For the negative half cycle of the input ac voltage, diodes D2 and D4 conduct

whereas, D1 and D3 remain OFF. The conducting diodes D2 and D4 will be in series with the

load resistance RL and hence the current flows through RL in the same direction as in the previous

half cycle. Thus a bi-directional wave is converted into a unidirectional wave.

Input Output

Fig 2.3.7: Bridge rectifier: a full-wave rectifier using 4 diodes

Page 21: Final Copy

DB107:

Now -a -days Bridge rectifier is available in IC with a number of DB107. In our

project we are using an IC in place of bridge rectifier. The picture of DB 107 is shown in fig:

3.3.8.

Features:

Good for automation insertion

Surge overload rating - 30 amperes peak

Ideal for printed circuit board

Reliable low cost construction utilizing molded

Glass passivated device

Polarity symbols molded on body

Mounting position: Any

Weight: 1.0 gram

Fig 2.3.8: DB107

Filtration:

The process of converting a pulsating direct current to a pure direct current using filters is called

as filtration.

Page 22: Final Copy

Filters:

Electronic filters are electronic circuits, which perform signal-processing functions, specifically

to remove unwanted frequency components from the signal, to enhance wanted ones.

Introduction to Capacitors:

The Capacitor or sometimes referred to as a Condenser is a passive device, and one which stores

energy in the form of an electrostatic field which produces a potential (static voltage) across its

plates. In its basic form a capacitor consists of two parallel conductive plates that are not

connected but are electrically separated either by air or by an insulating material called

the Dielectric.When a voltage is applied to these plates, a current flows charging up the plates

with electrons giving one plate a positive charge and the other plate an equal and opposite

negative charge. This flow of electrons to the plates is known as the Charging Current and

continues to flow until the voltage across the plates (and hence the capacitor) is equal to the

applied voltage Vcc. At this point the capacitor is said to be fully charged and this is illustrated

below. The construction of capacitor and an electrolytic capacitor are shown in figures 3.3.9 and

3.3.10 respectively.

Fig 2.3.9:Construction Of a Capacitor Fig 2.3.10:Electrolytic Capaticor

Page 23: Final Copy

Units of Capacitance:

Microfarad  (μF) 1μF = 1/1,000,000 = 0.000001 = 10-6 F

 Nano farad  (nF) 1nF = 1/1,000,000,000 = 0.000000001 = 10-9 F

 Pico farad  (pF) 1pF = 1/1,000,000,000,000 = 0.000000000001 = 10-12 F

Operation of Capacitor:

Think of water flowing through a pipe. If we imagine a capacitor as being a storage tank with an

inlet and an outlet pipe, it is possible to show approximately how an electronic capacitor works.

First, let's consider the case of a "coupling capacitor" where the capacitor is used to connect a

signal from one part of a circuit to another but without allowing any direct current to flow.

If the current flow is alternating between zero and a

maximum, our "storage tank" capacitor will allow the

current waves to pass through.

However, if there is a steady current, only the initial short

burst will flow until the "floating ball valve" closes and

stops further flow.

So a coupling capacitor allows "alternating current" to pass through because the ball valve

doesn't get a chance to close as the waves go up and down. However, a steady current quickly

fills the tank so that all flow stops.

Page 24: Final Copy

A capacitor will pass alternating current but (apart from an initial surge) it will not pass d.c.

Where a capacitor is used to decouple a circuit, the effect is

to "smooth out ripples". Any ripples, waves or pulses of

current are passed to ground while d.c. Flows smoothly.

Regulation:

The process of converting a varying voltage to a constant regulated voltage is called as

regulation. For the process of regulation we use voltage regulators.

Voltage Regulator:

A voltage regulator (also called a ‘regulator’) with only three terminals appears to be a simple

device, but it is in fact a very complex integrated circuit. It converts a varying input voltage into

a constant ‘regulated’ output voltage. Voltage Regulators are available in a variety of outputs

like 5V, 6V, 9V, 12V and 15V. The LM78XX series of voltage regulators are designed for

positive input. For applications requiring negative input, the LM79XX series is used. Using a

pair of ‘voltage-divider’ resistors can increase the output voltage of a regulator circuit.

It is not possible to obtain a voltage lower than the stated rating. You cannot use a 12V regulator

to make a 5V power supply. Voltage regulators are very robust. These can withstand over-

current draw due to short circuits and also over-heating. In both cases, the regulator will cut off

before any damage occurs. The only way to destroy a regulator is to apply reverse voltage to its

input. Reverse polarity destroys the regulator almost instantly. Fig: 3.3.11 shows voltage

regulator.

Page 25: Final Copy

Fig 3.3.11: Voltage Regulator

Resistors:

A resistor is a two-terminal electronic component that produces a voltage across its terminals that

is proportional to the electric current passing through it in accordance with Ohm's law:

V = IR

Resistors are elements of electrical networks and electronic circuits and are ubiquitous in most

electronic equipment. Practical resistors can be made of various compounds and films, as well as

resistance wire (wire made of a high-resistivity alloy, such as nickel/chrome).

The primary characteristics of a resistor are the resistance, the tolerance, maximum working

voltage and the power rating. Other characteristics include temperature coefficient, noise, and

inductance. Less well-known is critical resistance, the value below which power dissipation

limits the maximum permitted current flow, and above which the limit is applied voltage. Critical

resistance is determined by the design, materials and dimensions of the resistor.

Resistors can be made to control the flow of current, to work as Voltage dividers, to dissipate

power and it can shape electrical waves when used in combination of other components. Basic

unit is ohms.

Page 26: Final Copy

Theory of operation:

Ohm's law: The behavior of an ideal resistor is dictated by the relationship specified in Ohm's

law:

V = IR

Ohm's law states that the voltage (V) across a resistor is proportional to the current (I) through it

where the constant of proportionality is the resistance (R).

Power dissipation:

The power dissipated by a resistor (or the equivalent resistance of a resistor network) is

calculated using the following:

Fig 3.3.12: Resistor Fig 3.3.13: Color Bands In Resistor

Page 27: Final Copy

2.4. LED:

A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator lamps

in many devices, and are increasingly used for lighting. Introduced as a practical electronic

component in 1962, early LEDs emitted low-intensity red light, but modern versions are

available across the visible, ultraviolet and infrared wavelengths, with very high brightness. The

internal structure and parts of a led are shown in figures 3.4.1 and 3.4.2 respectively.

Fig 2.4.1: Inside a LED Fig 2.4.2: Parts of a LED

Working:

The structure of the LED light is completely different than that of the light bulb. Amazingly, the

LED has a simple and strong structure. The light-emitting semiconductor material is what

determines the LED's color. The LED is based on the semiconductor diode.

When a diode is forward biased (switched on), electrons are able to recombine with holes within

the device, releasing energy in the form of photons. This effect is called electroluminescence and

the color of the light (corresponding to the energy of the photon) is determined by the energy gap

Page 28: Final Copy

of the semiconductor. An LED is usually small in area (less than 1 mm2), and integrated optical

components are used to shape its radiation pattern and assist in reflection. LEDs present many

advantages over incandescent light sources including lower energy consumption, longer lifetime,

improved robustness, smaller size, faster switching, and greater durability and reliability.

However, they are relatively expensive and require more precise current and heat management

than traditional light sources. Current LED products for general lighting are more expensive to

buy than fluorescent lamp sources of comparable output. They also enjoy use in applications as

diverse as replacements for traditional light sources in automotive lighting (particularly

indicators) and in traffic signals. The compact size of LEDs has allowed new text and video

displays and sensors to be developed, while their high switching rates are useful in advanced

communications technology. The electrical symbol and polarities of led are shown in fig: 3.4.3.

Fig 2.4.3: Electrical Symbol & Polarities of LED

LED lights have a variety of advantages over other light sources:

High-levels of brightness and intensity

High-efficiency

Low-voltage and current requirements

Low radiated heat

High reliability (resistant to shock and vibration)

No UV Rays

Long source life

Page 29: Final Copy

Can be easily controlled and programmed

Applications of LED fall into three major categories:

Visual signal application where the light goes more or less directly from the LED to the

human eye, to convey a message or meaning.

Illumination where LED light is reflected from object to give visual response of these

objects.

Generate light for measuring and interacting with processes that do not involve the

human visual system.

2.6 Potentiometer (POT):

A potentiometer (colloquially known as a "pot") is a three-terminal resistor with a sliding contact

that forms an adjustable voltage divider.[1] If only two terminals are used (one side and the

wiper), it acts as a variable resistor or rheostat. Potentiometers are commonly used to control

electrical devices such as volume controls on audio equipment. Potentiometers operated by a

mechanism can be used as position transducers, for example, in a joystick.

Potentiometers are rarely used to directly control significant power (more than a watt). Instead

they are used to adjust the level of analog signals (e.g. volume controls on audio equipment), and

as control inputs for electronic circuits. For example, a light dimmer uses a potentiometer to

control the switching of a TRIAC and so indirectly control the brightness of lamps.

Fig: Diagram of potentiometer

Page 30: Final Copy

Theory of operation:

The potentiometer can be used as a voltage divider to obtain a manually adjustable output

voltage at the slider (wiper) from a fixed input voltage applied across the two ends of the pot.

This is the most common use of pots.

The voltage across RL can be calculated by:

If RL is large compared to the other resistances (like the input to an operational

amplifier), the output voltage can be approximated by the simpler equation:

As an example, assume

, , , and

Since the load resistance is large compared to the other resistances, the output voltage VL

will be approximately:

Page 31: Final Copy

Due to the load resistance, however, it will actually be slightly lower: ≈ 6.623 V.

One of the advantages of the potential divider compared to a variable resistor in series with the

source is that, while variable resistors have a maximum resistance where some current will

always flow, dividers are able to vary the output voltage from maximum (VS) to ground (zero

volts) as the wiper moves from one end of the pot to the other. There is, however, always a small

amount of contact resistance.

In addition, the load resistance is often not known and therefore simply placing a variable

resistor in series with the load could have a negligible effect or an excessive effect, depending on

the load.

3.6.1 Potentiometer construction:

Fig: Diagram of internal construction of potentiometer

Construction of a wire-wound circular potentiometer:

The resistive element (1) of the shown device is trapezoidal, giving a non-linear

relationship between resistance and turn angle. The wiper (3) rotates with the axis (4), providing

the changeable resistance between the wiper contact (6) and the fixed contacts (5) and (9). The

vertical position of the axis is fixed in the body (2) with the ring (7) (below) and the bolt (8)

(above).

Page 32: Final Copy

A potentiometer is constructed with a resistive element formed into an arc of a circle, and a

sliding contact (wiper) traveling over that arc. The resistive element, with a terminal at one or

both ends, is flat or angled, and is commonly made of graphite, although other materials may be

used. The wiper is connected through another sliding contact to another terminal. On panel pots,

the wiper is usually the center terminal of three. For single-turn pots, this wiper typically travels

just under one revolution around the contact. "Multi turn" potentiometers also exist, where the

resistor element may be helical and the wiper may move 10, 20, or more complete revolutions,

though multi turn pots are usually constructed of a conventional resistive element wiped via a

worm gear. Besides graphite, materials used to make the resistive element include resistance

wire, carbon particles in plastic, and a ceramic/metal mixture called cermets.

One form of rotary potentiometer is called a String potentiometer. It is a multi-turn potentiometer

operated by an attached reel of wire turning against a spring. It is used as a position transducer.

In a linear slider pot, a sliding control is provided instead of a dial control. The resistive element

is a rectangular strip, not semi-circular as in a rotary potentiometer. Due to the large opening slot

or the wiper, this type of pot has a greater potential for getting contaminated.

Potentiometers can be obtained with either linear or logarithmic relations between the slider

position and the resistance (potentiometer laws or "tapers"). A letter code ("A" taper, "B" taper,

etc.) may be used to identify which taper is intended, but the letter code definitions are variable

over time and between manufacturers.

Manufacturers of conductive track potentiometers use conductive polymer resistor pastes that

contain hard wearing resins and polymers, solvents, lubricant and carbon – the constituent that

provides the conductive/resistive properties. The tracks are made by screen printing the paste

onto a paper based phenolic substrate and then curing it in an oven. The curing process removes

all solvents and allows the conductive polymer to polymerize and cross link. This produces a

durable track with stable electrical resistance throughout its working life.

Page 33: Final Copy

2.6.2 Types of potentiometers:

PCB mount trimmer potentiometers, or "trimpots", intended for infrequent adjustment.

1. Linear taper potentiometer

A linear taper potentiometer has a resistive element of constant cross-section, resulting in a

device where the resistance between the contact (wiper) and one end terminal is proportional to

the distance between them. Linear taper describes the electrical characteristic of the device, not

the geometry of the resistive element. Linear taper potentiometers are used when an

approximately proportional relation is desired between shaft rotation and the division ratio of the

potentiometer; for example, controls used for adjusting the centering of (an analog) cathode-ray

oscilloscope.

2. Logarithmic potentiometer

A logarithmic taper potentiometer has a resistive element that either 'tapers' in from one end to

the other, or is made from a material whose resistivity varies from one end to the other. This

results in a device where output voltage is a logarithmic function of the mechanical angle of the

pot.

Page 34: Final Copy

Most (cheaper) "log" pots are actually not logarithmic, but use two regions of different resistance

(but constant resistivity) to approximate a logarithmic law. A log pot can also be simulated with

a linear pot and an external resistor. True log pots are significantly more expensive.

Logarithmic taper potentiometers are often used in connection with audio amplifiers.

A high power wire wound potentiometer. Any potentiometer may be connected as a rheostat.

3. Rheostat:

The most common way to vary the resistance in a circuit is to use a variable resistor or a rheostat.

A rheostat is a two-terminal variable resistor. Often these are designed to handle much higher

voltage and current. Typically these are constructed as a resistive wire wrapped to form a toroid

coil with the wiper moving over the upper surface of the toroid, sliding from one turn of the wire

to the next. Sometimes a rheostat is made from resistance wire wound on a heat-resisting

cylinder with the slider made from a number of metal fingers that grip lightly onto a small

portion of the turns of resistance wire. The "fingers" can be moved along the coil of resistance

wire by a sliding knob thus changing the "tapping" point. They are usually used as variable

resistors rather than variable potential dividers.

Any three-terminal potentiometer can be used as a two-terminal variable resistor by not

connecting to the third terminal. It is common practice to connect the wiper terminal to the

Page 35: Final Copy

unused end of the resistance track to reduce the amount of resistance variation caused by dirt on

the track.

4. Digital potentiometer

A digital potentiometer is an electronic component that mimics the functions of analog

potentiometers. Through digital input signals, the resistance between two terminals can be

adjusted, just as in an analog potentiometer.

5. Membrane Potentiometer

A membrane potentiometer uses a conductive membrane that is deformed by a sliding element to

contact a resistor voltage divider. Linearity can range from 0.5% to 5% depending on the

material, design and manufacturing process. The repeat accuracy is typically between 0.1mm and

1.0mm with a theoretically infinite resolution. The service life of these types of potentiometers is

typically 1 million to 20 million cycles depending on the materials used during manufacturing

and the actuation method; contact and contactless (magnetic) methods are available. Many

different material variations are available such as PET(foil), FR4, and Kapton. Membrane

potentiometer manuafacturers offer linear, rotary, and application-specific variations. The linear

versions can range from 9mm to 1000mm in length and the rotary versions range from 0° to

360°(multi-turn), with each having a height of 0.5mm. Membrane potentiometers can be used for

position sensing.

2.6.3 Applications of Potentiometer:

Potentiometers are widely used as user controls, and may control a very wide variety of

equipment functions. The widespread use of potentiometers in consumer electronics has declined

in the 1990s, with digital controls now more common. However they remain in many

applications, such as volume controls and as position sensors.

Page 36: Final Copy

1. Audio control

1. Linear potentiometers ("faders")

One of the most common uses for modern low-power potentiometers is as audio control devices.

Both linear pots (also known as "faders") and rotary potentiometers (commonly called knobs) are

regularly used to adjust loudness, frequency attenuation and other characteristics of audio

signals.

The 'log pot' is used as the volume control in audio amplifiers, where it is also called an "audio

taper pot", because the amplitude response of the human ear is also logarithmic. It ensures that,

on a volume control marked 0 to 10, for example, a setting of 5 sounds half as loud as a setting

of 10. There is also an anti-log pot or reverse audio taper which is simply the reverse of a log pot.

It is almost always used in a ganged configuration with a log pot, for instance, in an audio

balance control.

Potentiometers used in combination with filter networks act as tone controls or equalizers.

2. Television

Potentiometers were formerly used to control picture brightness, contrast, and color response. A

potentiometer was often used to adjust "vertical hold", which affected the synchronization

between the receiver's internal sweep circuit (sometimes a multi vibrator) and the received

picture signal.

Page 37: Final Copy

3. Transducers

Potentiometers are also very widely used as a part of displacement transducers because of the

simplicity of construction and because they can give a large output signal.

4. Computation

In analog computers, high precision potentiometers are used to scale intermediate results by

desired constant factors, or to set initial conditions for a calculation. A motor-driven

potentiometer may be used as a function generator, using a non-linear resistance card to supply

approximations to trigonometric functions. For example, the shaft rotation might represent an

angle, and the voltage division ratio can be made proportional to the cosine of the angle.

Page 38: Final Copy

CHAPTER 3: SOFTWARE DESCRIPTION

This project is implemented using following software’s:

PIC C compiler - for compilation part

Proteus 7 (Embedded C) – for simulation part

3.1 PIC Compiler:

PIC compiler is 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. PIC compiler also supports C language code.

It’s important that you know C language for microcontroller which is commonly known as

Embedded C. As we are going to use PIC Compiler, hence we also call it PIC C. The PCB,

PCM, and PCH are separate compilers. PCB is for 12-bit opcodes, PCM is for 14-bitopcodes,

and PCH is for 16-bit opcode PIC microcontrollers. Due to many similarities, all three compilers

are covered in this reference manual. Features and limitations that apply to only specific

microcontrollers are indicated within. These compilers are specifically designed to meet the

unique needs of the PIC microcontroller. This allows developers to quickly design applications

software in a more readable, high-level language. When compared to a more traditional C

compiler, PCB, PCM, and PCH have some limitations. As an example of the limitations,

function recursion is not allowed.

This is due to the fact that the PIC has no stack to push variables onto, and also because of the

way the compilers optimize the code. The compilers can efficiently implement normal C

constructs, input/output operations, and bit twiddling operations. All normal C data types are

supported along with pointers to constant arrays, fixed point decimal, and arrays of bits.

PIC C is not much different from a normal C program. If you know assembly, writing a C

program is not a crisis. In PIC, we will have a main function, in which all your application

specific work will be defined. In case of embedded C, you do not have any operating system

running in there. So you have to make sure that your program or main file should never exit. This

can be done with the help of simple while (1) or for (;;) loop as they are going to run infinitely.

Page 39: Final Copy

We have to add header file for controller you are using, otherwise you will not be able to access

registers related to peripherals.

#include <16F72.h> // header file for PIC 16F72//

3.2 Proteus:

Proteus is 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 and this is done by the Proteus.

Proteus is a programmer which itself contains a microcontroller in 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 pic compiler and dumps this hex file into the microcontroller which is to be

programmed. As the Proteus programmer requires power supply to be operated, this power

supply is given from the power supply circuit designed and connected to the microcontroller in

proteus. The program which is to be dumped in to the microcontroller is edited in proteus and is

compiled and executed to check any errors and hence after the successful compilation of the

program the program is dumped in to the microcontroller using a dumper.

3.3 Procedural steps for compilation, simulation and dumping:

3.3.1 Compilation and simulation steps:

For PIC microcontroller, PIC C compiler is used for compilation. The compilation steps are as

follows:

Open PIC C compiler.

You will be prompted to choose a name for the new project, so create a separate folder

where all the files of your project will be stored, choose a name and click save.

Page 40: Final Copy

Fig 3.1: Picture of opening a new file using PIC C compiler

Click Project, New, and something the box named 'Text1' is where your code should be

written later.

Now you have to click 'File, Save as' and choose a file name for your source code ending

with the letter '.c'. You can name as 'project.c' for example and click save. Then you have

to add this file to your project work.

Page 41: Final Copy

Fig 3.2: Picture of compiling a new file using PIC C compiler

Fig 3.3: Picture of compiling a project.c file using PIC C compiler You can then start to write the source code in the window titled 'project.c' then before

testing your source code; you have to compile your source code, and correct eventual

syntax errors.

Page 42: Final Copy

Fig 3.4: Picture of checking errors and warnings using PIC C compiler

By clicking on compile option .hex file is generated automatically.

This is how we compile a program for checking errors and hence the compiled program

is saved in the file where we initiated the program.

Page 43: Final Copy

Fig 4.5: Picture of .hex file existing using PIC C compiler

After compilation, next step is simulation. Here first circuit is designed in Express PCB using

Proteus 7 software and then simulation takes place followed by dumping. The simulation steps

are as follows:

Open Proteus 7 and click on IS1S6.

Now it displays PCB where circuit is designed using microcontroller. To design circuit

components are required. So click on component option.

10. Now click on letter ’p’, then under that select PIC16F72 ,other components related to the

project and click OK. The PIC 16F72 will be called your “ 'Target device”, which is the final

destination of your source code.

Page 44: Final Copy

3.3.2 Dumping steps:The steps involved in dumping the program edited in proteus 7 to microcontroller are shown

below:

1. Initially before connecting the program dumper to the microcontroller kit the window is

appeared as shown below.

2. Select Tools option and click on Check Communication for establishing a connection as

shown in below window

3. After connecting the dumper properly to the microcontroller kit the window is appeared as

shown below.

4. Again by selecting the Tools option and clicking on Check Communication the

microcontroller gets recognized by the dumper and hence the window is as .

5. Import the program which is ‘.hex’ file from the saved location by selecting File option and

clicking on ‘Import Hex’ as shown in below window.

6. After clicking on ‘Import Hex’ option we need to browse the location of our program and

click the ‘prog.hex’ and click on ‘open’ for dumping the program into the microcontroller.

7. After the successful dumping of program the window is as shown below.

CHAPTER 4: PROJECT DESCRIPTION

Page 45: Final Copy

In this chapter, schematic diagram and interfacing of PIC16F876 microcontroller with

each module is considered.

4.1 circuit diagram of heart rate monitor:

In the above circuit diagram the interaction of led light with finger is shown to detect the heart

beat of any person for different conditions.In the above circuit diagram finger is inserted in

between the led and photo detector assembly due to the insertion of finger the variations in led

light is captured by photo detector in the form of voltage variation.

4.2Interfacing of PIC 16F876 with LCD display:

Page 46: Final Copy

CHAPTER 5: ADVANTAGES AND DISADVANTAGES

Page 47: Final Copy

Advantages:

1. Dynamic user input.

2. Reliable

3. Efficient and low cost design.

4. Low power consumption.

Disadvantages:

Detection of heart rate must be perform in dark room for efficient operation.

Applications:

This system can be practically implemented in real time for the early

detection of any heart disease

This system facilitates us to detect the change in heart rate in various

condition

Page 48: Final Copy

CHAPTER 6: RESULTS, CONCLUSION AND FUTURE PROSPECTS

Results: The system has been designed to incorporate the ECG signal diagnosis capability, the real-time

ECG processing, the remote control of a patient and the transportability. The diagnosis capability

of the logical algorithm used has been tested using a simulated ECG signal. In addition, the

diagnosis bytes associated with each heart signal are being verified but further statistical studies

on real ECG signals are required for more evaluation of the system validity. The processing time

required for generating and storing the diagnosis byte is 1.25 ms. This is believed to be

sufficiently short compared with typical heart signal variation. Hence the system is fast enough

to track any changes in heart condition. In this system, the microswitch (SW) is connected to the

ground (GND) for adult patient and to logic ‘1’ (Vcc) for children. By reading the microswitch

position, the system loads the corresponding references such as normal heart beat rate,

tachycardia and bradycardia rate. Implementation of the system on a single-chip microcontroller

reduces the overall weight and power consumption of the hardware required inthe measurement,

diagnosis and storage of ECG signals. In addition, this system is quite reliable compared with

magnetic recording system. This design may also measure other human health parameters such

as temperature, and blood pressure.

Conclusions:

In this paper, the implementation of an embedded system based on a microcontroller for real-

time analysis of ECG signals has been investigated. The system has been tested successfully on

simulated ECG signals for different heart diseases. In this method, a logical approach has

minimized overall memory size by storing only three bytes for each heart rate variation. Hence

the overall diagnosis time and the amount of data handled is also minimized. The time taken for

the state of any heart condition to be assessed is the time to record two successive diagnosis

bytes. The real-time decision is taken to inform the patient on his heart rhythmic conditions. It

should be noted that this system can be ported either by patient or sport-person. The

Page 49: Final Copy

programmable methodology employed in the design also allows others biomedical signals, such

as breathing rate and patient movements to be transmitted. In summary, a new medical wearable

device has been developed as part of a study targeted to heart rate control by e-mail. Final goals

of this paper are reducing the hospitalisation and assistance costs. In addition, patients and

families quality of life are increased. Furthermore, we believe that elderly people

as well, may benefit from this system.

REFERENCES

The sites which were used while doing this project:

1. www.wikipedia.com

2. www.allaboutcircuits.com

3. www.microchip.com

4. www.howstuffworks.com

Books referred:

1. Raj kamal –Microcontrollers Architecture, Programming, Interfacing and System Design.

2. Mazidi and Mazidi –Embedded Systems.

3. PCB Design Tutorial –David.L.Jones.

4. PIC Microcontroller Manual – Microchip.