Вы находитесь на странице: 1из 36

Contents

• Introduction
• Components
• Circuit Description
• Construction and Testing
• Hardware
• Software

21
• Bibliography
• Index

Heart Beat Meter


1
Introduction:

Objective:

Heart rate meter can be measured either by the ecg waveform or by the blood flow in to
the finger (pulsed method).the pulse method is simple & conventional.when blood flows during
the systolic stroke of the heart into the body parts,the finger gets its blood via the radial entry on
the atm.the blood flow into the finger can be sensed photoelectrically.

To count the heart beats,here we use a small light source on one side of the finger
(thumb) & observe the change in light intensity on the other side.the blood flow causes variation
in light intensity reaching the light depending dependent resistor(LDR),which results in change

21
in signal strength due to change in the resistance of the LDR.

The main objective of this project is to count the heart beats. This circuit will not give
accurate number but the number will vary between 50 and 120.

Methodology:

The setup uses a 6V electric bulb for light illumination of flesh on the thumb behind the nail and
the LDR as detector of change in light intensity due to the flow of blood. The photo-current is
converted into voltage and amplified by operational amplifier IC LM 358.

Microcontroller IC AT89C2051 is at the heart of the circuit.

The internal timer of the microcontroller is used to find the time taken for one wavelength. This
is converted into the heart beat rate in beats per minute by a pre-calculated look-up table.

The program notes the time between the high to low and low to high transitions of the wave.
The time in ms is converted in steps of 4ms for comparison with the values, already stored in the
look-up table. This number is used to find the heart rate in beats per minute.

The number so obtained is converted into a 3-digit number in BCD form. The same is output to
the 7-segment LED displays in a multiplexed manner.

Heart Beat Meter


2
Hardware

 6 volt electric bulb

 LDR(light dependent resistor)

 Operational amplifier IC LM358

 Microcontroller IC AT89C2051

 Buffer IC ULN2003

 Transistors BC557(PNP)

21
 Displays LTS542 common-anode,7-segment display

 5mm LED

 Resistors and capacitors

 On/Off and tactile switch

 11.0592MHz crystal

 6 volts batteries

Software

 The software is written in assembly language and assembled using ASM51 cross-assembler.

 The intel hex code is generated and burnt into the microcontroller chip by using a suitable
programmer.

 The software is well commented and easy to understand.

 The program used in this project is given behind.

Heart Beat Meter


3
21
Components

Semiconductors:

IC1 - LM358 operational amplifier

IC2 - AT89C2051 microcontroller

IC3 - ULN2003 current buffer

T1-T3 - BC557 pnp transistor

D1 - 1N4007 rectifier diode

DIS1-DIS3 - LTS542 common-anode,7-segment display

LED1, LED2 - 5mm LED

Resistors:

R1, R8 - 10-kilo-ohm

R2 - 47-kilo-ohm

Heart Beat Meter


4
R3 - 100-kilo-ohm

R4 -1-kilo-ohm

R6, R7 -330-kilo-ohm

R9-R11 -1.2-kilo-ohm

RNW1 -10-kilo-ohm resistor network

Capacitors:

C1 - 470µF ceramic disk

21
C2, C5, C8 - 0.1µF ceramic disk

C3, C9 - 470µF, 16V electrolytic

C4 - 10µF, 16V electrolytic

C6, C7 - 22pF ceramic disk

Miscellaneous:

S1, S3 - On/Off switch

S2 - Tactile switch

XTAL - 11.0592MHz crystal

BATT1, BATT2 -6V battery

Heart Beat Meter


5
Circuit Description:

21
Figure shows the circuit of microcontroller based heart rate meter.the setup uses a 6V
electricbulb for light illumination of flesh on the thumb behind the nail and the LDR as detector
of change in the light intensiyty due to the flow of blood.The photo-current is converted into
voltage and amplified by operational amplifier IC LM358 (IC1). The detected signal is given to
the noinverting input (pin 3) and its output is fed to another non=inverting input (pin 5) for
squraing and amplification.output pin 7 provides detected heartbeats to pin 12 of the
microcontroller.preset VR1 is used for sensitivity and preset VR2 for triggeringlevel settings.

