Development of a LabVIEW-based Virtual Electrocardiogram Recording System
2026-04-06 08:20:01··#1
Abstract: A virtual ECG data acquisition and recording system was developed using LabVIEW, a virtual instrument programming language with intuitive graphical programming and powerful digital signal processing capabilities. The system features real-time ECG waveform display, heart rate display and alarm functions, waveform storage and playback. Keywords:ECG ; data acquisition; LabVIEW; virtual instrument. 1 Introduction Electrocardiogram (ECG ) signals represent the bioelectrical activity of the human body, and can be used to assess a person's health status. ECG research has always been an important topic in the medical field, and electrocardiography (ECG) is an important method for the clinical examination and diagnosis of cardiovascular and other diseases. Traditional electrocardiogram (ECG) recording methods primarily rely on electrocardiographs (ECG machines). Signal acquisition, processing, and display are mainly handled by hardware circuits, which require advanced manufacturing technology, resulting in expensive equipment and inconvenient maintenance and updates. The development of virtual instrument technology provides excellent technical support for transforming traditional ECG recording equipment. It utilizes the powerful software processing capabilities and abundant hardware resources of computers to form plug-in virtual instrument systems, using rich software systems to achieve functions typically performed by hardware. LabVIEW, a graphical virtual instrument development software developed by National Instruments (NI), features simple programming and intuitive results. We used LabVIEW, a self-made multi-channel ECG amplifier, and a PCI6023 data acquisition card to construct a virtual instrument system, developing a user-friendly intelligent ECG acquisition, recording, and analysis system. This system enables all ECG data processing, display, storage, playback, and analysis to be completed by the computer, overcoming individual differences in ECG analysis by clinicians and facilitating the construction of remote monitoring and diagnostic systems. 2 System Composition The ECG signal acquisition and recording system, as shown in Figure 1, mainly consists of two parts: hardware and software. The hardware primarily includes a multi-channel ECG amplifier, a data acquisition card, and a PC. Its main function is to acquire, process, and convert electrocardiogram (ECG) signals to an A/D converter, and then import the signals into a PC for processing via a DAQ board. The software uses LabVIEW 6i to display, analyze, and process the acquired ECG signals. The multi-channel ECG amplifier is a self-designed component, as shown in Block Diagram 2, which mainly consists of a preamplifier, bandpass filter, power frequency notch filter, main amplifier, and optocoupler circuit. The preamplifier uses the AD620 high-performance precision instrumentation amplifier from Analog Devices. The bioelectrical preamplifier designed using this device has a simple circuit structure, is easy to debug, and easily meets the technical specifications of ECG preamplifiers, such as high input impedance, high gain, low noise, and low drift. The bandpass filter consists of a first-order active high-pass filter with a cutoff frequency of 0.05Hz and a fourth-order Butterworth low-pass filter with a cutoff frequency of 400Hz, effectively filtering out interference signals and allowing ECG signals from 0.05 to 100Hz to pass through without distortion. Power frequency interference is filtered out using a 50Hz notch filter in the form of a dual-T active filter. The main amplifier is used to condition the processed ECG signal to meet the input signal level requirements of the PCI6023 data acquisition card. The optocoupler is used to isolate the human body from electrical appliances, ensuring electrical safety. 3. System Software Design The program developed under the LabVIEW development platform is called a virtual instrument program, or VI for short. VI consists of three parts: front panel program, block diagram program, and icon/connector. The front panel program controls, processes, and visually represents signal acquisition. The block diagram program is the graphical source code of the system program, mainly including functions, structures, terminals representing various control and display objects on the front panel, and connections, used to implement signal acquisition, processing, and analysis. The front panel design, using LabVIEW 6i, shows the front panel of the ECG acquisition system as shown in Figure 17. The front panel of the virtual instrument is the visual interface for interaction between the instrument and the user. Users can operate various switches and buttons on the front panel to achieve real-time ECG signal acquisition, heart rate calculation and display, waveform storage and playback, and other functions. Two waveform display controls are set in the front panel: the upper left is used to display the acquired ECG waveform in real time, and the lower left is used to display the replay waveform, facilitating doctor observation and diagnosis of the required ECG. [align=center] Figure 3 Front panel of the ECG acquisition and recording system[/align] The real-time ECG signal acquisition and display program is designed with a loop structure, using a "stop" switch to determine whether to enter the ECG acquisition state. The "Start Sampling" button controls the entry into the inner loop structure. The "AI READ" program is called to complete real-time acquisition of ECG signals. The set scan rate per second is scans/s, the buffer size is [number] scan data, and the number of scans read at one time is [number] scans. A loop register stores the number of unread sampled data in memory after each specified number of scans. Simultaneously, a "case" structure is called to display the heart rate in real time. The program uses a "case" structure to display the heart rate in real time. The block diagram of the real-time ECG signal acquisition and display program is shown in Figure 4. [align=center] Figure 4 Real-time acquisition and display block diagram[/align] Heart Rhythm Calculation Program This module replaces the differential, shaping, and counter circuits in the traditional ECG machine hardware circuitry, using software to complete the R-wave detection, period, and heart rate calculation functions of the ECG signal. The acquired real-time ECG signal is connected to the "peak detect" program to detect the R-wave, thereby calculating the two R-wave intervals and the heart rate. [align=center]Figure 5 Heart Rhythm Calculation Flowchart[/align] 4 ECG Signal Processing As can be seen from the ECG waveforms acquired in Figure 6, the main interference components in the signal are high-frequency interference, power frequency interference, and baseline drift. These will cause significant errors in R-wave detection and RR interval calculation. Therefore, effective filtering of the signal is necessary for the calculation and analysis program to obtain correct results. [align=center]Figure 6 Original ECG Signal Waveform[/align] LabVIEW 6i has strong signal processing capabilities, with various digital filters available. The Equi-Ripple Bandstop in the Signal Processing ToolBox control is used to eliminate the 50Hz power frequency signal; the Median Filter control is used to eliminate baseline drift; and the Chebyshev digital filter in the Digital FIR filter control is used to filter out high-frequency signals. The ECG signal waveform processed by the above methods is shown in Figure 7. It can be seen that various interference signals are effectively filtered out, and the R wave is enhanced, achieving the desired effect. [align=center]Figure 7 Processed ECG signal waveform[/align] 5 Conclusion LabVIEW provides an excellent development environment for the research and development of intelligent medical instruments. Developing virtual medical instruments using LabVIEW has advantages such as intuitive result display, simple programming, and short development cycle. Our ECG acquisition and recording system developed using LabVIEW has only initially completed some major functions. Further research will mainly include program control of amplifier gain, automatic lead selection, time constant selection, filter selection, and improvement of signal processing software. We believe that with further optimization, it can fully meet the needs of experimental teaching and clinical diagnosis of medical electronic instruments. The authors' innovations include: constructing a virtual ECG recording system using LabVIEW 6i; software implementation of ECG R-wave extraction in the LabVIEW environment; and software implementation of signal filtering in the LabVIEW environment. References [1] Zhao Chongkan. Dual-time QRS wave detection circuit [J], China Medical Devices Journal, 1995, 19 (3): 158-160 [2] Deng Dongyun, et al. Design of an analog processing circuit for weak physiological signals [J], China Medical Devices Journal, 1994, 18 (5): 262-265 [3] Wang Minsheng et al. LabVIEW Basic Tutorial [M]. Beijing: Electronic Industry Press, 2002.1 [3] LabVIEW Measurements Manual [M]. National Instruments, 2000.7 [4] Yu Jie, Li Chuanyong et al. Design of ECG signal acquisition system based on LabVIEW [J], Biomedical Engineering and Clinical, 2001, 5 (3): 131-133 [5] Wang Jianqun, Nan Jinrui et al. Implementation of data acquisition system based on LabVIEW [J], Computer Engineering and Applications, 2003, 21: 122-125 [6] Yan Yan, Ma Zengqiang, et al. Programming Techniques for Data Acquisition and Processing Software Based on LabVIEW [J], Microcomputer Information, 2005, 21(5): 153-154