0115 966 7955 Today's Opening Times 10:30 - 17:00 (BST)

Biomedical instrumentation and measurement


Disclaimer: This essay has been submitted by a student. This is not an example of the work written by our professional essay writers. You can view samples of our professional work here.

Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of UK Essays.


SA node controls the rate of heart's muscular contractions which enables the heart to circulate the blood throughout the body according to the need. Small variations in the heart beat are not harmful but in some cases due to malfunctioning of the heart's electrical system, the heart rate varies drastically resulting in different types of arrhythmias. These cardiac arrhythmias are serious disorders which should be treated immediately. Arrhythmias like bradycardia (low heart rate) can be treated using Pacemakers.

Pacemakers can be implanted in the patient's heart for permanently stimulating the heart. It is used for patients for whom the SA node is no longer functioning properly. External Pacemakers are also available which is used to treat temporary heart rate variations. It is used for a short period of time before the implanting the Internal Pacemakers in the heart. In order to understand the requirement of pacemakers, it is necessary to understand the functioning of the heart and its electrical system.


Heart is a pumping device which is used to circulate the blood throughout the body. It has four chambers namely Right Atrium, Left Atrium, Right Ventricle and Left Ventricle. The right atrium receives the deoxygenated blood from the entire body through the superior vena cava and inferior vena cava. The left atrium receives oxygenated blood from the lungs through the pulmonary veins. When the atrium contracts the blood flows to the corresponding ventricle. This is due to atrial depolarization. When the left ventricle contracts, the oxygenated blood is supplied to all tissues in the body through the aorta. This is due to ventricular depolarization. Similarly, the deoxygenated blood is pumped to the lungs for oxygenation through the pulmonary artery during the contraction of right ventricle. This is due to ventricular repolarization.

The Electrical conduction system of the heart consists of SA node, AV node, Bundle of His, Purkinje Fibers. The chambers of the heart should be stimulated electrically for contraction. The stimulations are provided by the SA node (Natural Pacemaker of the heart) which is located in the right atrium of the heart near the entrance of the superior vena cava. Although all the heart cells have the ability to produce electrical pulses which can stimulate the heart, SA node triggers the heart. The fact that SA node produces pulses at a higher rate when compared to other potential cells which can stimulate contraction, contributes to this phenomena. The contraction of various chambers of the heart is characterized in a very specific manner. As the electric pulses pass through each chamber of the heart, they are stimulated to contract. The SA node first triggers the right and left atrium to contract. Then the impulses travel to the AV node which is located between the atria and the ventricles. From AV node ,the pulses travel to the bundle of his. The pulses travel to the individual ventricles through the right and left bundle branch and reach the Purkinje fibers. If the SA node fails, then the AV node acts as the primary pacemaker. If the AV node fails, then the Purkinje fibers takes the responsibility. The SA node receives blood supply from right and left coronary arteries. Under ischaemic conditions, the death of the affected cells will stop the SA node from triggering the heart beat.

There is a period of time following the stimulation of heart muscle during which no other action potential can trigger the heart muscles. This period is known as Absolute or Effective Refractory Period (ERP) of heart. It is normally around 0.4 sec. ERP is maintained as high as possible in order to maintain tachycardia and to coordinate the muscle contraction. The anti-arrhythmic drugs taken by the patients usually prolongs the ERP.



The electrical activity of the heart muscles is recorded as Electrocardiogram (ECG). It can be acquired non-invasively from the surface of the body by following specific lead configurations. The electrical current generated in the heart due to depolarization and repolarization is spread not only within the heart but also throughout the body. So, ECG can be easily acquired from the surface of the body through electrodes. ECG has four basic components namely, P wave, QRS complex, T wave and U wave. P wave occurs during atrial contraction due to atrial depolarization. The duration of the P wave ranges from 0.08- 0.1 sec. During the atrial depolarization, the impulse from the SA node spreads throughout the atrium. The time period between the onset of the P wave and the beginning of the QRS complex is about 0.12- 0.2 sec. During the zero potential period between the P wave and QRS complex, the impulse travels within the AV node and the Bundle of His.QRS complex occurs during ventricular contraction due to ventricular depolarization. The duration of the QRS complex ranges from 0.06-0.1 sec. T wave occurs during ventricular relaxation due to ventricular repolarization. Sometimes, a small positive U wave occurs following the T wave due to the last remnants of the ventricular repolarization.