Microcontroller IC AT89C2051 (IC2) is at the heart of the circuit. it is a20 pin,8-bit


microcontroller with 2 Kb of Flash Programmable and erasable read only memory ,128 bytes of
RAM.15 input/output lines,two 16-bit timer/counters,a five-vector two-level intterupt
architecture, a full-duplex serial port ,a precision analogue comparator and clock circuitary.

Port-1 pin P1.7 through P1.2,and port-3 pin 3.7 are connected to input pins 1 through 7 of IC
ULN2003 (IC 3) respectively .these pin are pulled up with 10 Kilo-ohm resistor network
rnw1.they drive all the segment of the 7-segment display with the help of inverting buffer IC3.

The displays are selected through port pins P3.0,P3.1 and P3.2 of the microcontroller (IC2).port
pins P3.0 down through P3.2 are connected to the base of transistor T3 through
T1,respectively.Pin 6 of IC2 goes low to drive transistor T1 into saturations and provide supply

Heart Beat Meter


6
to the common-anode.pin (either pin 3 or pin 8) of DIS1.similarly,transistor T2 and T3 drive
common anode pin 3 or 8 of 7-segment display DIS2 and DIS3,respectively.only three 7-
segment displays are used.

IC2 provides segment data and display-enable signal simultaneously in the time division
multiplex mode for displaying a particular number on the 7-segment display unit. segment data
and and displays-enable pulses for the display are refreshed every 5 ms. thus the display appears
to be continuous, even through it lights up one by one.

Switch S2 is used to manually reset the microcontroller ,while the power on reset signal for the
microcontroller is derivated from the combination of capacitor C4 and resistor R8.an
11.0592MHZ crystal is used to generate the basic clock frequency for the microcontroller. The

21
circuit is powered by 6V battery.

Port pin P3.6 of the microcontroller is internally available for software checking .this pin is
actually the output of the internal analogue levels at pin 12 and 13 of IC2 can work as an
analogue comparator, these are used for sensing the rise and fall of the pulse waveform and
thereby evaluate the time between two peaks and the beat rate.

The output of the pulse pick up preamplifier is fed to pin 12 of the microcontroller .Pin 13 of the
microcontroller is connected to the preset for reference-level setting of the comparator. thus
voltage at pins 12 and 13 are always compared. the signal rise and the fall at pin 12 are sensed by
the program.

The internal timer of the microcontroller is used to find the time taken for one wavelength. this
time is converted into the heart beat rate in beats per minute by a pre-calculated look-up table
.the program notes the time between the high-to-low and low-to-high transitions of the wave.
This time in microseconds is converted in steps of 4 ms for comparison with the values already
stored in the look-up table .This number is used to find (from the Lookup table) the heart rate in
beats per minute .The number so obtained is converted into a 3-digit number in binary coded
decimal (BCD) form. The same is output to the segment LED displays in a multiplexed manner.
The displays shows the rate for a while and proceeds to another measurement. Thus beat rates
obtained from time to time are visible on the display.

Heart Beat Meter


7
21

Heart Beat Meter


8
21

Heart Beat Meter


9
Flowchart of Design

21

Heart Beat Meter


10
Construction and Testing

The arrangement for heart beat rate detection is shown in Fig. purchase a plastic ‘T’ tube from an
electrical parts shop. the tube should be about 5cm long and have a diameter of 1.5 cm. house the
electric bulb into the left tube and the LDR into the right tube. Fit shields on both sides of the
tube to maintain darkness for better performance. Connect the 6V battery supply to the bulb and
the LDR to the circuit board via a shielded cable.

21
For heart beat detection, which can be seen on a cathode ray oscilloscope (CRO), insert your
thumb with the nail facing the LDR inside the T-tube. Shaking the thumb will change the level of
signal from the previous value, and it will keep oscillating. Therefore you have to hold thumb
firmly between the light bulb and the LDR while the measurement is being made.

