Adafruit is open and shipping! Let's build back better, together!
0

Get a CLUE about your Pulse :-)
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Get a CLUE about your Pulse :-)

by manor on Wed Feb 26, 2020 10:45 pm

CLUE_PULSE.png
CLUE_PULSE.png (212.46 KiB) Viewed 487 times

There is also a video where you can see and hear the Pulse being measured...
The overall effect is very "ER" :-)

This project used a Pulse Sensor and the ARCADA library.

I encountered the following two problems that by now have already been reported and (partially) solved:


For the second problem, here is what I was seeing in my Arduino IDE:
no_arcada_clue_test.png
no_arcada_clue_test.png (43.57 KiB) Viewed 487 times


whereas the supposed location looks like this:
supposed_location.png
supposed_location.png (23.79 KiB) Viewed 487 times


Overall this board is proving to be a lot of fun!

Manor.

manor
 
Posts: 11
Joined: Fri Mar 30, 2018 3:24 pm

Re: Get a CLUE about your Pulse :-)

by adafruit_support_bill on Thu Feb 27, 2020 5:57 am

Nice project! Thanks for posting :)

adafruit_support_bill
 
Posts: 79406
Joined: Sat Feb 07, 2009 10:11 am

Re: Get a CLUE about your Pulse :-)

by kevinjwalters on Mon Mar 02, 2020 5:30 am

You can also do a more basic version of this using the white LEDS on the CLUE, here's the reflected green being graphed from this in CircuitPython:
https://www.youtube.com/watch?v=flch_hw_Gc4&t=1m25s

kevinjwalters
 
Posts: 785
Joined: Sun Oct 01, 2017 3:15 pm

Re: Get a CLUE about your Pulse :-)

by manor on Wed Mar 04, 2020 2:23 am

kevinjwalters wrote:You can also do a more basic version of this using the white LEDS on the CLUE, here's the reflected green being graphed from this in CircuitPython:
https://www.youtube.com/watch?v=flch_hw_Gc4&t=1m25s


That is really cool!!! No Pulse Sensor and written in Python!

Unfortunately, the code below does not seem to yield values on the G channel anywhere near what you were getting and as a result the amplitude is about 1 bit (In general I need to put the CLUE right up against a light bulb in order to get G values in the low thousands).

This is the best I get with the builtin white light and the green (G) channel:

Green.png
Green.png (26.15 KiB) Viewed 388 times


And here is the code:

Code: Select all | TOGGLE FULL SIZE
#include "Adafruit_Arcada.h"
#include <Adafruit_APDS9960.h>

Adafruit_Arcada arcada;
Adafruit_APDS9960 apds9960;

#define WHITE_LED 43

// The SetUp Function:
void setup() {
   Serial.begin(115200);
  if (!arcada.arcadaBegin()) {
    Serial.print("Failed to begin");
    while (1);
  }

  pinMode(WHITE_LED, OUTPUT);
  digitalWrite(WHITE_LED, LOW);

  if (!apds9960.begin()) {
    Serial.println("No APDS9960 found");
  } else {
    apds9960.enableColor(true);
  }
}

// The Main Loop Function
void loop() {
  uint16_t r, g, b, c;
  //wait for color data to be ready
  while(! apds9960.colorDataReady()) {
    delay(5);
  }
  apds9960.getColorData(&r, &g, &b, &c);
  Serial.print("G: "); Serial.println(g);
 
  uint8_t pressed_buttons = arcada.readButtons();
 
  if (pressed_buttons & ARCADA_BUTTONMASK_B) {
    digitalWrite(WHITE_LED, HIGH);
  }
  if (pressed_buttons & ARCADA_BUTTONMASK_A) {
    digitalWrite(WHITE_LED, LOW);
  }
}

Attachments
builtin_pulse.ino
(981 Bytes) Downloaded 6 times

manor
 
Posts: 11
Joined: Fri Mar 30, 2018 3:24 pm

Re: Get a CLUE about your Pulse :-)

by kevinjwalters on Wed Mar 04, 2020 8:02 am

The APDS9960 sensor which is the one on the CLUE has a few settings that influence the output value. The two I've noticed for colour are the time over which it collects light per sample and a gain (multiplier) for reading that integrated value. You can see these being set in this C/Arduino example code which you can run once to set the values:

Code: Select all | TOGGLE FULL SIZE
      apds9960.setADCIntegrationTime(3);   // milliseconds
      apds9960.setADCGain(APDS9960_AGAIN_64X);


from https://github.com/adafruit/Adafruit_Ar ... #L179-L180

The values can be set in the CircuitPython library but the integration_time is a raw sensor value. I'm not sure if there are symbols for the gain values too forcing use of raw numbers from data sheet or C/Arduino library.

kevinjwalters
 
Posts: 785
Joined: Sun Oct 01, 2017 3:15 pm

Re: Get a CLUE about your Pulse :-)

by manor on Wed Mar 04, 2020 3:55 pm

yup.png
yup.png (694.62 KiB) Viewed 361 times

Thanks Kevin!!! It's officially calibrated and confirmed: the CLUE has enough built-in sensors to measure heart rate!
(the correlation between the signals can be seen here)

In hindsight, there's also the built-in microphone :)

"There must be 50 ways..." to measure your pulse on a CLUE.

Manor.

manor
 
Posts: 11
Joined: Fri Mar 30, 2018 3:24 pm

Re: Get a CLUE about your Pulse :-)

by kevinjwalters on Wed Apr 01, 2020 8:42 pm

The dual plot is very cool.

I finished the guide this week and it was published today if you're interested in the python code: Adafruit Learn: CLUE Sensor Plotter in CircuitPython.

kevinjwalters
 
Posts: 785
Joined: Sun Oct 01, 2017 3:15 pm

Please be positive and constructive with your questions and comments.