Dexter S. French, Jr.
This began as a project after I had a heart attack on April 27, 2008. I was enrolled in Cardiac Rehab at Fla Hospital and was "encouraged" to get a Heart Rate Monitor. The nurses suggested I look at Polar and after a little searching, I purchased a Polar FS-3 from Amazon. It worked just fine, but after getting back to biking, I became curious what my Heart Rate was doing all along the ride. This is a screen shot of what a biking run up and back looks like.
Still interested ? Read on.
The FS-3 is an unencoded model and puts out a 10ms burst of 5Khz for each heart beat. I figured I could just sample this burst and store the interval data to be retreived later. It turns out that this was the case and I developed a little recorder that I mount on the handlebars that does the deed. I will describe how it works and how to build it below.
The first step was to get a sample of the 5Khz burst. Now, at 5khz, the energy is mostly electromagnetic (H), not much electrostatic (E). So, I set out to build a loop pickup. I'll spare you the interim experiments and just say that I wound 340 turns around a big 1 inch dia ferrite core that I had and tuned it with a 0.1uf cap. The target inductance was 10.1mH in this case. I calculate that the ferrite core that I used has an perm of about 8 for what it's worth. I'd suggest using the ferrite antenna core from an old AM radio and working with that. What's important is that it resonate at 5khz with something around 0.1uf.
Get, borrow or build (use a 555) an audio signal generator. Put about 100K in series with the tuned "antenna". Sweep the frequency while monitoring the ac voltage across the LC, preferably with a scope, looking for peaking at 5Khz.
Here's what the Loop Antenna looks like all taped up for protection.
I hooked the loop up to a scope and sure enough, I was getting a nice burst with each heart beat from the Polar chest strap transmitter. I think you may be able buy the chest strap seperately as a TS-31.
Ok, we've got our antenna and here's the rest of the story.
I needed a receiver that provided pulses that a simple microcontroller could measure the interval between and then record that data. For the microcontroller, I chose the Parallax Stamp, BS2e Parallax.com and to store the data, a 71 cent (Mouser) single chip serial EEPROM, 24C64P. As it happens, the Parallax people have already provided the drivers to talk to the EEPROM so a little code on my part to count the HR interval and store it was all that was left.
I built what amounts to a very simple TRF (Tuned RF) receiver front end. I followed that with a "precision" cookbook rectifier, a bit of integration to sample pulses as long as 10ms followed by a bit more gain all in a single LM324 quad op-amp. The output then triggers a one-shot (monostable multiviibrator), 74HC221. To see what was going on as I rode, I hung an LED on the /Q of the OS to see the beats. This turned out to be VERY useful. With my setup, I can get about 4 feet away from the antenna before loosing the beat signal. I attached the antenna onto the plastic enclosure with tape and a little strap/pocket thing made to hold an mp3 player. It helps protect the antenna.
Here's a schematic of the entire receiver portion.
This board of the receiver plugs into a Parallax Super Carrier ($20) board.
This is what the whole works looks like together. The works.
I put it into this box which mounts with some velcro to some brackets I fabricated for the handlebars. The extra bungee strap is just in case.
The O/S puts out a 20ms pulse. I measure the interval between the falling edge of the 20ms pulse and the rising edge of the next and add 20ms for the entire interval. From there, it is simple algebra for the Stamp to calculate and store the data for each heart beat. This is integer arithmetic, so you do have to pay attention to the size of the numbers. If you look at the code, you will see how I have done this. The EEPROM takes about 10ms to store data and I just doubled that. The Stamp is quite busy measuring the interval and the other 20ms is used for calculating and storing data. The whole thing runs on a 6 volt battery. I use a wall bug indoors.
I set the code up to accomodate 2 seperate bike runs. With its slots, the BS2e makes this easy. I bike up to coffee, goof off, and then bike back. I wanted seperate records. So, there is switching and code in each slot to deal with both sets of data. This is the code for the Record1 and View modes. Because the BS2e Stamp has seperate "slots" where seperate code can reside, I use this feature of a seperate slot for the second ride code. This is the code for the Record2 mode.The switch selects what mode the controller jumps into upon power up. I just plug power in from a 6V battery on the bike after selecting the desired "mode." The whole works draws about 50ma. or less. The total number of heart beats that the EEPROM will hold is 8178. The rest is 4 pointers and 10 dividers. For me, that's about 18 miles on the bike although I only bike 9 miles. You could use a 24C256P ($1.70, Mouser) and store 4 times that. Just change the code (constant is named Size) in both code sets to accomodate the larger number of beats limit and you'd be all set.
A word about data retrival. Parallax actually provides a nifty Excel add-on called PLX-DAQ that will communicate with the Stamp through the serial programming connector on the Super Carrier Board. They also provide an Excel template where the captured data will land to get you started. It's all free from the Parallax site and includes excellent documentation. Fish around on the Parallax site Parallax.com and you will find all the good stuff. This is the modified template that I use to import and plot the HR data. It won't run unless you have the PLX-DAQ add-on installed.
This is a screen shot of what a pair of my runs looks like. The first 2 numbers in col A are the ending addresses (actually the number of heart beats) for the two runs. Then, each run is stored one right after the other with a 10 count spacer. Column B is that actual Heart Rate in beats per minute. At the end of the first run, I have put in 10 HR counts of 100 as a visual divider to try and seperate the 2 runs on the graph.
Functionally, it works like this. I set the switch to View, then plug in power and confirm that the LED is flashing. Then, I remove power, set the switch to R1, apply power and begin my ride. At the end of the first ride, I move the switch to R2, wait for at least one heart beat and THEN and only THEN remove power. This is important because there is a little housekeeping to do like saving the last address in the EEPROM. When finished goofing off, and with power still off, I set the switch to View and then apply power to confirm operation and, then, remove power. I then set the switch to R2, apply power and take off on the return ride. At the end of the return ride, I switch to the View position, wait for at least one heart beat and THEN remove power.
Done with the ride, I simply unplug everything, dismount the box and bring it inside to view the data with PLX-DAQ.
As you will see in the screenshots in the pdf's (below) of all my bike runs, I'm pretty good at messing this process up.
A word about the spikes and noise you see on the plot. The nurses tell me ( I've shown it all to them ) that the heart stumbles and "throws" PVCs. It's like walking along and tripping over an air molecule. I'm sure some of the spikes are PVCs even though I can't feel them, but most all of the others are noise pickup from power lines along the trail. The noise seems to happen at the same place and the intensity and duration varies as the weather changes. Because of this noise, I put in a bit of data filtering. When the receiver gets flooded with noise, it's really obvious because the LED is on continuously. I decided to put in a little coding that limits the reasonable HR to numbers of a living being. 48 - 188 bpm is what I chose. Before the filtering, I was getting strings of HR data of 6000 bpm. It was really obvious what was going on. I decided to just not store data that was too long or too short.
Early on, I tried to reduce the recorded noise. Some of this noise, it seems, is just poor contact of the chest strap which began when the weather got a lot cooler and dryer. I started using a salt loaded hand cream mixture on 10/15/08 and the results were promising as you can see in the pdf plots since then. The rest of the noise is just induced magnetically from power lines that run along the trail that I can't do anything about. It's not from anything arcing because if I rotate the pickup loop ( the handle bars) 90 degrees, the noise disappears. It just varies with the weather and whether more or less power is being drawn through the power lines. ( ref. Ampere's Law).
So some of the spikes you see are real and most others probably are not. But at least you can see generally what is going on. While investigating the noise problem, I also hung a small earphone on the O/S output to listen. I sure could hear my heart beat but in a short while it became more data than I wanted to have on the bike ride and I removed the "feature". Anyway, the recorded pdf's (see below) should give you an idea of how this project is working out.
I've used this little recorder for over 5 years now and it continues to work quite well for it's intended purpose. I have collected a lot of HR plots. As long as I remember to set the switch positons correctly and wait for at least one heart beat before removing power, I get good data. It also helps when I charge the battery once in a while.
These are the, now, 24 pdf's of my Heart Rate during the bike ride up and back. log , log2 , log3 , log4 , log5 , log6 , log7 , log8 , log9 , log10 , log11 , log12 , log13 , log14 , log15 , log16 , log17 , log18 , log19 , log20 , log21 , log22 , log23 , log24 and log25
These plots of my Heart Rate are for the same 9 mile bike ride that I take 5 days a week. I've included explainations for each plot including my bloopers. Bloopers were caused by incorrect mode switch position (operator error, me) and an intermittent power connector which causes lots of extra "noise" as I bounce down the road. The bungee cord seems to have helped that. I can now attribuite other noise to the chest strap failing as the conductive plastic to the "pads" become intermittant after nearly 2000 hours. This is about the same age that the battery wears out. I'm on my 3rd chest strap now.
I hope you find it useful.EOF