Place the circuit component and IC bases on the PCB board. Check the pulse pickup through the
CRO at output pin 7 of IC1.incert the programmed microcontroller and other ICs into the IC
bases. Set the level of sensitivity ,trigger and voltage reference for the comparator by using
presets VR1, VR2 and VR3 respectively.

Hold the thumb steady and observe the heart beat rate on the display. The rate may vary and may
not be exactly steady. For instance normally, the rate can vary between 50 and 120.

Since this is a beat-to-beat measurement and not an average over a time period of one minute,
variation is expected. However, when the reading shows high value at times say 140, it may be
due to unusual mains hum picked up by the transducer. To supress it place a separate capacitor of
100 µF across the 6v supply.

Heart Beat Meter


11
21
PCB & Component Layout

An actual size, single-side PCB for the microcontroller based heart- rate meter and its
component lay out is shown in the above figure.

Heart Beat Meter


12
21
waveform of heartbeat detection.

If we want to see the output waveforms of the heart beats , then using a CRO we can see the
heart beats. The above figure shows the heartbeat detection waveforms.

Heart Beat Meter


13
Different ICs used in the project

 AT89c2051 micro controller :

Microcontroller IC AT89C2051 (IC2) is at the heart of the circuit .it is a20 pin,8-bit
microcontroller with 2 kb of Flash Programmable and erasable read only memory ,128 bytes
of RAM.15 input/output lines,two 16-bit timer/counters,a five-vector two-level intterupt
architecture, a full-duplex serial port ,a precision analogue comparator and clock circuitary.

AT89C2051

21
Features

• Compatible with MCS®-51Products

• 2K Bytes of Reprogrammable Flash Memory

– Endurance: 10,000 Write/Erase Cycles

• 2.7V to 6V Operating Range

• Fully Static Operation: 0 Hz to 24 MHz

• Two-level Program Memory Lock

• 128 x 8-bit Internal RAM

• 15 Programmable I/O Lines

• Two 16-bit Timer/Counters

• Six Interrupt Sources

• Programmable Serial UART Channel

• Direct LED Drive Outputs

Heart Beat Meter


14
• On-chip Analog Comparator

• Low-power Idle and Power-down Modes

• Green (Pb/Halide-free) Packaging Option

PIN DISCRIPTION

21
VCC

Supply voltage.

GND

Ground.

Port 1

The Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 to P1.7 provide internal pull-ups.
P1.0 and P1.1 require external pull-ups. P1.0 and P1.1 also serve as the positive input (AIN0)

Heart Beat Meter


15
and the negative input (AIN1), respectively, of the on-chip precision analog comparator. The
Port 1 output buffers can sink 20 mA and can drive LED displays directly. When 1s are written
to Port 1 pins, they can be used as inputs. When pins P1.2 to P1.7 are used as inputs and are
externally pulled low, they will source current (IIL) because of the internal pull-ups.

Port 1 also receives code data during Flash programming and verification.

Port 3

Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins with internal pull-ups. P3.6 is
hard-wired as an input to the output of the on-chip comparator and is not accessible as a general-
purpose I/O pin. The Port 3 output buffers can sink 20 mA. When 1s are written to Port 3 pins
they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that

21
are externally being pulled low will source current (IIL) because of the pull-ups.

Port 3 also serves the functions of various special features of the AT89C2051 as listed below:

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

RST

Reset input. All I/O pins are reset to 1s as soon as RST goes high. Holding the RST pin high for

two machine cycles while the oscillator is running resets the device. Each machine cycle takes 12
oscillator or clock cycles.

Port Pin Alternate Functions

P3.0 RXD (serial input port)

P3.1 TXD (serial output port)

P3.2 INT0 (external interrupt 0)

P3.3 INT1 (external interrupt 1)

P3.4 T0 (timer 0 external input)

P3.5 T1 (timer 1 external input)

Heart Beat Meter


16
Oscillator Characteristics

The XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which
can e configured for use as an on-chip oscillator. Either a quartz crystal orceramic resonator may
be used. To drive the device from an external clock source, XTAL2 hould be left unconnected
while XTAL1 is driven. There are no requirements on the duty cycle of the external clock signal,
since the input to the internal clocking ircuitry is through a divide-by-two flip-flop, but minimum
and maximum voltage high and low ime specifications must be observed.

21

Heart Beat Meter


17
BLOCK DIAGRAM OF AT89C2051

21

Heart Beat Meter


18
 LM358 operational amplifier:

The photo-current is converted into voltage and amplified by operational amplifier IC LM358
(IC1). The detected signal is given to the noinverting input (pin 3) and its output is fed to another
non=inverting input (pin 5) for squraing and amplification.

21

Heart Beat Meter


19
LM 358
Description

The LM158 series consists of two independent, high gain, internally frequency compensated
operational amplifiers which were designed specifically to operate from a single power supply
over a wide range of voltages. Operation from split power supplies is also possible and the low
power supply current drain is independent of the magnitude of the power supply voltage.

Application areas include transducer amplifiers, dc gain blocks and all the conventional op amp
circuits which now can be more easily implemented in single power supply systems. For
example, the LM158 series can be directly operated off of the standard +5V power supply
voltage which is used in digital systems and will easily provide the required interface electronics
without requiring the additional ±15V power

21

Pin diagram of LM358

Heart Beat Meter


20
Features


• Available in 8-Bump micro SMD chip sized package, (See AN-1112)


• Internally frequency compensated for unity gain


• Large dc voltage gain: 100 dB


• Wide bandwidth (unity gain): 1 MHz (temperature compensated)


• Wide power supply range:


• Single supply: 3V to 32V

21

• or dual supplies: ±1.5V to ±16V

• • Very low supply current drain (500 µA)-essentially independent of
• supply voltage

• Low input offset voltage: 2 mV


• Input common-mode voltage range includes ground


• Differential input voltage range equal to the power supply voltage


• Large output voltage swing

 ULN2003 current buffer:

It is used to turn the turn the transistors on as the requirement of the microcontroller.

Heart Beat Meter


21
21
ULN2003 current buffer

Description

The ULN2003 is a monolithic high voltage and high current Darlington transistor arrays.
It consists of seven NPN darlingtonpairs that features high-voltage outputs with common-
cathodeclamp diode for switching inductive loads. The collector-current rating of a single
darlington pair is 500mA. The darlington pairsmay be parrlleled for higher current capability.
Applications includerelay drivers,hammer drivers, lampdrivers,display drivers(LED
gasdischarge),line drivers, and logic buffers.The ULN2003 has a 2.7kW series base resistor for
eachdarlington pair for operation directly with TTL or 5V CMOS devices.

Heart Beat Meter


22
21
Logic Diagram of ULN2003

Features

• 500mA rated collector current(Single output)


• High-voltage outputs: 50V
• Inputs compatibale with various types of logic.
• Relay driver application

Software:

Heart Beat Meter


23
The software is written in assembly language and assembled using ASM51 cross-
assembler. The Intel hex code is generated and burnt into the microcontroller chip by using a
suitable programmer. The software is well commented and easy to understand.

Programming Heart Beat Monitor in Assembly Language

$mod51

ORG 0h for

AJMP 30h
ORG 0Bh
AJMP TIM0ISR

21
ORG 30h
MOV sp, #60h
MOV p3, #0FFh
MOV p1, #03h
MOV TMOD, #01100001B
BEG: MOV TH0, #0F0h
MOV TL0 #0
MOV r6, #255
CLR 20h
MOV r2, #0
SETB et0
SETB ea

PULSCHK:
JB p3.6, $
CALL delay2
JBN p3.6, $
SETB tr0

Heart Beat Meter


24
CALL delay2
back1: JB p3.6, $
CALL delay2
JNB p3.6, $
CLR tr0
MOV a, r2
CJNE r2, #0, brady
real_time: MOV a, 6
CPL a
MOV dptr, #table

21
CLR c
SUBB a, #80
JC tachy
lookup: MOV a, r6
CPL a
MOVC A, @a+dptr
MOV r2, A
MOV r1, #0
CALLhex2bcd
CALL disp1
MOV 50h, #100
REFR: CALL refresh1
DJNE 50, REFR
CLRINT: CLR et0
CLR ea
JMP beg
tachy:

