Grove - Finger-clip Heart Rate Sensor with shell

Hello,

I’m trying to make this sensor work on a grove map, but the python code is bad. Do you have C code that would work? Or, a Python solution to my problem?

My config :
Raspbian : stretch
Latest grove API
RaspBery PI2

Regards,
Bruno

http://wiki.seeed.cc/Grove-Finger-clip_Heart_Rate_Sensor_with_shell/

Hello,

Python script fail, i have make :

**i2cdetect -y 1**
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

And : sudo avrdude -c gpio -p m328p -e

And script is :

import time,sys
import RPi.GPIO as GPIO
import smbus

class HeartbeatSensor(object):

    def __init__(self):
        """
        Connect to an I2C port.
        """
        rev = GPIO.RPI_REVISION
        if rev == 2 or rev == 3:
            self.bus = smbus.SMBus(1)
        else:
            self.bus = smbus.SMBus(0)
        self.address = 0x50

    def get(self):
        """
        Returns the heart rate of the wearer.
        :return: Integer
        """
        return self.bus.read_byte(0x50)

if __name__ == "__main__":

    pulse = HeartbeatSensor()
    while True:
        try:
            rate = pulse.get()
            print(rate)
        except IOError:
            print("Error")
        time.sleep(5)

When i am running this script :

128
128
0
128
0
0
216
219
91
Error
Error
Error
Error
169
Error
Error
Error
Error
Error
Error
Error

After i run :

**i2cdetect -y 1**                                
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

I loose the i2c device ! Do you have an idea ?

Regards,
Bruno

Hi @bguegan974,

I’m looking onto their site and it says you need to burn both the bootloader and the firmware onto it. I assume it has to do with that. But that’s just a gut feeling.

Also, if I were, I’d double check the wires and see if they match with whatever they’re showing onto their page. Even more than that, the following citation could explain why you’re not getting anything:

(1)Fasten the sensor snugly makes tight contact with your skin and maintain table (no motion) while measuring to acquire accurate heart rate. If the sensor does not contact the skin well or have extreme motion while measuring that the heart rate will not be measured correctly.

Have you thought of contacting Seeed for this? They ought know more than us and we never (and I personally) never worked with this sensor.

Thank you!