Introduction: Heart Rate Monitor AD8232, Arduino, Processing
The Analog Devices AD8232 is a complete analog front end designed to acquire milliVolt level EKG (ElectroCardioGram) signals. Although it is a simple matter to hook up the AD8232 and see the resulting EKG signal on an oscilloscope, the challenge for me was to acquire the signal for display on my PC. That is when I discovered Processing!
AD8232 documentation page - http://www.analog.com/en/products/application-spec...
A breakout board is available from Sparkfun here - https://www.sparkfun.com/products/12650 or, if you wait a few weeks, from China here - https://www.ebay.com/itm/New-Single-Lead-AD8232-Pu...
I ordered the kit including body sensor cable with sticky pads.
Step 1: Preparing the AD8232 Breakout Board
The plan is to have the AD8232 board acquire the EKG signal. The output of the AD8232 is a signal of approximately 1.5 Volts. This signal will be sampled by an Arduino Uno at approximately 1k samples/second. These samples values are then sent over the USB port to the PC for display. I quickly discovered that powering the AD8232 from the 3.3V output of the Arduino board was a bad idea - too much 60 Hz noise. So I switched to 2 x AA batteries. The AD8232 can be powered by a 3V mercury coin cell if desired. Two wires (signal and ground) ran from the AD8232 board to the Arduino (A0 and ground). I used a generous amount of hot melt glue to reinforce the wires at the the AD8232 board junction.
Step 2: EKG Simulation on Arduino Uno
The next step is to create a simulator running on the Arduino. This way I don't have to sit around with the electrodes attached to my body as I am debugging code.
Step 3: Up and Running
Finally, the PC display. The Arduino code needs to be changed to acquire real data instead of simulation data. The Processing code is shown. I was rather apprehensive about diving into a new language / development environment, but as soon as I saw the Processing IDE I thought "Whoa! This looks familiar - just like the Arduino." Here is the download link for Processing. It only took a few hours of hacking code I found on the Internet to get an application up and running. I discovered that the placement of the 3 electrodes on my body did not correspond to the notations on the wires. In my case, the lead marked "COM" goes to the left, "L" goes to the right and "R" goes to the left leg.
My approach was to program the Arduino to acquire the signal and transmit it to the Processing application running on the PC. There my be another way; use Processing to directly control the Arduino - link. Even better, it may be possible to eliminate the Arduino altogether and use the PC audio port to acquire the signal through Processing - see this Instructable.
Here are the source files for the Arduino simulator, Arduino signal acquisition and Processing signal display.