Vous êtes sur la page 1sur 4

XXXII NATIONAL SYSTEMS CONFERENCE, NSC 2008, December 17-19, 2008

FABRICATION OF USB BASED ELECTROCARDIOGRAM MACHINE


Gurdhyan Singh, Harish Chandra, Soami P. Satsangee 1
Abstract: Virtual Instrumentation is being widely explored and is now accepted as a viable alternative to real instrumentation in view of its low cost, remote accessibility and customized design. An electrocardiogram (ECG) machine is an indispensable medical instrument in prevailing health scenario. The present paper discusses fabrication of a low cost USB based electrocardiogram machine. This PC based electrocardiogram incorporates state-of-the art technology as its operation is under the control of an inbuilt PIC microcontroller (PIC16F84A). It is also compatible with modern PCs because it is linked to a PC via a standard USB cable (using an Elexol USBMOD3 interface module). The circuit uses an AD620AN device, a specialized instrumentation amplifier offering precision balanced differential and hence a high common mode signal rejection at input stage to reduce 50 Hz noise. The ECG waveform is made available on a computer screen. All the functions of the instrument are Windows based GUI program written in Visual C++ or in LabVIEW 7.1. Though the instrument developed under this project is not presented as a finished marketable diagnostic device it can be developed into one with further refinement. However, the USB-ECG presented here can serve as a useful instructive and educational device for students of biomedical, instrumentation, electronics etc. Work on further refinement of measurement and analysis is in progress using LabVIEW Software (National Instruments). Index Terms: ECG machine, LabVIEW, USBMOD3, PICmicrocontroller.

it. The ECG was first put to clinical use in 1913 with Einthovens discovery of the string galvanometer. Einthovens recording is known as three lead ECG, with measurements taken from three points on the body (the Einthovens triangle is an equilateral triangle with the heart at the centre). The difference in potential between L1 (connected to left arm) and L2 (connected to right arm) is used to produce a wave of an ECG trace. The L3 connected to the left leg of body and the recording device (CRO) is common ground [4]. In this work Lead II limb configuration is as shown in Figure 1 is used. A GUI based program running on the personal computer displays & processes this raw data and stores the result in a file.

I. INTRODUCTION
An electrocardiogram or ECG (also known as EKG specially in USA abbreviated from the German word Electrocardiography) is a representation of the electrical events of a cardiac cycle and is used in investigation of heart disease. The electrical potential generated by electrical activity of cardiac tissue is measured on the skin surface by the electrodes and hence an ECG machine actually records electrical activity of the heart [1,2]. Incidentally, it also picks up other electrical activities which the machine is designed to filter out as best as possible. Each wave of an electrocardiogram represents recharge & discharge of a certain region of the heart [3]. This helps in indicating which area of the heart is affected. Also, the size of each wave corresponds to amount of voltage generated by that region or event creating
/1 Gurdhyan Singh, Harish Chandra & Dr. Soami P. Satsangee are with University Science Instrumentation Centre, Dayalbagh Educational Institute, Dayalbagh, Agra-282005. E-mail: deiusic@gmail.com

Figure 1: Standard Limb Leads [5]

II. METHODOLOGY
Fabrication of ECG device has been reported previously in literature [6,7]. The ECG device constructed is based on work reported by Rowe [8]. The circuit was modified and we wrote our own source code. The USB electrocardiograph circuit diagram used in the present work is shown in Figure 2. The shielded electrodes are brought into the electrocardiograph via connectors CON1 and CON2 and through 1 F coupling capacitor and 3.9 resistors to input of IC U1. The IC U1, AD620AN is a low cost, high accuracy amplifier that requires only one external resistor to set the gains of 1 to 1000. Pin 5 of IC U1 is connected to 2.5 volt to set zero signal output level of IC U1 to 2.5 volt. To form a balanced low pass filter, a 1 nF bypass capacitor on each input of IC U1 and 47 nF capacitor is used. IC U2 is an LM358 dual op amp which is used to provide additional low pass filtering and to give fixed amplification to the ECG signals either two or four times using an additional switch. The next part of the circuit is involved in converting analog signals to digital and sending them to the PC via a USB cable and port. Both of these 48

functions are controlled using PIC16F84A microcontroller operating at 4 MHz. Conversion of analog to digital is done using comparator IC U3 to compare the amplified ECG signals with

49

programmed referenced voltage generated PIC microcontroller and an octal transceiver. The PIC16F84A can generate any of the 256 (28) different voltage levels between 0V to 5V at negative input of comparator IC. The output of comparator IC is connected to pin 3 of PIC chip which is bit 4 of micro I/O port A, configured here as an input. This allows the micro to monitor the output of IC U3 and perform a simple successive approximation ADC algorithm. It generates a sequence of voltage at pin 3 of IC U3 and changes the sequence according to the comparator output. As a result, the micro can quickly zero in one of the ECG voltages during each sampling sequence arriving at its 8-bit digital equivalent. Thereafter, the micro sends out each digital sample in format (9600 bps) from bit 1 of its I/O format port A1 to pin27 (RXD) of the USBMOD3 interface module [9]. This module then reformats the sample and sends it back to the PC via USB cable and port. The USBMOD3 Module is powered from PC via USB cable and it provides + 5 V DC from its +VBUS pins (pin 4 and 13), to power the rest of circuitry, all ICs are powered from it directly. A 100uF bypass capacitor removes any digital switching noise from analogue 5V rail. While it is transmitting and receiving data via the TXD or RXD lines, the USBMOD3 interface module pulls down its TXLD (PIN17) or RXLD (pin 15). LED1 and LED2 indicate bus activity.

