Polar heart rate receiver

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
joeycampbell60
 
Posts: 3
Joined: Fri Feb 26, 2016 6:57 am

Polar heart rate receiver

Post by joeycampbell60 »

Hi I have purchased the heart rate receiver that works with the Polar chest strap. I want to try and determine the heart rate numerically but I am unable to locate a sample sketch to show this. All I can find is this sketch but it only outputs the word 'beat' at every heart beat (http://learn.parallax.com/node/386). Can anyone send me a link of a sketch for use with this product: https://www.adafruit.com/product/1077

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Polar heart rate receiver

Post by Franklin97355 »

This code:

Code: Select all

 sample = digitalRead(HR_RX);  //Store signal output 
  if (sample && (oldSample != sample)) {
    Serial.println("Beat");
    heartBeat();
Prints a "Beat" every heartbeat. You can use the same code to figure out the rate by measuring the time between pulses or counting pulses over a measured time.

User avatar
mbeldar
 
Posts: 7
Joined: Fri Feb 24, 2017 3:21 pm

Re: Polar heart rate receiver

Post by mbeldar »

I am only getting bit 0 from sensor's receiver. what might be the problem? PLEASE HELP

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Polar heart rate receiver

Post by Franklin97355 »

I am only getting bit 0 from sensor's receiver. what might be the problem? PLEASE HELP
Don't know. Post the code you are running. Please use

Code: Select all

 tags when posting code or logs to the forums by clicking the </> button above the reply box and pasting your code between the tags created. Could you post large (less than 1meg), clear, detailed pictures of both sides of your board showing any soldering you have done and the connections to it?

User avatar
mbeldar
 
Posts: 7
Joined: Fri Feb 24, 2017 3:21 pm

Re: Polar heart rate receiver

Post by mbeldar »

Code: Select all

//Definitions  
const int HR_RX = 8;
byte oldSample, sample;

void setup() {
  Serial.begin(9600);
  pinMode (HR_RX, INPUT);  //Signal pin to input  
  pinMode (8, OUTPUT);  //Signal pin to input  
  
  Serial.println("Waiting for heart beat...");

  //Wait until a heart beat is detected  
  //while (!digitalRead(HR_RX)) {};
 // Serial.println ("Heart beat detected!");
  
}
int count=0;
float avg=0.0;
float total=0.0;
int max1=0;
int min1 = 999;
int br = 0;
void loop() {
 
  br++;
  //sample = digitalRead(HR_RX);
  sample = analogRead(A0);//Store signal output 
  if (sample && (oldSample != sample)) {
    
    if(min1>sample)
    min1 = sample;
    if(max1<sample)
    max1 = sample;
    
   // Serial.println(min1);
    Serial.println(sample);
     delay(2);
   // Serial.println(max1);
    total = sample + total;
    count++;
  
    if(count%200==0)
    {
    avg = total/count;
    total = 0;
    count = 1;
    }

  }
      digitalWrite(8, LOW);
  oldSample = sample;           //Store last signal received 
  if(br==100000 )
    while (true) {};
    
}
Last edited by mbeldar on Sun Feb 26, 2017 4:41 pm, edited 1 time in total.

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Polar heart rate receiver

Post by Franklin97355 »

How do you have things connected? Can you post pictures?

User avatar
mbeldar
 
Posts: 7
Joined: Fri Feb 24, 2017 3:21 pm

Re: Polar heart rate receiver

Post by mbeldar »

WhatsApp Image 2017-02-26 at 2.37.14 PM.jpeg
WhatsApp Image 2017-02-26 at 2.37.14 PM.jpeg (223.69 KiB) Viewed 645 times
WhatsApp Image 2017-02-26 at 2.37.15 PM.jpeg
WhatsApp Image 2017-02-26 at 2.37.15 PM.jpeg (276.27 KiB) Viewed 645 times

Code: Select all

int sensorPin = 0;
double alpha = 0.75;
int period = 100;
double change = 0.0;
double minval = 0.0;
 int c=0;
void setup ()
{
  pinMode(8, INPUT);
  Serial.begin (9600);
  c=0;
}

 
    static double oldValue = 0;
    static double oldChange = 0;
 
void loop ()
{
  c++;
    int rawValue = digitalRead (8);
    
    //double value = alpha * oldValue + (1 - alpha) * rawValue;
 
   if(rawValue!=0)
  {
    Serial.println (rawValue);
    Serial.println (c);}
    oldValue = rawValue;;
 
   // delay (period);
}

User avatar
mbeldar
 
Posts: 7
Joined: Fri Feb 24, 2017 3:21 pm

Re: Polar heart rate receiver

Post by mbeldar »

Strange things is happening!
When I am putting strap on my chest there is no signal. But when I tap it on table it's giving me the output as 1.

The problem is definitely with the belt.

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Polar heart rate receiver

Post by Franklin97355 »

You might also redo the soldering on the top pin.

User avatar
mbeldar
 
Posts: 7
Joined: Fri Feb 24, 2017 3:21 pm

Re: Polar heart rate receiver

Post by mbeldar »

Issue got resolved. :)

The problem was, my skin was dry. When I applied some gel on it, its working like charm

User avatar
mbeldar
 
Posts: 7
Joined: Fri Feb 24, 2017 3:21 pm

Re: Polar heart rate receiver

Post by mbeldar »

One quick question.
Will this sensor give ECG data.
The one with which you can plot the data?

User avatar
asteroid
 
Posts: 300
Joined: Tue Oct 22, 2013 9:10 pm

Re: Polar heart rate receiver

Post by asteroid »

>Will this sensor give ECG data.

Not to my knowledge. If you want to display electrical activity, here's one way:

https://www.youtube.com/watch?v=pbVGKQp ... e=youtu.be

Requires an Arduino UNO, Olimex EKG Shield, and an Adafruit 2.8" TFT screen.

User avatar
habibim
 
Posts: 1
Joined: Sun Mar 12, 2017 12:32 am

Re: Polar heart rate receiver

Post by habibim »

Hello, I purchased the Heart Rate Educational Starter Pack with Polar Wireless Sensors (https://www.adafruit.com/product/1077) two weeks ago. And I have not been able to make it work. The problem is that the receiver output is 0 all the time. I am not sure if the problem is transmitter or receiver? is there any way to test them individually?
Thank you

User avatar
jbf
 
Posts: 21
Joined: Thu Dec 04, 2014 8:24 pm

Re: Polar heart rate receiver

Post by jbf »

I am having the exact same issue.

Ive tried everything.

I get random pulses in my processing sketch with the receiver and sensor near one another (and sensor attached) but heart rate only randoly is accurate. Intermittent pulses.

When remove heart rate sensor from my chest, it still gives me a similar pattern of pulses intermittently.

Disconnecting the receiver and it stops pulsing.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”