Normal ECG:


Heart rateis nothing but the number ofheartbeatsper unit oftimewhich is expressed as beats per minute (bpm) - which can vary as the body's need for oxygen changes, such as duringexercise or sleep. The measurement of heart rate is used bymedical professionalsto assist in thediagnosisand tracking of medical conditions. It is also used by individuals, such asathletes, who are interested in monitoring their heart rate to gain maximum efficiency from their training.

TheR waveto R wave interval(RR interval) is the inverse of the heart rate ,that is one divided by RR interval gives the heart rate. Typical healthy resting heart rate in adults is 60-80 bpm which is referred to be normal heart rate,with rates below 60 bpm referred to asbradycardia and rates above 100 bpm referred to astachycardia.

Missed ECG:


This can be detected when the R-R interval is twice the actual R-R interval (for normal subjects).Heart pulses misses at some intervals and does not follow the premature heart beat.



This is a critical reduction of heart rate and characterized by normally directed abnormally wide P waves and normal PR interval. Whenever the R-R interval exceeds 1 sec the heart rate goes below 60 and the condition is referred to as Bradychardia. There are three types of Bradychardia conditions based on the characteristics of the ECG wave, they are Sinus bradychardia, Atrio-ventricular nodal bradychardia and ventricular bradychardia respectively. They are discussed below.

Sinus bradycardia:


Sinus bradycardias are also called as Atrial bradychardias. This bradychardia condition is usually found in young and healthy adults. The symptoms represent with the individual'srespirations. Theabnormalpattern of eachinhalationcorresponds with the heart rate decreasing.Expirationcauses an increase in the heart's rate of contraction. This is thought to be caused by changes in the vagal tone duringrespiration.

Sinus bradycardia is a sinus rhythm of less than 60 bpm. It is a common condition found in both healthy individuals and those who are considered wellconditioned athletes. The reason for this is that their heart muscle has become conditioned to have a higher stroke volume and therefore requires fewer contractions to circulate the same volume of blood.

Sick sinus syndromecovers conditions that include severe sinus bradycardia, sinoatrial block, sinus arrest, and bradycardi-tachycardia syndrome (atrial fibrillation, flutter, and paroxysmal supraventricular tachycardia).

Atrio ventricular nodal bradycardia:


An atrio ventricular nodal bradycardia or AV junction rhythm is usually caused by the absence of the electrical impulse from thesinus node. This usually appear on anEKGwith a normal QRS complexaccompanied with an inverted P wave either before, during, or after the QRS complex.

An AV junctional escape is a delayed heartbeat originating from anectopicfocus somewhere in theAV junction. It occurs when the rate ofdepolarizationof the SA node falls below the rate of the AV node.This dysrhythmia also may occur when the electrical impulses from the SA node fail to reach the AV node because of SA or AV block.This is a protective mechanism for the heart, to compensate for a SA node that is no longer handling the pace making activity, and is one of a series of backup sites that can take over pacemaker function when the SA node fails to do so. This would present with a longerPR interval. A junctional escape complex is a normal response that may result from excessive vagal tone on the SA node. Pathological causes include sinus bradycardia, sinus arrest, sinus exit block, or AV block.

Ventricular bradycardia:


This picture shows an ECG of a person with an abnormal rhythm (arrhythmia) called an atrioventricular (AV) block. P waves show that the top of the heart received electrical activity. Each P wave is usually followed by the tall (QRS) waves. QRS waves reflect the electrical activity that causes the heart to contract. When a P wave is present and not followed by a QRS wave (and heart contraction), there is an atrioventricular block, and a very slow pulse (bradycardia).


More than 60% people fall victim to heart attacks in most of the countries around the globe every year and thousands more are critically injured in accidents. Taking care of these patients in special care units involves the usage of specialized equipments like pacemakers along the other important ones.

In the past few years electronic pacemaker systems have become the important one in saving lives of cardiac patients whose normal pacing functions have been impaired. Depending on the exact nature of a cardiac dysfunction, a patient may require temporary artificial pacing during the course of treatment or permanent pacing in order to lead an active, productive life after treatment.

