Heart Rate Logger


I have interfaced my Arduino board to one of those wireless watch/heart rate monitors and am trying to produce a data logger that will log heart rate over something like a 12 hour period and be able to upload the data to a PC for analysis. I want to know what happens to my heart rate as I sleep :)

Has anyone any experience or info they can point me at that will help me create some code that will both allow me to average the pulse by pulse heart rate readings I am receiving and store them away for later retrieval please? Maybe I can log average heart rate readings every 30 seconds so will end up with 1440 readings in a 12 hour period. Some sort of time stamp would be useful too so I can when the heart rate changes occur.

I have mega168 Arduinos.


since youre heartrate is not likely to go beyond 255 while you’re sleeping, a single reading fits into a byte. You should be able to store all the readings on the arduino itself, since this would a little bit more than 1 kb.

//here we store the data
byte heartBeats[1440];

for(int i=0;i< 1440;i++) {
  //Receive the heartbeats for the last 30 seconds from the monitor
  delay(30000);  //Wait 30 seconds

When you wake up you connect the arduino to your computer and send the data one by one with Serial.Write()
This way you don’t have to sleep beside your notebook- (or worse your desktop-) fan.

When you save your data every 30 seconds, you can simply write down the time when you went to bed, otherwise you have to add a real time clock chip to your arduino. (Code for this is somewhere in the playground-section)


Thanks Eberhard

I guess if I need some sort of more perminent storage I will need to add some EEPROM and maybe an external clock. I have a feeling that I saw a chip that has both at some point in the past. How does the Arduino use the AVRs EEPROM? I could maybe use the 512 bytes and sample less frequently. Or maybe I could use the self programmable FLASH? I'm not sure how though.

Thinking about it, doesn't the Arduino code use SRAM for variable storage as well as other house keeping variables? In which case the 1K in the mega168 won't be enough for the heartbeats() variable will it? SDRAM is also used for the stack too I think.

Anyway I'll make a start with just the AVR processor and work on some start/stop, data transfer and averaging code.


you could use this http://apple.clickandbuild.com/cnb/shop/ftdichip?op=catalogue-products-null&prodCategoryID=53&title=VDIP1 to write to a usb memory stick.

I have code that works with arduino and the dallas rtc to give time info - I am finishing it and tidying it, but will post to the playground with it soon.



That looks very interesting, thanks. I'll look out for your code.



do you have the hardware yet for reading the heart rate? It can be very difficult to do. the only reliable way I have seen is with a Polar brand wireless monitor that was hacked to get the heart rate pulse. The other methods, ECG type and Pulse oximitry ( shining alight through a finger and reading the light that emergesz on the other side of the finger) don't work very well for pateints that move around. Pulse oximetry looks simple but in reality when you move your arm, there is a rush of blood that screws up the reading. I built a project like this once and after a few months of working on it concluded that yes, there is a reason that a medical grade heart-rate monitor costs thousands of dollars! :)


Yes I have hacked a chest band wireless wrist watch heart rate monitor. I get a good reliable rate and as I am only really interested to see if the rate changes, it will do the job well.


ah you are smarter than I am then... you jumped right to the only reliable method :)

Ok I finally got round to putting up my bit of test code for the usb memory stick


Thanks Nick. That looks great.

Hope its of use to people.

Should get the time of day stuff sorted for next week too.

Ok I finally got round to putting up my bit of test code for the usb memory stick


Dude, that is seriously awesome. I would buy the module, but shipping to australia is a killer! Will have to look around for other suppliers.

Thanks for the link and the code.

try here


Ok this evening I finally got the date stamp to work - so the log file tonight has a modification date of 16th Oct 2007 22.37.

Will put up the code tomorrow once I have tidied it up.

Hi, can you share how you hacked the wireless HRM? I need to do something similar and don't know how yet to approach it. Will it kill my HRM?