Macintosh EKG/EEG Hardware and Software Project


Contents
  1. Introduction
  2. Important disclaimer
  3. Electronic hardware
  4. Basic data acquisition software
  5. EKG pages
  6. EEG pages
  7. Future work



Introduction

I am currently working on a project to create simple, low-cost, portable, hardware and software for biophysical data acquisition and analysis on the Macintosh. My specific application involves EKG and EEG signals, although the system could be used for input and analysis of other generic electrical signals. The project consists of the creation of external data acquisition electronics, and of data acquisition and analysis software using a concurrently developed component software system .


(Click for larger image)

Initially, the goal of the project is to create a portable 2-channel real-time system using discrete electrodes. Next, the hardware and software will be extended to provide multi-channel EKG input from a grid of sensors attached over the chest, and EEG input from a 3d electrode cap worn over the head.

This multi-channel input will then be linked to 3d EEG analysis and animation software. A prototype of this software has already been developed. This software currently provides 3d interpolation and animation of time series and spectral EEG data, showing the time- and space-varying electrical field of the brain. Similar software will take its input from a grid of EKG sensors in order to show the time- and space-varying electrical field of the heart.


(Click for additional images)

The overall goal of this project is:

  1. To create a very low-cost, portable, easy to use, EKG and EEG data acquisition and analysis system specifically for the Macintosh.

  2. To use this system to produce 3d animations of the time- and space-varying electrical fields and their spectra, of the brain and the heart, both as a post-processing step and in real-time.



Important disclaimer

The equipment and techniques discussed at this website are not for "medical" purposes. I make no claim whatsoever about any possible benefits to be derived from this equipment, these analyses, nor from EKG/EEG research and analysis in general. I am not a doctor, and am therefore not qualified to judge this work in any legal way. These examples are simply a demonstration of the kind of low-level biophysical signal which can be acquired by the hardware and filtered by the software.

The hardware designs, schematics, and discussions presented at this website are all theoretical, and should be considered as "works of fiction" for "entertainment purposes" only. They are not meant to be used to create actual working EKG/EEG hardware. Furthermore, under no circumstances should they be used to create hardware that will be used on a human subject.



Electronic hardware

  1. Power supply.
  2. An EKG amplifier and filter.
  3. An EEG amplifier and filter.
  4. Measuring the frequency response of the electronics.

Currently completed EKG/EEG data acquisition electronics consist of several external prototype amplifier/filter systems, each powered by a 9V battery. All amps use the same DC power supply layout. Note that the external electronics of a discrete data acquisition system must be low-pass filtered in order to reduce aliasing (as the discretization makes it inevitable). All amplifiers consist of one or more instrument amplifier chips, either passive or active low-pass filtering, and optional active notch filtering to reduce AC noise.

These amplifiers are used in AC-coupled mode (meaning a capacitor is used in series with the signal between stages to prevent pegging at the supply rails), with a frequency response down to about 1-2 Hz. Each amplifier is built in terms of functional units (e.g. supply, input, filters, output), and is designed as stages capable of gains from 2-1000, depending on the feedback resistors used. Target amplification is from a uV or mV input range to about 1.5 V peak-to-peak output. The output of an amplifier is connected to one channel of the stereo sound input jack of the Macintosh, using the internal ADC chips to perform analog to digital conversion.

Photos, schematics, and test results are provided for all amplifiers. One should find the "rat's nest" construction of the electronics fairly amusing, although this does not affect their operation.



Basic data acquisition software

  1. Data acquisition on the Macintosh.
  2. The Discrete Fourier Transform (I).
  3. Data windowing.
  4. "Ideal" low-pass filtering.
  5. The Z transform and Discrete Fourier transform (II).
  6. A simple digital oscilloscope application.
The data acquisition and analysis software is in component form, and consists of a component management "shell" program and a set of dynamically linked components. Some components which have been written specifically for this project include data acquisition (DAQ) over the Mac sound port (using the Mac internal ADCs), the DFT and inverse DFT, complex operations and functions, convolution and deconvolution, and display of complex data using 1, 2, and 3 dimensions.



