Ear-Clip Sensor Python Help


I’m trying to use to the ear-clip sensor (http://wiki.seeedstudio.com/wiki/Grove_-_Ear-clip_Heart_Rate_Sensor) but impossible to find sample code for GrovePi+ & Python. the only one code is for Arduino/C with interupt… and some scientist conversion :). I’m not sure to know if I have to connect it on Digital port (Wiki sample with arduino) or on Analog port :frowning:

Some Body can help me to use this sensor please ?

Thank you


more information about my issue :
I used both method to see what’s happening… :slight_smile: Digital/Analog Read functions (D7/A0 port).
Yes… I connected sensor on digital and on Analogic port… :slight_smile:

I used 2 python scripts.
One reading values comming from D7 port and another one reading values comming from A0 port.

and in both modes, I can see data changing like a heartbeat :
in D7 mode, of cource, the 1 value seems to correspond to my heartboard
in A0 mode, same with 1023 or 1022 values but more accurate

in my scripts, I do not use time.sleep function in the loop.

Thank you.


Hi brett13,
I was looking for more documentation for that sensor and was unable to find that selling anywhere and they might have replaced it with this: http://seeedstudio.com/Grove---Finger-clip-Heart-Rate-Sensor-p-2425.html. The sample code for the older sensor looks pretty hard to implement too with the GrovePi.

Where did you buy it from and can you try to get it replaced if possible.



I Karan,
thanks for your answer. I bought it on internet site and I met seller about that… it seem that this sensor still sold in the gorvepi+ world…

I created a python code to get heart rate based on time (15, 30, or 60s) and make multiplication… I’m not happy of this solution too simple and too long…

now I looking for detect how many milliseconds there are between two 1 value to calculate the realtime heart rate and stop to use fixed values but I’m fighting with time varibales conversion/operation :(.

I Put myCode in case of someone have same issue than me with ear-clip sensor.

thank you


this python file renamed.


some issue to upload file… in rar now…


Hi brett,
I think the code on the GrovePi that you have written is just too slow to respond to changes in the signal, and nothing much can be done without fiddling with the firmware. Thanks for posting the sensor. Maybe someone else would have the same sensor and they can use this as a starting point to make the sensor compatible with the GrovePi.



Hi, I also have a Seeed “Grove - Ear-clip Heart Rate Sensor” and I am looking for any python examples on how to get any data from it on raspberry with GrovePi. It is connected to digital port.

Seeed Studio wiki provides only an example for arduino… http://wiki.seeedstudio.com/wiki/Grove_-_Heart_rate_ear_clip_kit. Any help highly appreciated. @brett13 - for some reason I can’t see your code uploaded.