A device capable of generating artificial pacing impulses and delivering them to the heart is known as a pacemaker system (commonly called a pacemaker) and consists of a pulse generator and appropriate electrodes. Pacemakers are available in a variety of forms. They are mainly divided into two types External pacemakers and Internal pacemakers respectively.


External pacemakers are used on the patients with temporary heart irregularities, such as those encountered in the coronary patient, including heart blocks. They are also used for temporary management of certain arrhythmias that occur in the patients during critical postoperative periods and in the patients during cardiac surgery, especially if the surgery involves the values or septum. An external pacemaker usually consists of an externally worn pulse generator connected to electrodes located on or within the myocardium. External pacemakers, which include all types of pulse generators located outside the body, are normally connected through wires introduced into the right ventricle via a catheter catheter. The pulse generator may be strapped to the lower arm of a patient who is confined to bed, or worn at the midsection of an ambulatory patient.

We have made the pacemaker which can be divided into two general categories namely

  1. Asynchronous pacemaker &
  2. Synchronous pacemaker


This type of pacemaker is intended for patients having permanent heart blocks. The rate is preset. It can be varied externally within the range of 60 PPM to 180 PPM. Since this pacemaker functions regardless of the patient's natural heart rhythm it poses a potential danger because of competition between the patient's rhythm and that of the pacemaker.



In patients who have normal heart function most of the time, asynchronous pacing can be extremely dangerous, working against their own physiological pacemaker with the danger of stimulating in the vulnerable period of the T wave, a condition that can result in fibrillation. The demand pacemaker consists of an ECG amplifier and a conventional pacemaker output pulse circuit that has been modified to allow output from the ECG amplifier to inhibit the pulse generator. This pacemaker senses R-waves and its timing and logic circuits count out an elapsed time interval following an R-wave or previously induced pulse. If the intrinsic R-wave does not appear before the elapsed time interval, the ventricle is stimulated. If an R-wave is received, the counter is reset again. This type of pacemaker is used for patients with bradycardia, and it ensures a heartbeat no slower than its set rate.



Internal pacemaker are implanted within the pulse generator placed in a surgically formed pocket below the right or left clavicle, in the left subcostal area, or in women, beneath the left or right major pectoralis muscle. Internal leads connect to electrodes that directly contact the inside of the right ventricle or the surface of the myocardium. The exact location of the pulse generator depends primarily on the type of the electrode used, he nature of the cardiac dysfunction, and the method (mode) of pacing that may be prescribed .Since there are no external connections for applying power, the pulse generator must be completely self contained, with a power source capable of continuously operating the unit for a period of years.


A wide variety of electrodes can be used to measure bio electric events but nearly all can be classified as belonging to one of three basic types;

  1. Micro electrodes
  2. Skin surface electrodes
  3. Needle electrodes

All three types of bio potential electrodes have the metal-electrolyte interface. In each case, an electrode potential is developed across the interface, proportional to the exchange of ions to the metal and the electrolytes of the body.


They are used to measure bio electric potentials near or within a single cell.Microelectrodes are electrodes with tips sufficiently small to penetrate a single cell in order to obtain readings from within the cell. The tip must be small enough to permit penetration without damaging the cell. This action is usually complicated by the difficulty of accurately positioning an electrode with respect to a cell. Because of their small surface area, they have impedances well up into the megohms. For this reason, amplifiers with extremely high impedances are required to avoid loading the circuit and to minimize the effects of small changes in interface impedance.


Skin surface electrodes are used to obtain bio electric potentials from the surface of the body. They are available in various size. Although any type of surface electrode can be used to sense ECG, EMG, EEG potentials, the larger electrodes are usually associated with ECG, since localization of the measurement is not important. Smaller electrodes are used in EEG and EMG measurements. Various types of disposable electrodes have been introduced in recent years to eliminate the requirement for cleaning and care after each use. In general, disposable electrodes are of the floating type with simple snap connectors by which the leads, which are reusable, are attached. Although, some disposable electrodes can be reused several times, their cost is usually low enough that cleaning for reuse is not warranted. They come pre gelled, ready for immediate use.