EKG pages

  1. Acquiring 12-lead EKG data.
  2. Extracting and averaging multiple EKG waveforms.
  3. Lowpass filtering and smoothing of EKG waveforms.
  4. 2d plots of V1-V6 leads.
  5. Surface and image plots of waveform variations in V1-V6 leads.
  6. Acquiring a grid of 25 EKG signals.
  7. Creating an animation of the grid (includes 2 small QuickTime movies of the animated grid).
  8. Computing magnitude and phase spectra of the grid.
  9. High resolution line spectra of the V(3,3) signal.
  10. Computing multiple spectrum records from a signal.
  11. Bipolar signal synthesis and visualization of the cardiac axis.
  12. High resolution line spectra of the 5x5 EKG grid.
  13. Measuring the magnitude and phase of the line spectra.
  14. Reconstruction of the EKG signal from a finite set of line spectra (i.e. as a finite Fourier series).
  15. A new 2d frequency/phase spectrum of an EKG signal, showing the interaction of two dynamic systems.
  16. A new 2d feature spectrum of an EKG signal, showing several distinct components.
  17. Magnitude/phase spectra of 7 independent EKG features.
  18. Mathematical modeling of EKG feature spectra, and synthesis of the EKG signal as the interaction of multiple bandpass filters.
I have initially concentrated on EKG data acquisition and processing, since it is a necessary precursor to EEG data acquisition, and it is also a worthwhile achievement in itself. I have built an amplifier and lowpass filter tailored specifically to EKG, and have used this amplifier to acquire EKG data using the 12 standard "leads", or electrode configurations.

My software work has also concentrated on making the component software system more useful for acquiring and processing of EKG data. New components and changes to existing components allow for easy and rapid acquisition, filtering, and storage of the 12 (or more) different electrode configurations in real-time during a single session, and the perusal, extraction, and additional filtering of this data as a post-processing step which can be performed at leisure.

Some of the additional analysis examples I have constructed include the extraction of single waveforms from epoched datasets, and Fourier filtering to compensate for the magnitude and phase characteristics of the external electronics when necessary. Multiple waveforms from a single lead are extracted and averaged point-by-point over time, and waveforms acquired from different leads are cross-plotted in 2d. Continuous changes in waveform shape with respect to electrode placement are also compared and plotted as a 3d surface.

In addition to using the 12 standard leads, I have performed a simple experiment and analysis in which I acquired a 5x5 grid of precordial EKG signals from the chest leads alone. These signals were then averaged, synchronized, and combined to show a low-resolution view of the whole electrical field of the chest as a surface or image which can be animated over time. This can be done even though the individual signals comprising this field are not acquired simultaneously. In this experiment, I am interested in looking at variations in EKG signal shape and spectrum, and zero locations in the Laplace transform, with respect to electrode position. Although the first grid was very rough, this experiment does show the potential for future study using a grid of higher resolution.

Next, a high-resolution spectrum was performed on each of the waveforms in the 5x5 grid, all of which show discrete lines. Then, the magnitudes and phases of these line spectra are sampled in order to perform a finite Fourier series reconstruction of one of the signals, and to show that this reconstruction converges very slowly. Then a new kind of 2d frequency/phase spectrum, of which the 1d Fourier transform is a subset, is performed. This new analysis suggests that the EKG signal is the result of two different interacting dynamic systems, each with its own visual signature and underlying characteristics. A varient of this new analysis identifies distinct features in the EKG signal, each of which has its own magnitude and phase spectrum independently of other features. This suggests that an EKG signal is the result of the impulse responses of multiple independent bandpass filters operating simultaneously. A reconstruction of the EKG signal using simple mathematical functions fitted to these feature spectra agrees considerably with the actual signal, and converges much faster than the Fourier series.



EEG pages

  1. Acquiring simple bipolar and unipolar EEG signals.
  2. Spectral analyses using data windowing and combined EEG records.
  3. Extraction and measurement of alpha band EEG signals from unipolar occipital data.
  4. Application of the 2d frequency/phase and frequency/delay spectra to EEG signals.
  5. Initial EEG feature extraction, spectra, and synthesis.
For the above examples, I have built a new EEG amplfier and electrodes, and have made some simple preliminary bipolar and unipolar scalp measurements. I have been able to directly see some standard waveforms (such as alpha, spike-waves, and wickets), and have performed some simple spectral analyses of these signals. I have also been able to filter signals so as to extract and measure the alpha band components and their strength relative to the overall signal. Although this is fairly basic EEG work, it does show that the hardware and software are working correctly (as is the wetware), and paves the way for more ambitious measurements and analyses, such as frequency, phase, and correlation surveys of the entire head.

Finally, frequency/phase analyses such as those applied in the EKG examples above, are applied to the EEG signals in order to observe and extract features from these datasets as well. The next step is to use this information to model the EEG signal in a manner similar to that used for EKG.



Future work

Here is a short list of some additional experiments I would like to perform and enhancements I would like to make to the hardware and software:

EKG

EEG

General



©Copyright Sky Coyote, 2000-2002.