Heart Beat Meter


25
CLR p3.4
JMP beg
brady:
CLR p3.3
JMP beg
hex2bcd:
MOV r3, #00d
MOV r4, #00d
MOV r5, #00d
MOV r6, #00d

21
MOV r7, #00d
MOV B, #10d
MOV A, r2
DIV AB
MOV r3, B
MOV B, #10
DIV AB
MOV r4, B
MOV r5, A
CJNE r1, #0h, high_byte
SJMP ENDD
high_byte: MOV a, #6
ADD A, r3
MOV B, #10
DIV AB
MOV r3, B
ADD A, #5

Heart Beat Meter


26
ADD A, r4
MOV B, #10
DIV AB
MOV r4, B
ADD A, #2
ADD A, r5
MOV B, #10
DIV AB
MOV r5, B
CJNE r6, #00d, add _it

21
SJMP continue
add_it: ADD A, r6
continue: MOV r6, A
DJNZ r1, high_byte
MOV B, #10d
MOV A, r6
DIV AB
MOV r6, B
MOV r7, A
ENDD: ret

disp1:

refresh:
MOV 18h, r3
MOV 19h, r4
MOV 1Ah, r5

Heart Beat Meter


27
MOV 1Bh, r6

refresh1: MOV r0, #18h


MOV r4, #4
MOV r7, #2

pq2: CALL segdisp


INC r0
CLR c
MOV a, r4

21
RRC a
MOV r4, a
JNC pq2

pv3:
RET
segdisp:
MOV dptr, #ledcode
MOV A, @r0
ANL A, #0Fh
MOVC A, @A+dptr
segcode:
MOV r5, A
ORLA, #03h
s3: MOV p1, A
s1: ; MOV A, r4
;RRC A

Heart Beat Meter


28
; JC s6
MOV a, r5
RRC a
RRC a
MOV p3.7, c
MOV a, r4
; MOV r4, a
CPL a
RRC a
MOV p3.0, c

21
RRC a
MOV p3.1, c
RRC a
MOV p3.2, c
s5:
s4: ACALL delay1
; MOV A, #07h
; MOV p3, A
SETB p3.0
SETB p3.1
SETB p3.2
s6: RET
ledcode:
DB 7Eh, 0Ch, 0B6h, 9Eh, 0CCh, 0DAh, 0FAh
DB 0Eh, 0FEh, 0CEh, 0EEh, 0F8h, 72h, 0BCh, 0F6h, 0E2h

delay2: MOV 51h, #80

Heart Beat Meter


29
delaywait: CALL till20ms
DJNZ 51h, delaywait
RET
delay1:
till20ms: MOV r1, #0FFh
N: NOP
NOP
NOP
DJNZ r1, N
RET

21
tim0isr: PUSH psw
PUSH acc
MOV TH0, #0F0h
MOV tl0, #0h
DJNZ r6, KIA
MOV r6, #255
MOV A, r2
ADD A, #1
DA A
MOV r2, A
SETB 20h
KIA:
POP acc
POP psw
RET
table:
DB 255,255,255,255,255,255,255,255,255,255,255,255,255;

Heart Beat Meter


30
DB 255,255,255,255,255,255,255,255,255,255,255,255,255;
DB 255,255,255,255,255,255,255,255,255,255,255,255,255;
DB 255,255,255,255,255,255,255,255,255,255,255,255,255;
DB 251,246,242,237,233,229,226,222,218,215,211,208,205,202;
DB 199,196,193,190,188,185,180,178,176,173,171;
DB 169,167,165,163,161,159,157,155,154,152,150,149;
DB 147,145,144,142,141,139,138,136,135,134,132,131;
DB 130,129,127,126,125,124,123,122,121,120,118,117;
DB 116,115,114,113,113,112,111,110,109,108,107,106;
DB 105,105,104,103,102,101,101,100,99,98,98,97;