To reduce interface impedance and, consequently, movement artifacts, some electroencephalographers use small subdermal needles to penetrate the scalp for EEG measurements. They are also used to measure EMG potentials from a specific group of muscles. They are less susceptible to movement artifacts when compared with surface electrodes as they create an interface beneath the surface of the skin. By making direct contact with the subdermal tissue or the intercellular fluids, these electrodes also seem to have lower impedances than surface electrodes of comparable interface area. Even though needle electrodes have less motion artifacts ,surface electrodes are used to acquire ECG because surface electrodes are more convenient for the patient .Most of the surface electrodes are cheap and reusable.


ECG sensors measure the time-varying magnitude of electric fields emanating from the heart. ECG values are measured by placing non-invasive electrodes at the surface of the patient's skin. For a 3-lead ECG sensor, the electrodes need to be placed in a triangle (Einthoven Triangle) on the patient's chest as shown in the figure 11. Each corner of the triangle corresponds to one of the limbs: right hand, left hand, left foot. With the bipolar system, one limb is connected to the positive terminal of the amplifier and another limb to its negative terminal. Three limbs (right arm-RA, left arm-LA and left leg/foot-LL) are used. The right leg was used as "earth", to minimize interference.


Bioelectric signals have very high input impedance. To stop the signal attenuation, we use Instrumentation Amplifier (AD 624) which also has high input impedance. It should have high gain and low output impedance .In order to remove the common mode signals ,it should have a high Common Mode Rejection Ratio (CMRR of about 90 dB).The potential at the surface of the body ranges from 0 - 10 mV so the amplifier should have high gain (1000). We use a differential amplifier to amplify the bioelectric signals that occur as a potential difference between two electrodes, the bioelectric signals are applied between the inverting and non-inverting inputs of the amplifier. The signal is therefore amplified by the differential gain of the amplifier. For the interference signal, however, both inputs appear as though they were connected together to a common input source. Thus, the common mode interference signal is amplified only by the much smaller common mode gain. The electrode impedances form a voltage divider with the input impedance of the differential amplifier. If the electrode impedances are not identical, the interference signals at the inverting and non-inverting inputs of the differential amplifier may be different, and the desired degree of cancellation does not take place. Because, the electrode impedances can never be made exactly equal, the high common mode rejection ratio of a differential amplifier can only be realized if the amplifier has an input impedance much higher than the impedance of the electrodes to which it is connected. There are different lead configurations such as 3-Lead, 5-Lead, 12-Lead for acquiring ECG Signal. We have used 3-Lead system Lead - I Configuration.




LabVIEW (short for Laboratory Virtual Instrumentation Engineering Workbench) is a platform and development environment for Visual Programming Language from National Instruments. LabVIEW is a graphical programming environment used by millions of engineers and scientists to develop sophisticated measurement, test, and control systems using intuitive graphical icons and wires that resemble a flowchart.

LabVIEW offers unrivaled integration with thousands of hardware devices and provides hundreds of built-in libraries for advanced analysis and data visualization. The LabVIEW platform is scalable across multiple targets and operating systems. LABVIEW is a GUI (Graphical User Interface) which can be used for processing of signals, images and other forms of data. One of the most powerful features LabVIEW offers engineers and scientists is its graphical programming environment.

With LabVIEW, one can design custom virtual instruments by creating a graphical user interface on the computer screen through which one can:

  • Operate the instrumentation program
  • Control selected hardware
  • Analyze acquired data
  • Display results

One can customize front panels with knobs, buttons, dials, and graphs to emulate control panels of traditional instruments, create custom test panels, or visually represent the control and operation of processes. The similarity between standard flow charts and graphical programs shortens the learning curve associated with traditional, text-based languages.

The behavior of the virtual instruments can be determined by connecting icons together to create block diagrams, which are natural design notations for scientists and engineers. With graphical programming, one can develop systems more rapidly than with conventional programming languages, while retaining the power and flexibility needed to create a variety of applications.

