Data acquisition on the Macintosh

It is fairly easy to perform simple data acquisition on the Mac by using the sound input jack (an analog input via a stereo mini phono plug). In this case, analog to digital conversion is performed by the Mac's internal Analog to Digital Conversion chips, which saves the electronics engineer and software programmer quite a bit of work. The sampling rate and frequency range of this hardware is more than sufficient for most simple DAQ applications, including EEG (the signal is AC coupled, however). Although this configuration is initially limited to two channels of input which must share a common ground, it can probably be extended to several channels of true differential input by use of external multiplexing hardware to combine several signals into two, and use of special decoding software to separate the channels once they have been digitized. The Mac ADC hardware has more than enough bandwith to handle several (~16-32) relatively limited (1-100 Hz) EEG signals.

The equipment used here consist of a Mac '99 G3 portable, B+K Precision 4011 function generator, and a Tektronix TDS 210 digital real-time oscilloscope:


I have created a DAQ component for the component software system which acquires data from the Mac sound input port. To use the component, you must first enable sound input from the Monitors and Sound control panel. Currently I am acquiring data in continuously running "snapshots" of adjustable duration and sampling rate. Actually, data is always acquired at the default rate for the sound ADC hardware, which is at 44.1 KHz, 2 bytes per sample. To produce an adjustable sampling rate, samples at the full rate are averaged together to produce a single sample. This is smoothing by a rectangle, and is, strictly speaking, inferior to smoothing by sinc(x), but is probably good enough for the current application. However, this may change in future. The input port clips at about 1.5 V peak-peak.

Here is an image of a ~10 Hz sine wave being acquired in 1 sec epochs at 256 samples/sec:


At present I have a signal generator hooked up to the sound input jack of the Mac. A 1 M resistor is connected across the leads as a "load". I have no idea what the input impedance of the Mac sound port is, but it ought to be fairly high. However, the output impedance of my signal generator is 50 Ohms, so I have used two 10 K resistors as a current limiter. For a 1.5 VPP input, this should limit current to 1.5/20K = 75 uA even if the output was shorted. The actual EEG electronics will have adjustable output voltage and current settings. The resistors are then connected to one channel of a shielded stereo cable, while the other channel is shorted across another 1 M load. The cable goes to a mini phono plug, and into the back of the Mac.


Here is a photo of the connection hardware with a scope probe attached:


Obviously, the Mac sound input port is AC coupled, which is fine for my application (1-100 Hz with battery DC offset). However, this filter will introduce another phase shift in the signal, this time at low frequencies, which must also eventually be corrected for when the overall response of the external electronics and the DAQ system are measured. Here is the response to a square wave input at about 2 Hz, showing the characteristic exponential decay of the capacitors:


Here is a chart of the sine response of the DAQ system for three different sampling rates (128, 256, and 512 pts/sec) for inputs of 1-120 Hz:

(Click for larger image)

Note that while the image of the curve deteriorates considerably at higher frequencies, actually only the last three figures of the first column are outside the Nyquist range (the green outline visible in the larger image). Even though the visual appearance of several curves is quite poor, according to theory these datasets do contain all the information necessary to properly analyze or reconstruct the input signal.

Also note that while the shape of the curves changes considerably, the input is always a pure sine wave. Thus, depending on the configuration of the DAQ system, a simple sine wave can appear to be a much more complex waveform. This can be deceptive if one is attempting to visually classify the signal without knowing the actual input or nature of the distortions possible. For example, consider close-ups of the 60 and 80 Hz plots of the first column, one which is just inside the Nyquist limit and one which is just outside it:

Without knowing the circumstances, one might attempt to classify these plots as EEG traces, with the first signal as part of a set of sleep spindles, and the second as part of a spike-wave complex. However, in both cases the actual inputs are simple sine waves, and the physical application has nothing to do with EEG. This kind of potential misclassification could be more problematic if the distorted waveforms shown here were hidden within a more complicated signal, overlayed with other equally distorted components. Thus, it is extremely important to know the properties of the DAQ hardware and software used, and what possible artifacts it can produce which are unrelated to the actual signal being acquired.


©Copyright Sky Coyote, 2000-2002.