How to gather data from the heart rate pulse sensor?

Hi,

I'm a newbie to the android and sensor programming. I just get a MetaMotionR board and a Heart Rate Pulse sensor and soldered them together with the following setup:

signal :  pin 8 (AIO0)
+          :  pin 11 (+3v)
-           :  pin 9 (AIO1)

Is this setup correct? I've seen the previous tutorials (404 now, and I saw them of the prior web cache) saying that the "negative" of the heart rate pulse sensor should be connected to pin 4 (GND).

Also, is there any sample code or mature project that I can use to log or stream the heart rate pulse sensor? I'm new to android, and it's complicated for me to code it from scratch. I found the Arduino code for the heart rate sensor here: 


But I have no idea how to port it into a MetaMotion sample project. Can anyone help?

Thanks,
Carlos



Comments

  • edited November 2017
    Your current pin configuration should be fine.  All your app needs to do is ground gpio 1 (pin 9) to turn on the pulse sensor, then read the values from gpio 0 (pin 8).  See this section in the Android documentation:
  • Hi Eric,


    May I ask which pin is ANO (AIO 0) and which is ANI (AIO 1)? I assumed that AIO 0 is pin 8 and AIO  1 is pin 9, but when I run a loop like this: 

    for (int i = 1; i <= 16; i++) {
    Gpio.Pin pin = gpio.pin((byte) i);

    if (pin == null) {
    Log.d("GPIO CHECK", "PIN " + i + " is NULL");
    } else {
    {Log.d("GPIO CHECK", "PIN " + i + " is NOT NULL");}
    }
    }
    I found that only pin 1 to pin 6 not null: 

     D/GPIO CHECK: PIN 1 is NOT NULL
     D/GPIO CHECK: PIN 2 is NOT NULL
     D/GPIO CHECK: PIN 3 is NOT NULL
     D/GPIO CHECK: PIN 4 is NOT NULL
     D/GPIO CHECK: PIN 5 is NOT NULL
     D/GPIO CHECK: PIN 6 is NOT NULL
     D/GPIO CHECK: PIN 7 is NULL
     D/GPIO CHECK: PIN 8 is NULL
     D/GPIO CHECK: PIN 9 is NULL
     D/GPIO CHECK: PIN 10 is NULL
     D/GPIO CHECK: PIN 11 is NULL
     D/GPIO CHECK: PIN 12 is NULL
     D/GPIO CHECK: PIN 13 is NULL
     D/GPIO CHECK: PIN 14 is NULL
     D/GPIO CHECK: PIN 15 is NULL
     D/GPIO CHECK: PIN 16 is NULL

    It seems that pin 8, 9 and 11 are not yet connected? Am I getting something wrong? 

    Wish you have a nice day!
  • Gpio pin numbering is not the same as the numbering in the pin layout.  Please see my previous post for the actual gpio numbers.
This discussion has been closed.