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.
Hi,
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
beats=WhatverFunctionIsCalledForTheMonitorReading();
heartBeats[i]=beats;
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)
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.
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.
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.