The firmware is written in PIC basic language that continuously sends samples to the PC via standard USB cable (using an Elexol USBMOD3 interface module) at intervals of microseconds. The PC receives bytes at a baud rate of 9600. The scan rate is 250 pts/sec. The source code can be obtained from the authors. For displaying ECG waveform on PC (laptop in our case) one needs to install two pieces of software: (a)Virtual Com Port driver available from FTDI web site [10] and (b) Electrocardiograph program (the programs in this work are in Visual C++ and in LabVIEW 7.1). A VCP driver allows windows and control program to communicate with the electrocardiograph via its USBMOD3 interface module and one of the PCs USB ports. The electrocardiograph program written in Visual C++ language is easy to use. There is one start and stop button on the toolbar to start the sampling and to stop the same. Under View tab there is time resolution function which can be set from 100ms to 1000ms. For making use of this function Set Timer function in Visual C++ has been used that sends a clock signal after every one millisecond. However, this is not accurate at a low time interval. The electrocardiograph program is a multiple thread application. To insure integrity of operation, ECG waveforms are displayed on a separate thread. In LabVIEW 7.1 [11], VISA functions are used in its block diagram. VISA Configure Serial initializes the serial port to its settings (Baud rate=9600, Data bits=8, Parity=None, Flow control=None). Next, VISA Write function writes the data (i.e., a character) from the write buffer to the serial port. The next function is VISA Read which is in a loop so that the data is read continuously. The VISA Read function reads specified number of bytes from the device and returns the data to the buffer. The data is in binary waveform string where each point is represented as a 1-byte unsigned integer. The String to Array function converts binary waveform string to an array of unsigned integers which are then plotted on a graph. Peak detection of R wave is done by Peak Detector VI which is an algorithm that fits a quadratic polynomial to sequential groups of data points. The number of data points used in the fit are specified by width. For each peak the quadratic fit is tested against a threshold level. Peaks with height lower than threshold level are ignored. Locations of the peak in terms of byte are recorded. Heart rate per minute is calculated by finding the number of peaks in a scan, 250 pts/sec in this work. The number of peaks found is multiplied by 60 to get beats per minute. The ECG data is saved in the LabVIEW function of Write Measurement File which can be opened in Microsoft Excel for further analysis. The front panel of LabVIEW program is shown on Figure 3. It displays the waveform and heart beats per minutes. In case of one of the subjects tested by the instrument it was found to be 98 bpm.

Figure 2: Circuit diagram of USB Electrocardiogram

50

IV. ACKNOWLEDGMENT
The authors gratefully acknowledge the inspiration and guidance provided by Most Revered Chairman of Advisory Committee on Education, Dayalbagh.

V. REFERENCES
Webster, J.G. Medical Instrumentation-Application and Design, 3rd ed. John Wiley & Sons: New York, 2001, pp 139-151. [2] Tungjitkusolmun, S., Heart and Circulation in Bioinstrumentation, J.G. Webster, Ed. New York: John Wiley & Sons, 2004, 261-273. [3] Hobbie, R.K. The electrocardiogram as an example of electrostatics, Am. J. Phys. Vol. 42, pp. 824-831, 1973. [4] http://www.picotech.com/applications/ecg.html (Accessed May, 2008). [5] http://www.medresidents.stanford.edu/ Teaching Materials/ (Accessed July, 2008). [6] Carlson, S. Home is Where the ECG Is, Scientific American, June 2000. http://www.sciam.com/article.cfm?id=home-is-wherethe-ecg-is (Accessed July, 2008). [7] Satsangee, S.P. , Kumar, M., Srivastava, V.R., Gupta, G.C. Fabrication of LabVIEW based electrocardiogram in Proceedings of the International Conference on Environmental Parasitology and Community Health Initiatives (ENPARACOHI-2007), S. Prakash, Ed., New Delhi: Allied Publishers, 2007, 100-102. [8] Rowe, J. Build this USB Electrocardiograph, Everyday Practical Electronics, pp. 34-45, Nov. 2007. [9] USBMOD3 Users manual, http://www.ravar.net. (Accessed April, 2008). [10] www.ftdichip.com (Accessed April, 2008). [11] www.ni.com [1]

Figure 3: Front Panel of USB based ECG Machine Precautions The following precautions should be taken to obtain ECG from the instrument: a. Electrode placement should be correct in the fabricated instrument, i.e., Lead II limb configuration with LA electrode connected to subjects left ankle and RA electrode connected to right wrist. b. Electrodes must be properly connected to the body and gel should be used. c. The patient must be stable because motion of the body is picked up and this affects the ECG recordings.

III. CONCLUSIONS
The electrocardiogram machine which has been developed provides ECG waveform on a computer screen. It is a USB based device and costs around Rs. 5000. A more expensive and may be more accurate device can be fabricated with AD624AD. The measurements were made using Visual C++ and LabVIEW software. Data in LabVIEW can be stored for further analysis. The safety, portability and cost effectiveness of the device are being considered. Further work on the refinement of the device is expected to yield more accurate as well as a practicable diagnostic and educational instrument.

51

Vous aimerez peut-être aussi