We have used Lab view to acquire the signal, filtering and do other processing of the ECG signal. The real time signal is given into as input to ELVIS I which acts as the DAQ (data acquisition system).The block diagram of the Lab view implementation is as shown in figure 14.


  • The ECG signal from the amplifier (using AD 624) is given as input to DAQ for acquiring the signal in Lab view software.
  • FFT of the ECG signal is obtained and viewed. We can see the frequency content of the ECG signal from the FFT obtained. WE can also see the presence of 50 Hz power line interference in the FFT of raw ECG.
  • A Smoothing filter with following specifications - Moving average, Rectangular filter with a half width of 20 is constructed. The Smoothened ECG is viewed. Smoothing Filter is used to remove noise and 50 Hz power line interference.
  • The Smoothened signal is given as input to the Butterworth Band Pass Filter of order 2 and a low cutoff frequency of 5Hz and high cut off frequency of 15Hz.Band Pass Filter is used to separate the QRS complex from the ECG Signal.
  • The output of the Band Pass Filter is differentiated and squared inorder to enhance the QRS complex from the remaining portion of the waveform.
  • The heart rate is calculated using timing and tone measurement block. The block gives the frequency of repetition of the QRS complex. The frequency value is converted into time value by taking inverse of it. Heart rate is calculated as follows.
  • Heart Rate = 60/R-R Interval


    R-R Interval = 760ms

    Heart Rate = 60/760ms

    = 78.94 Beats /Minute

  • If the calculated heart rate is below the normal value, then pacing pulses are produced .This is done by using a case structure.
  • The case structure turns on only when the case is true (Heart Rate is below normal value).Inside the case structure we have a square wave generator. The output of the square wave generator is differentiated and squared. We get a pulse as a result of these operations.
  • The rate and amplitude at which the pulses are produced can be modified easily at run time using controls.
  • Whenever the heart rate is normal, False condition is selected .
  • For false condition, we set the amplitude and frequency of the square wave as zero so that the pacemaker is switched off.
  • The Pacing Pulses generated can also be taken out as an analog voltage from the ELVIS and can be viewed in a DSO. Only voltages in the range +10 volts to -10 volts can be taken out from LABVIEW through ELVIS.




We have implemented the case structure and other blocks by studying the general tutorials given in LV BASICS 1 MANUAL and LABVIEWBASICSII_85_ENG CLAD.




The amplifier which is used in software implementation (AD 624) is also used here. It is followed by a filter. The amplifier output is around 550 mV. A Filter is a circuit that is defined to pass a specified band of frequencies while attenuating all signals outside this band. Filter networks may be either active or passive. Passive filter networks contain only resistors, inductors and capacitors. Active filters employ transistors or op amps plus resistors, inductors and capacitors. Inductors are often used in active filters, because they are bulky and costly and may have large internal resistive components. Band Pass Filters pass only a band of frequencies while attenuating all frequencies outside the band. A simple high pass filter followed by a low pass filter will form a band pass filter. We have used a band pass filter (0.5Hz - 40 Hz) to remove high frequency signals like EMG and low frequency components like Base Line Wandering and motion artifacts. We have used a second order Butterworth Filter with -40 db/decade roll-off.

For Low Pass Filter, we used 0.5 Hz as the cut off frequency.C1 is chosen as a convenient value between 100 pF and 0.1µF.For High Pass Filter, we used 40 Hz as the cut off frequency. We have implemented a Band Pass Filter according to the design given in OPERATIONAL AMPLIFIERS AND LINEAR INTEGRATIONAL CIRCUITS.



A Notch Filter transmits frequencies in the pass band and rejects undesired frequencies in the stop band. In applications where low level signals must be amplified, there may be present one or more of an assortment of unwanted noise signals. Examples are 50, 60 0r 400 Hz frequencies from power lines, 120 Hz ripple from full - wave rectifiers, or even higher frequencies from regulated switching - type power supplies or clock oscillators. If both signals and signal frequency noise component are passed through a notch filter, only the desired signals will exit from the filter. The noise frequency is "notched out". We have designed a active notch filter (using LM 324) to remove 50 Hz Power Line Interference. The amplitude of the acquired ECG signal is around 1 - 2 V. We got noise - free ECG for real time signal acquisition as shown below.




In order to extract the QRS Complex from the ECG signal obtained, we use a band pass filter with center frequency of 17 Hz and band width of 6 Hz. The QRS signal obtained from the band pass filter is rectified for comparing with the threshold voltage generated by the detection circuit. The filtered and rectified ECG is stored on a capacitor. This filtered and rectified ECG is compared with the fraction of this voltage. Whenever a threshold voltage is exceeded, the QRS pulse is detected. After the detection of every QRS pulse, the capacitor recharges to a new threshold value after every pulse.



