Polar Heart Rate Receiver project help

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mrdrako
 
Posts: 9
Joined: Tue Feb 19, 2013 1:30 pm

Polar Heart Rate Receiver project help

Post by mrdrako »

Hi all,

I bought the Polar heart rate receiver kit (PRODUCT ID: 1077) and hooked it up to a Raspberry Pi B+. My intent is to capture my minute-to-minute heart rate, store it in a mysql DB and view it on demand via lighttpd, all running on the raspi. Most of this is up and running, initial versions anyway. I have one python script running as a service which captures ONLY the now() timestamp of the rising edge of the sensor signal. My code is simply the following:

Code: Select all

#!/usr/bin/env python

import RPi.GPIO as GPIO
from time import sleep
import datetime

#set up GPIO using BCM numbering
GPIO.setmode(GPIO.BCM)

GPIO.setup(21, GPIO.IN, initial=GPIO.LOW, pull_up_down=GPIO.PUD_DOWN)

def beatRise(channel):
  print "Beat"
  with open('/home/pi/statfile.dat','a') as myfile:
    myfile.write(str(datetime.datetime.now()) + "\n")

GPIO.add_event_detect(21, GPIO.RISING, callback=beatRise)

while True:
  sleep(0.01)

GPIO.cleanup()
I realize this might not be the best, so am willing to take advice. But it does work, except for a minor annoyance: interference.

I'm not sure if the interference is actually coming through the sensor, or possibly just random noise caught on the GPIO pin itself. One thought is that I could add a toggle switch on the sensor line that I flip when I want to capture the heart rate, but if the pin is getting the interference rather than the sensor, then I don't see this as being a workable option.

I added the pull down resistor setting as a test, it did nothing and I left the code in there (it wasn't in my code originally).

I also thought about trying to capture both the rise and the fall of the transitions, as the recievers signal is supposed to be 15 ms in duration. I thought if the signal I got wasn't that duration, I could drop it as chatter. But it appears that you can only define one add_event_detection, and I cannot see if it is possible to call different callback functions for the rise and fall events.

So, I am asking for suggestions. Thanks in advance!

User avatar
mrdrako
 
Posts: 9
Joined: Tue Feb 19, 2013 1:30 pm

Re: Polar Heart Rate Receiver project help

Post by mrdrako »

Just a thought, I suppose another hardware alternative would be to add the toggle switch on a different input pin, and only run the heart rate sensor capture code if the toggle pin is HIGH...

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Polar Heart Rate Receiver project help

Post by adafruit_support_mike »

What kind of interference are you seeing?

User avatar
mrdrako
 
Posts: 9
Joined: Tue Feb 19, 2013 1:30 pm

Re: Polar Heart Rate Receiver project help

Post by mrdrako »

When there is no active transmitter in range, I'm getting notifications of low-to-high transitions. I had let it run overnight and found my log full of random detected heart beats.

While waiting for a forum reply, I did a test: I soldered a led and resistor to the ground and signal pads on the receiver board, and simultaneously disconnected to signal lead to my gpio pin. At times when I was watching the unit, I could see the occasional led light up. I let it run overnight again, and checked the logs in the morning...empty.

So it appears it is not anything happening at the gpio pin, instead the receiver unit itself is getting some type of interference. I have no way to determine the source of interference to the receiver, and I haven't seen any real specs on the unit to even know what frequency range is affected.

User avatar
mrdrako
 
Posts: 9
Joined: Tue Feb 19, 2013 1:30 pm

Re: Polar Heart Rate Receiver project help

Post by mrdrako »

To clarify, my empty log was when I had disconnected the signal lead from the gpio pin.

User avatar
mrdrako
 
Posts: 9
Joined: Tue Feb 19, 2013 1:30 pm

Re: Polar Heart Rate Receiver project help

Post by mrdrako »

And, an update. The interference appears to be coming from the raspi itself. :(

I have the pi enclosed within the clear case ( PRODUCT ID: 1997 ). I used two sided tape to adhere the receiver board within the case itself, to the lid. While the unit was powered on, and I had the case apart, with the receiver separated from the board only by the length of the jumper wires, so maybe 3 inches: minimal interference. I put the case back together, and the interference went back through the roof.

I guess I need an alternate mounting method. Which really ticks me off, to be honest. :(

Any suggestions on a shield, then?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Polar Heart Rate Receiver project help

Post by adafruit_support_mike »

Any high speed digital signal emits broadband radio noise. Putting the receiver directly over the RasPi would certainly cause glitches.

Shielding a device from radio signals on one side while accepting them from the other is always a challenge, but you might be able to do it with a sheet of copper clad connected to GND. Put that between the RasPi and the pulse sensor.

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

Return to “General Project help”