Wear Your Heartbeat on Your Sleeve

by EmotiBit in Circuits > Wearables

1006 Views, 6 Favorites, 0 Comments

Wear Your Heartbeat on Your Sleeve

heartbeat_still_image.png
EmotiBit_feather_charlie_2.jpg
heartEmoji-sqTrigger.png
on_finger_1920x1080.jpg
heartbeat_20200427_1sec_680px.gif

Show everyone you are human, even though you work like a Robot!

Use the PPG sensor on EmotiBit to detect your heartbeats and display them on an Adafruit CharliePlex FeatherWing!

How It Works

  • The EmotiBit firmware library communicates with the onboard PPG sensor (MAX30101) via I2C to get PPG data. The sensor has 3 different wavelengths that can easily be accessed by tweaking the stock example to provide different cardiovascular information. Code snippet below:
  • void loop()
    {  
      emotibit.update();   
      size_t dataAvailable = emotibit.readData(EmotiBit::DataType::PPG_INFRARED, &data[0], MAX_DATA_SIZE);   
      // do something cool with your data!
    }
  • The raw PPG data is then passed through a simple first-order lowpass (LP) IIR digital filter. This filtered signal acts as a threshold for the crossing detector (discussed next).

  • The crossing detector is created by comparing the raw PPG signal with the LP filtered threshold signal.

If the raw PPG signal goes above the threshold, the CharliePlex led matrix is turned ON. Conversely, when the raw PPG signal goes below the threshold, the display is turned OFF.

Above is a screen capture showing the trigger for the led matrix as the green square wave signal. The raw PPG signal is shown in blue and the LP filtered threshold signal is represented by the red line. Note that this is also mathematically equivalent to using a high-pass filter with a zero-crossing threshold.

Supplies

Download the EmotiBit Arduino Example

Get the EmotiBit FeatherWing firmware and dependencies via the Arduino Library Manager or in the EmotiBit FeatherWing github repo (see the full instructions and dependency list in the EmotiBit_Docs github repo).

Program the Feather

arduino_choosing_charlieplex_example.png

Program the Adafruit Feather with the following example: File>Examples>Emotibit FeatherWing>EmotiBit_examples>charlieplex_heartbeatOnSleeve

Stack It Up!

stacked_2.jpg
  1. Stack the Feather + EmotiBit + CharliePlex wing. Note that you will need stacking headers on your adafruit feather to assemble the whole setup.
  2. Plug in the battery.

Sense and Display

on_finger_1920x1080.jpg
heartEmoji-sqTrigger.png
heartbeat_20200427_1sec_680px.gif
  1. Wear the EmotiBit on your sleeve, finger, arm, or wherever you want!
  2. Wait for a few seconds for the signal to normalize. The heartbeat data is transmitted over serial as well -- open the Arduino Serial Plotter to see how the heartbeat detection works!
  3. And BOOM! DONE!! The CharliePlex Wing will blink with a heart Emoji whenever your heartbeat is detected.

Working With Other Biometrics

arrow_left.jpg
arrow_right.jpg

The EmotiBit has 16+ data streams available as individual data channels (see EmotiBit’s complete biometric data list here), all of which can be easily accessed from the Arduino example.

Use accelerometer data from EmotiBit and change the matrix display! Shown below is an example, where the accelerometer x-axis data is used to display arrows on the CharliePlex FeatherWing to indicate which direction you need to tilt the EmotiBit to make it level. Here’s a code snippet to control the display with accelerometer data:

void loop() {
  emotibit.update();
  size_t dataAvailable = emotibit.readData(EmotiBit::DataType::ACCELEROMETER_X, &data[0], MAX_DATA_SIZE);
  for (size_t i=0; i<dataAvailable; i++) {
    if (filter_lp.filter(data[i]) > 0.2) {
      // display left arrow
      emojibit.clear();
      emojibit.drawEmoji(EMOJI::ARROW_LEFT, 0);
    }
    // handle other cases
  }
}