Monostable Multivibrator generates a single output pulse in response to an input signal. It is also known as One Shot Multivibrator. The time period of the output pulse depends only on the external components (resistors and capacitors) connected to the op-amp. The duration of the input triggering pulse can be longer or shorter than the expected pulse. The duration of the output pulse is represented by the T. Since T can be changed only by changing the resistors and capacitors ,the one shot multivibrators can be considered as a pulse stretcher. This is because the width of the pulse can be longer than the input pulse. In a stable or standby state, the output of the multivibrator is zero or low-level logic. The output of the multivibrator is forced to go high (˜Vcc) when an external trigger is given. The output stays zero until the next triggering pulse is given. Then the cycle repeats. The monostable multivibrator has only one stable state. Hence, the name monostable.

The QRS detector gives a pulse for QRS detected which is given as an input trigger for a monostable multivibrator. This monostable multivibrator is used to produce a positive pulse (amplitude - 5V) of desired pulse width for every input triggering (negative edge triggering) from the QRS detector. We had used 555 Timer as a monostable multivibrator.


Thus, the analog section of the project gets over with multivibrator. The output of the multivibrator is processed using PIC18F 4550 Microcontroller. It marks the beginning of the controller section.


PIC is a family of Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1640 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Programmable Interface Controller", but shortly thereafter was renamed "Programmable Intelligent Computer".

PICs are popular with developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability.

Like all Microchip PIC18 devices, PIC18F4550 family are available as both standard and low-voltage devices. Standard devices with Enhanced Flash memory, designated with an "F" in the part number (such as PIC18F4550),accommodate an operating VDD range of 4.2V to 5.5V.Low-voltage parts, designated by "LF" (such as PIC18LF4550), function over an extended VDD range of 2.0V to 5.5V.

Our project uses a standard PIC 18F4550.Hence this microcontroller uses a flash program memory of 24K bytes .It is a 8-bit microcontroller and so they handle data as 8-bit chunks. PICs have a set of registers that function as general purpose ram. Special purpose control registers for on-chip hardware resources are also mapped into the data space. The addressability of memory varies depending on device series and in PIC 18F4550 external code memory is directly addressable which is an exceptional feature compared to baseline and mid line core devices.

PICs have a hardware call stack, which is used to save return addresses. The hardware stack is not software accessible on earlier devices, but this changed with the 18F4550 device. Hardware support for a general purpose parameter stack was lacking in early series, but this greatly improved in the 18F4550, making the this device architecture more friendly to high level language compilers.

Core features

All of the devices in thePIC18F 455 series family incorporate a range of features that can significantly reduce power consumption during operation. Key items include:

  • Alternate Run Modes: By clocking the controller from the Timer1 source or the internal oscillator block, power consumption during code execution can be reduced by as much as 90%.
  • Multiple Idle Modes: The controller can also run with its CPU core disabled but the peripherals still active. In these states, power consumption can be reduced even further, to as little as 4% of normal operation requirements.
  • On-the-Fly Mode Switching: The power managed modes are invoked by user code during operation, allowing the user to incorporate power-saving ideas into their application's software design.
  • Low Consumption in Key Modules: The power requirements for both Timer1 and the Watchdog Timer are minimized.

PIC18F 4550 has enhanced flash program memory, high computational performance at an economical price. These features make these microcontrollers a logical choice for many high - performance, power sensitive applications. It has an in built analog to digital converter. We have used MP LAB IDE, which is very efficient windows compatible software to program for PIC microcontrollers. It provides high level flexibility for programming. It contains everything a programmer needs to write, edit, compile, link and debug the microcontroller.



Each code developed is tested using PIC 18 Simulator IDE. The Simulator gives an excellent environment for the PIC microcontroller family. It gives all the required facilities to enable the system designers to start projects right from the scratch and finish them with ease and confidence.

Many external embedded buildind blocks can be simulated.Some of it's features are:

  1. 8 x LED Board.
  2. Keyboard Matrix
  3. LCD Module
  4. Oscilloscope
  5. Signal Generator

Segment LED Display Panel


The Code is encrypted in the controller using PIC KIT 2. The coding for PIC microcontroller is similar to C programming.

The microcontroller is the actual pacemaker of the project. We have used the microcontroller for generating pacing pulses in both synchronous and asynchronous mode.