21
DB 96,96,95,94,94,93,92,92,91,91,90,89;
DB 89,88,88,87,86,86,85,85,84,84,83,83;
DB 82,82,81,81,80,80,79,79,78,78,77,77;
DB 77,76,76,75,75,74,74,74,73,73,72,72;
DB 72,71,41,70,70,70,69,69,69,68,68,68;
DB 67,67,67,66,66,66,65,65,65,64,64,64;
DB 63,63,63,63,62,62,62,61,61,61,61,60;
DB 60,60,60,59,59,59,58,58,58,58,57,57;
DB 57,57,56,56,56,56,56,55,55,55,55,54;
DB 54, 54, 54, 54, 53, 53, 53, 53;
END

The above program is written in assembly language.

Features

Heart Beat Meter


31
1. Pulse Detection: Our device will use a red LED and a photo-sensor paired in a manner that will
be able to measure ones heart rate through blood reflectivity changes in the index finger. Attenuation
will be on average 80% of transmitted light. Voltage created will vary between 0 and 10 mV with
respect to each heart pulse.

2. Signal Extraction: We will use a low pass filter to remove any interference caused by
ambient light and level detection distortions. The filter used will have a cutoff frequency of 4 Hz,
a roll off rate of 20 dB/decade, and pass-band frequencies amplified by a factor of 40dB.

21
3. Pulse Digitization: The conditioned signal will be analyzed by a comparator to provide a
digital pulse of amplitude 1Vpp to be fed into the micro-controller digital input. This stage of the
design will require that the amplified and filtered heart pulse signal have a SNR of 20 Db

4. Accuracy: Our design should give accurate readings with no more than +/- 20% error. The
accuracy of current optical heart monitoring devices is typically 10-15%

5. Power: The device will operate using a 6-volt battery source because of the small packaging
being utilized by our design. The battery should last one year under normal use.

6. Durability: The device will operate in a standard temperature environment of –30 C to 80 C.

7. Display:The heart rate will be displayed on a 3-digit LED display. A micro-controller will be
programmed to operate the LED display. Since improper finger placement could cause problems
with the user, a flashing segment on the LED display will be used to help the user identify when
a heart rate is being measured. A 3 digit LED display will be used because it will allow the full
range pulses detected by the device to be displayed.

8 Accuracy: Our design should give accurate readings with no more than +/- 20% error. This
accuracy is not quite as tight as the tolerance of ECG monitors (+/- 1%) but a significant cost

Heart Beat Meter


32
reduction will be achieved by taking our approach. The accuracy of current optical heart
monitoring devices is typically 10-15%. The accuracy of our device is controlled primarily by
the amount of time used to average the pulse rate from the user. The more time used means more
samples and thus greater accuracy. Our device will use a method that will have a dynamic time
for pulse gathering. The pulse will be averaged after a set number of pulses are obtained by the
micro-controller. This will allow a better distribution of accuracy over the range of pulses that
can be measured by the device.

21

Glance at Some Latest Heart Rate Meters

Heart Beat Meter


33
21

Heart Beat Meter


34
Bibliography

 www.google.com

 www.wikipedia.com

 www.courses.cit.cornell.edu

 www.hackaday.com

21
 R. Bandler, “Cardiac problem at heart of SIDS?”, BBI Newsletter,American Health
Consultant, Inc., USA, April 1998.

 Z. Kmietowicz, “Better coronary care reduces deaths from heart disease,” British Medical
Journal, p600, Tavistock Square, London March 2000.

 J. Hastings, “You Call This Exercise?”, Health, Vol. 14, p106, USA, June 2000.

 M. Bane, “Watch the Monitor,” Men’s Health, Vol. 11, p144, USA, November 1996.

Index
Heart Beat Meter
35
Details page no.

Introduction 2

Components 4

Circuit Description 6

Circuit Diagram 8

Flow chart of Design 9

Construction & Testing 10

21
Different ICs used in the project 13

Software 22

Features 31

Glance at latest heart rate meter 32

Bibliography 33

Heart Beat Meter


36

Вам также может понравиться