Wear Your Heartbeat on Your Sleeve
by EmotiBit in Circuits > Wearables
1119 Views, 6 Favorites, 0 Comments
Wear Your Heartbeat on Your Sleeve
![heartbeat_still_image.png](/proxy/?url=https://content.instructables.com/FBW/A3L6/KOIM82KU/FBWA3L6KOIM82KU.png&filename=heartbeat_still_image.png)
![EmotiBit_feather_charlie_2.jpg](/proxy/?url=https://content.instructables.com/F8D/DM67/KOCWFIR6/F8DDM67KOCWFIR6.jpg&filename=EmotiBit_feather_charlie_2.jpg)
![heartEmoji-sqTrigger.png](/proxy/?url=https://content.instructables.com/FZ5/23XQ/KO3921YL/FZ523XQKO3921YL.png&filename=heartEmoji-sqTrigger.png)
![on_finger_1920x1080.jpg](/proxy/?url=https://content.instructables.com/FKU/WH8W/KO3921NU/FKUWH8WKO3921NU.jpg&filename=on_finger_1920x1080.jpg)
![heartbeat_20200427_1sec_680px.gif](/proxy/?url=https://content.instructables.com/F0H/TML8/KOIM82E6/F0HTML8KOIM82E6.gif&filename=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
1 × EmotiBit
1 × Adafruit CharliePlex FeatherWing
1 × 400mAh Battery
1 × High-speed microSD card (U3 recommended)
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](/proxy/?url=https://content.instructables.com/F8U/2G6D/KO3924XD/F8U2G6DKO3924XD.png&filename=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](/proxy/?url=https://content.instructables.com/F05/JCRJ/KO392568/F05JCRJKO392568.jpg&filename=stacked_2.jpg)
- Stack the Feather + EmotiBit + CharliePlex wing. Note that you will need stacking headers on your adafruit feather to assemble the whole setup.
- Plug in the battery.
Sense and Display
![on_finger_1920x1080.jpg](/proxy/?url=https://content.instructables.com/FKU/WH8W/KO3921NU/FKUWH8WKO3921NU.jpg&filename=on_finger_1920x1080.jpg)
![heartEmoji-sqTrigger.png](/proxy/?url=https://content.instructables.com/FUD/JZYR/KOCWFM6Z/FUDJZYRKOCWFM6Z.png&filename=heartEmoji-sqTrigger.png)
![heartbeat_20200427_1sec_680px.gif](/proxy/?url=https://content.instructables.com/FN9/5Q6Q/KOCWFMUA/FN95Q6QKOCWFMUA.gif&filename=heartbeat_20200427_1sec_680px.gif)
- Wear the EmotiBit on your sleeve, finger, arm, or wherever you want!
- 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!
- And BOOM! DONE!! The CharliePlex Wing will blink with a heart Emoji whenever your heartbeat is detected.
Working With Other Biometrics
![arrow_left.jpg](/proxy/?url=https://content.instructables.com/FZU/1V8A/KO392686/FZU1V8AKO392686.jpg&filename=arrow_left.jpg)
![arrow_right.jpg](/proxy/?url=https://content.instructables.com/FQF/JQ16/KO39269Z/FQFJQ16KO39269Z.jpg&filename=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 } }