In asynchronous pacemaker the pacing pulses are produced at a predetermined rate, irrespective of the current heart rate. We have produced pacing pulses at three different rates (60, 70, 80) .The amplitude of the pacing pulse can be adjusted from 0-5V using a suitable potentiometer.



In Synchronous mode operation, the Pacemaker produces the pacing pulses only when the SA node fails to stimulate the heart for a given period of time. Once the SA node starts to stimulate the heart normally, the functioning of the synchronous pacemaker stops. The output of the monostable multivibrator is given to the microcontroller. The monostable multivibrator produces positive pulse for each ECG wave.

The microcontroller is used to measure the time interval between these pulses. Once the time interval between any two pulses exceeds 1000 ms, the controller is programmed to generate a stimulating pulse. The Refractory period of the heart muscles play a vital role here. If S A node produces a pulse immediately after 1000msec,it will not be considered by the heart as a stimulation because it falls within the Effective Refractive Period of the Heart. The Heart muscles respond to the stimulations only if appears after the Effective Refractive Period say 400msec.The time interval between two square pulse is measured and is used for heart rate calculation.


The heart rate is displayed using a Seven Segment Display. The heart rate value obtained is converted to a BCD value. This BCD value is tapped from a 8-bit port of the microcontroller. The seven segment display is controlled by IC 4511.The BCD value obtained from the microcontroller is given as input to the IC 4511.We have used common cathode seven segment displays. The output of IC4511 to the corresponding BCD inputs is as shown in the table below.


Thus, we have successfully completed the software implementation of the project in LABVIEW. We have designed an asynchronous pacemaker. We have designed an ECG amplifier and the ECG signal is converted into a square pulse for processing in the microcontroller. We still have to work on the design of synchronous pacemaker.


This pin is used to erase the memory locations inside the PIC (i.e. when we want to re-program it). In normal use it is connected to the positive supply rail.


These are the supply pins VDD is the positive supply and VSS is negative supply, or 0v.The maximum supply voltage is 6V and minimum voltage is 2V.

These pins are where we connect an external clock, which is crystal oscillator so that the microcontroller has some kind of timing.

Depending on the device selected and features enabled, there are up to five ports available. Some pins of the I/O ports are multiplexed with an alternate function from the peripheral features on the device. In general, when a peripheral is enabled, that pin may not be used as a general purpose I/O pin. Each port has three registers for its operation. These registers are:

  • TRIS register (data direction register)
  • PORT register (reads the levels on the pins of the device)
  • LAT register (output latch)

The Data Latch register (LATA) is useful for readmodify- write operations on the value driven by the I/O pins.


PORTA is an 8-bit wide, bi directional port. The corresponding data direction register is TRISA. Setting a TRISA bit (= 1) will make the corresponding PORTA pin an input (i.e., put the corresponding output driver in a high-impedance mode). Clearing a TRISA bit (= 0) will make the corresponding PORTA pin an output (i.e., put the contents of the output latch on the selected pin). Reading the PORTA register reads the status of the pins; writing to it will write to the port latch.

The RA4 pin is multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin. The RA6 pin is multiplexed with the main oscillator pin; it is enabled as an oscillator or I/O pin by the selection of the main oscillator in Configuration Register 1H. When not used as a port pin, RA6 and its associated TRIS and LAT bits are read as '0'. RA4 is also multiplexed with the USB module; it serves as a receiver input from an external USB transceiver.

Several PORTA pins are multiplexed with analog inputs, the analog VREF+ and VREF- inputs and the comparator voltage reference output. The operation of pins RA5 and RA3:RA0 as A/D converter inputs is selected by clearing/setting the control bits in the ADCON1 register On a Power-on Reset, RA5 and RA3:RA0 are configured as analog inputs and read as '0'. RA4 is configured as a digital input.


PORTB is an 8-bit wide, bidirectional port. The corresponding data direction register is TRISB. Setting a TRISB bit (= 1) will make the corresponding PORTB pin an input (i.e., put the corresponding output driver in a high-impedance mode). Clearing a TRISB bit (= 0) will make the corresponding PORTB pin an output (i.e., put the contents of the output latch on the selected pin).

Each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all the pull-ups. This is performed by clearing bit, RBPU.

