Professional Documents
Culture Documents
using Microcontroller
BACHELOR OF ENGINEERING
IN
ELECTRONICS AND INSTRUMENTATION
Submitted by
Mrs.P.Indira,M.E.,
Assistant Professor
Dept. of Electronics and Instrumentation Engineering
This is to certify that Report entitled “Low Cost Electrocardiography Monitoring System Using
Microcontroller” which is submitted by me in partial fulfillment of the requirement for the award
of Bachelors degree in Electronics and Instrumentation Engineering, GITAM Institute of
Technology , GITAM University comprises only my original work and due acknowledgement
has been made in the text to all other material used.
(signature)
APPROVED BY
(signature)
CERTIFICATE
This is to certify that report entitled “Measurment of Temperature using Thermocouple with the
help of Microcontroller” which is submitted by BATCH 6 in partial fulfillment of the
requirement for the award of degree B.Tech in Electronics & Instrumentation Engineering to
Department of Electronics & Instrumentation Engineering, GITAM Institute of
Technology is a record of the candidate own work carried out by him under my supervision. The
matter embodied in this thesis is original and has not been submitted for the award of any other
degree.
(signature)
(signature) (signature)
Project Coordinator
Electrocardiograph ( ECG )
ECG Waveform
Lead Configurations
Limb leads
Leads I, II and III are called limb leads. The electrodes that form these signals are located on the
limbs—one on each arm and one on the left leg. The limb leads form the points of what is known
as Einthoven's triangle.
Lead I is the voltage between the (positive) left arm (LA) electrode and right arm (RA) electrode:
I = LA − RA.
Lead II is the voltage between the (positive) left leg (LL) electrode and the right arm (RA)
electrode:
II = LL − RA.
Lead III is the voltage between the (positive) left leg (LL) electrode and the left arm (LA)
electrode:
III = LL − LA.
Augmented limb leads
Lead augmented vector right (aVR) has the positive electrode (white) on the right arm. The
negative electrode is a combination of the left arm (black) electrode and the left leg (red)
electrode, which "augments" the signal strength of the positive electrode on the right arm:
Lead augmented vector left (aVL) has the positive (black) electrode on the left arm. The
negative electrode is a combination of the right arm (white) electrode and the left leg (red)
electrode, which "augments" the signal strength of the positive electrode on the left arm:
Lead augmented vector foot (aVF) has the positive (red) electrode on the left leg. The negative
electrode is a combination of the right arm (white) electrode and the left arm (black) electrode,
which "augments" the signal of the positive electrode on the left leg:
Surface Electrodes
Amplification Band Pass Filter
to Pick up the ECG Opto Isolator
Instrumentation 0.05 Hz – 120
signal from human
Amplifier Hz
body
Graphical ATMega32
LCD Display Or
For ECG display PIC Microcontroller Notch Filter
For programming 50Hz
Graphical LCD
Adaptive Filtering
(LMS Algorithm)
Disposable Electrodes
INSTRUMENTATION AMPLIFIER
SPECIFICATIONS
Easy to use
Excellent AC specifications
Features
High current transfer ratio : CTR >50%
High I/O isolation voltage :
VISO = 5000 Vrms (min.)
Fast response :
tr = 2 ms, tf = 3 ms(typ.)
Low dark current : ICEO < 100nA
Design Procedure:
High pass filter
Pick C1 = C2: __________
Calculate R1:2 * *C1*Frequency
1
: ___________
: __________
Notch Filter Design
Hardware Implementation
60 Noise Cancellation System (Block Diagram)
This is the overall noise cancellation technique we use. Here we show the entire system in a
reduced "block diagram" format. Input/output pins are shown on the ATmega32.
The RC lowpass to filter the PWM out from the ATmega32 was made of a 20k Ohm resistor and
a 0.04 uF capacitor so that it has a cutoff frequency of about 230 Hz. Because are resistors and
capacitors are only valid to 5% and because the RC doesn't have the steepest cutoff, the cutoff
frequency is appropriate for the function.
#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
#ifdef OUT_FULL_CLK
#ifdef IN_CLK_OVR_64
#define INC_SHIFT 7
#endif
#ifdef IN_CLK_OVR_8
#define INC_SHIFT 4
#endif
#ifdef IN_FULL_CLK
#define INC_SHIFT 1
#endif
#endif
#ifdef OUT_CLK_OVR_8
#ifdef IN_CLK_OVR_64
#define INC_SHIFT 4
#endif
#ifdef IN_CLK_OVR_8
#define INC_SHIFT 2
#endif
#ifdef IN_FULL_CLK
#define INC_SHIFT -2
#endif
#endif
#ifdef OUT_CLK_OVR_64
#ifdef IN_CLK_OVR_64
#define INC_SHIFT 2
#endif
#ifdef IN_CLK_OVR_8
#define INC_SHIFT -2
#endif
#ifdef IN_FULL_CLK
#define INC_SHIFT -5
#endif
#endif
//output
signed long accumulator; /* 16:16 fixed-point...the integer value
is what we send to OCR0 */
signed int increment; /* 0:16 fixed-pi */
signed long prev_out; /* previous output value */
signed long out; /* next output value desired */
//input
unsigned char input[FILTER_LENGTH*STEP_SIZE]; /* reference input
sampled as an 8:0 char. TODO:
10-bit a/d? */
unsigned char* input_next; /* pointer to the next open spot in
the input array */
unsigned char* input_ptr; /* "disposable" pointer for use in
loops */
//filter
signed long w[FILTER_LENGTH]; /* filter weights in 16:16 fixed
point */
char shift;
int error_acc;
void init(void);
void computeOutput(void);
void updateWeightsLMS(void);
void timing_fail(void);
// OUTPUT
ISR (TIMER0_OVF_vect) {
accumulator += increment;
OCR0 = 128 + fix2int(accumulator);
}
// INPUT
ISR (TIMER2_OVF_vect) {
switch(capture_state) {
case REF_CAPT:
if(++input_next == input+INPUT_LENGTH) {
input_next = input; /* reset buffer ptr */
capture_state = ERR_CAPT;
*input_next = ADCH; /* get input sample */
process_state = REF_READY;
break;
case ERR_CAPT:
capture_state = REF_CAPT;
error = ADCH;
error_acc += error;
process_state = ERR_READY;
break;
}
void computeOutput(void) {
prev_out = out;
int main(void) {
init();
while(1) {
switch(process_state) {
case WAITING:
break;
case REF_READY:
computeOutput();
process_state = WAITING;
break;
case ERR_READY:
if(--safe_w_time == 0) { /* backup a hopefully-working set of
weights */
safe_w_time = SAFE_W_RESET;
for(i=0; i<FILTER_LENGTH; i++) {
safe_w[i] = w[i];
}
safety_state = SAFE_READY;
}
updateWeightsLMS();
process_state = WAITING;
break;
}
}
return(0);
}
void init(void) {
//led
DDRD = 0xff; /* drive PORTD to output */
PORTD = 0x00; /* initialize LED on (active low)*/
led_time = LED_TIME_RESET; /* initialize LED reset scalar */
//ain
DDRA = 0x00; /* drive PORTA to input */
//ocr0
DDRB = 0xff; /* drive PORTB to output */
//buffers
input_next = input; /* initialize input_next pointer to
the beginning of the input array */
safe_w_time = SAFE_W_RESET;
process_state = WAITING;
safety_state = NOTHING_IS_SAFE;
/* w[0] = float2fix(-0.3); */
//error
capture_state = REF_CAPT;
error_cutoff = 40; /* divide between positive and negative */
#ifdef OUT_CLK_OVR_8
TCCR0 |= 0<<CS02 | 1<<CS01 | 0<<CS00; /* clk/8 prescaler */
#else
#ifdef OUT_CLK_OVR_64
TCCR0 |= 0<<CS02 | 1<<CS01 | 1<<CS00; /* clk/64 prescaler */
#else
TCCR0 |= 0<<CS02 | 0<<CS01 | 1<<CS00; /* full clock speed*/
#endif
#endif
#ifdef IN_CLK_OVR_64
TCCR2 |= 1<<CS22 | 0<<CS21 | 0<<CS20; /* clk/64 prescaler */
#else
#ifdef IN_CLK_OVR_8
TCCR2 |= 0<<CS22 | 1<<CS21 | 0<<CS20; /* clk/8 prescaler */
#else
TCCR2 |= 0<<CS22 | 0<<CS21 | 1<<CS20; /* full speed ahead */
#endif
#endif
void timing_fail(void) {
//disable interrupts
TIMSK = 0<<TOIE0 | 0<<TOIE2;
//die badly
while(1) {
if(led_time != 0) {
led_time--;
}
else {
led_time = reset;
}
Graphic LCD - 128x64 G B/L