« August 2007 | Main | October 2007 »

September 03, 2007

Run the Rockies - 5

Alderfer/Three Sisters Medley is #23 in Bragg's Run the Rockies.  Just outside of Evergreen, this is a set of busy trails with walkers, mountain bikers and at least on runner.  I enjoyed this run with hills, views and shadey fast descents in the trees.  The trails are relatively clean and wide so you can put on some speed here if you like.  With stops for bikes, pics and to have a look around, this one took 68 min (5.9 mi).  Happy Labor Day!
www.flickr.com
Dr. Skippy's photos tagged with bragg_23 More of Dr. Skippy's photos tagged with bragg_23

September 01, 2007

Building an Electrocardiograph I

After the biofeedback experiments a few weeks ago, I started thinking about a more flexible way to measure raw heart rate data.  I am interested in more control of data sampling in order to make signal processing and analysis easier.

Fortuitously, the last issue of Make has a short article on page 157 on the topic of DIY electrocardiographs.  So off we go...

I first decided to go with the instrumentation amplifier built from three 741 op amps as described in the article.  I added the simple resistance-capacitance filter recommended in the article, got some conducting 3M Red Dot electrode pads and hooked the whole think up to the USB Bit Whacker for data collection (see Accelerometer from a few days ago.).

What were the results? Well, a qualified "it worked," but this needs some work.

The amplifier.  We need a gain of about 1000 to get the signal in the range of the A/D capabilities of the UBW (0-5V, 10 bits resolution). And we need high fidelity differential amplification of the inputs. This is called the common-mode rejection ratio (CMMR).  We need a CMMR of 100,000:1 (~100dB).  Here is the schematic:

instrumentation amp schematic


I added the recommended RC amplifier to the output to clean up the signal a little.

Here are some photos of the construction process. The circuit is point-to-point wired on a proto board and the whole think is mounted in a small aluminum case. The basic circuit is only a few components so it didn't take long to build.

instrumentation amplifier construction


The amplifier is powered by two 9v batteries to provide +/-9V for the op amps.  This means the output signal varies from something like -8 to +8 volts. Feeding the A/D of the UBW a signal between 0-5V is going to require some adjustments.  I added two 10K ohm potentiometers for null offset to I1 and I2.  (I now think this was a naive mistake because these have to be set very nearly equal for the amplifier to work.) I also added a 500 ohm gain adjust potentiometer in place of the 200 ohm fixed resister recommended.

testing instumentation amplifier


When I tested the amplifier with DC input signals, I grounded one input and varied the input at the other with a simple voltage divider.  This didn't expose any of the weaknesses of my design decisions. The null offset adjustment worked well. The test showed a gain of 1000 was easy to attain and that the amplifier produced a nice looking linear response.



So I closed up the case and was off to measure my heart beats.

finshed amplifier


Contact pads.  I started with some home-grown copper electrodes.  While I did get a small signal--intermittently--this wasn't going to work. To the Internet to buy the real thing from 3M.



I attached my new amplifier to the UBW analog input channel and modified my Python script (accelerometer.py) from the accelerometer experiment to capture data on one channel every 10 ms.  Here are the results:

heart rate data


And some detail...

detail plt


It is clear that external signals are swamping the desired heart beat signal.  It also may be the case that the amplifier-A/D combination is so poorly matched that there is some distortion of the data.

What to do different:

* Shorten the input leads--they seem to be acting as large antennae to the 60 Hz AC line frequency
* Build a better filter (active)
* Build/buy a more robust instrumentation amplifier
* Use a smarter method to translate the output to the required A/D voltage range
* Best of all, have this experience

Run the Rockies - 4

It was great to get out on a trail again after having run the streets around work for few days.  Today, I chose a run just out of Golden--#20 Apex Loop, in Steven Bragg's Run the Rockies  (see previous posts). There are steep parts on the switchbacks on both Grubstake and Sluicebox, but running in the trees is great and the views are fine too.  It is a shorter run (for Bragg) at 5.1 miles.  I took a leisurely hour with stops for deer, bikers and photos.

 

www.flickr.com
Dr. Skippy's photos tagged with bragg_20 More of Dr. Skippy's photos tagged with bragg_20

Hosting by Yahoo!