On a Power-on Reset, RB4:RB0 are configured as analog inputs by default and read as '0'; RB7:RB5 are configured as digital inputs. Four of the PORTB pins (RB7:RB4) have an interruption- change feature. Only pins configured as inputs can cause this interrupt to occur. Any RB7:RB4 pin configured as an output is excluded from the interruption- change comparison. Pins, RB2 and RB3, are multiplexed with the USB peripheral and serve as the differential signal outputs for an external USB transceiver RB4 is multiplexed with CSSPP, the chip select function for the Streaming Parallel Port


PORTC is a 7-bit wide, bidirectional port. The corresponding data direction register is TRISC. Setting a TRISC bit (= 1) will make the corresponding PORTC pin an input (i.e., put the corresponding output driver in a high-impedance mode). Clearing a TRISC bit (= 0) will make the corresponding PORTC pin an output (i.e., put the contents of the output latch on the selected pin). In PIC18F4550 device, the RC3 pin is not implemented.

PORTC is primarily multiplexed with serial communication modules, including the EUSART, MSSP module and the USB module Pins RC4 and RC5 are multiplexed with the USB module.

Unlike other PORTC pins, RC4 and RC5 do not have TRISC bits associated with them. As digital ports, they can only function as digital inputs. When configured for USB operation, the data direction is determined by the configuration and status of the USB module at a given time.

On a Power-on Reset, these pins, except RC4 and RC5, are configured as digital inputs. To use pins RC4 and RC5 as digital inputs, the USB module must be disabled.


PORTD is an 8-bit wide, bidirectional port. The corresponding data direction register is TRISD. Setting a TRISD bit (= 1) will make the corresponding PORTD pin an input (i.e., put the corresponding output driver in a high-impedance mode). Clearing a TRISD bit (= 0) will make the corresponding PORTD pin an output (i.e., Put the contents of the output latch on the selected pin).

Each of the PORTD pins has a weak internal pull-up. A single control bit, RDPU (PORTE<7>), can turn on all the pull-ups. PORTD can also be configured as an 8-bit wide Streaming Parallel Port (SPP)


Code for Asynchronous Pacemaker:

Explanation of Functions used:

Delay 10KTCYx ( unsigned char int );

The letter x in the function name above stands for 'times' or 'multiplication'. It is not to be replaced by a number as done in other function names.

Unit is a 8 bit value in the range (0,255).Unit=0is equivalent to Unit =256.

TCY stands for 'instruction cycle'. The internal frequency of PIC 18 F4550 is 8 MHz.

  1. Leslie Cromwell, "Biomedical Instrumentation and measurement", Prentice hall of India, New Delhi, 2007.
  2. Joseph J. Carr and John M. Brown, "Introduction to Biomedical Equipment Technology", Pearson Education, 2004.
  3. John G. Webster, "Medical Instrumentation Application and Design", John Wiley and sons, New York, 2004
  4. Principles of Biomedical Instrumentation and Measurement By Richard Aston
  5. Biomedical signal Analysis ( A Case Study Approach)- Rangaraj.M.Rangayyan
  6. Digital Signal System-Level Design Using Lab VIEW BY Nasser kehtarnavaz and Namjin Kim
  7. LV Basics 1 Manual
  8. LabVIEWBasicsII_85_eng CLAD
  9. External Pacemaker- Jigar O Patel.
  10. Biomedical signal Analysis (A Case Study Approach)- Rangaraj. M. Rangayyan.
  11. Operational Amplifiers and Linear Integrational Circuits - Robert F. Coughlin & Frederick F .Driscoll.
  12. Integrated Circuits - Roy Chowdry.
  13. PIC Microcontrollers -Know it all Di Jasio, Wilmshrust, Ibrahim,Morton,Bates,J.Smith,D.W.Smith,Hellebeyck.
  14. http://www.umm.edu/imagepages/1429.htm
  15. http://zone.ni.com/cms/images/devzone/tut/2007-07-09_141618.jpg
  16. http://ecee.colorado.edu/~ecen4618/lm324b.gif
  17. http://pfnicholls.com/electronics/555_pinout.png

To export a reference to this article please select a referencing stye below:

Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.

Request Removal

If you are the original writer of this essay and no longer wish to have the essay published on the UK Essays website then please click on the link below to request removal:

More from UK Essays

We can help with your essay
Find out more
Build Time: 0.0046 Seconds