The core of this project is to reliably detect a user's heartrate. The method used by PotC is through a simple EKG or Electrocardiogram. The EKG works on the principle that the heart's electrical activity can be detected through measuring voltage differences produced across the body. A medical EKG uses many measurement points, but our system will rely on only two, the voltage between the left and right hands.
This two lead EKG is the basis behind common consumer heart rate measuring devices such as those used on treadmills, which embed the sensors in the treadmill rails. There are also pulse sensing watches where the user wears the watch on one wrist, and must touch a pad on the watch with their other hand to complete the measurement.
Performing a reliable EKG measurement is in practice quite difficult to do under uncontrolled conditions. In a medical EKG, the leads have a good electrical connection to the body through the use of conductive gel. In the pulse sensors used in exercise equipment, the measurement is made much easier due to the fact that the user is sweaty and has a heart that is beating strongly.
The voltage produced across the heart is very small, and the body and equipment will pickup interference from ambient EMI, mostly from emitters like power lines and fluorescent lights. The signal must be heavily filtered in order to get a signal that can be used reliably to measure heartrate.
The PotC team decided to base the project on the "Olimex MOD-EKG" development board. This is an inexpensive development board that is based on a Texas Instruments design which was developed as an application example for their MSP430 microcontroller. The dev board utilizes the built in op-amps of the MSP430 to condition the signal, and performes digital filtering on the signal to reduce interfering signals.
Phew, ok anyway to make a long story short, it's quite a pain to reliably measure pulse. I'd like to try some alternative boards to compare. Since this thing was really designed to be an example for the microcontroller, I'm inclined to think that the analog front end could have been more sophisticated. Connections to the MOD-EKG
We need to make some connections to the MOD-EKG as well as modify the code that comes with it. The software is included in this instructable.
Links to Useful Documentation:MOD-EKG DocumentationTI App Note (The MOD-EKG is based off of this)1. Power Wires
The MOD-EKG runs of of 3.3V. I soldered some speaker wire to the power pins of the mod EKG. These will get soldered to the 3.3V regulated supply on the Arduino2. Sensor Leads
These are the wires that connect the sensor pads on the MOD-EKG to the copper handles. The system is very sensitive to interference so I cut up an old USB cable to use for this connection. A USB cable has a nice shield that helps prevent interfering fields from generating signals on the lines. The shield should be connected to the ground of the circuit board.3. Signal Leads
There are two signal wires that indicate pulse information to the arduino.
One is the contact indicator. It goes logic high when contact is detected (the user grabs the handles). The way this works is that the noise level increases when the user grabs the handles and if the noise is above a certain threshold, then the contact indicator signal is held high.
The other is the pulse indicator signal. I spent a decent amount of time messing with serial I/O before I decided to just make a bit that flips every time a pulse is detected. This prevented me from having to make the MOD-EKG and the Arduino talk over serial which was giving me a bit of a headache with a deadline fast approaching so I took the lazy way out.