Heartrate Orb

by TheSolarFlare in Craft > Art

18 Views, 0 Favorites, 0 Comments

Heartrate Orb

arduino sketch.png
silly6.jpg

For this assignment, I wanted to make something that had to do with a heartrate. During that time I was dealing with stressful situations and I want to somehow bring that back into my work.

I thought about this idea further as I looked into heartrate Arduino projects and realized that this interests also crosses with my fascination about diving. Specifically the dangers of diving. Keeping calm is one if not the most important thing to do while you're submerged in water meters down.


The end product

A strange piece of coral holding a sea creature egg was the concept. Placing your finger down onto a heart rate sensor with some pressure makes it so that the egg lights up according to your heartrate. Calculating the time between heartbeats and reading the average. It lights up and almost copies your heartrate. Not fully accurately but close enough to make the egg look alive.


Supplies

Electronic components

  1. MAX30102 Oximeter Heart Rate Beat Pulse Sensor Module Arduino STM32 Project
  2. Arduino Uno
  3. Resistor 220 ohm
  4. Red LED
  5. Buzzer

Materials used for the housing

  1. Terracotta clay to shape and to house the Arduino
  2. Paper to add in some details
  3. Black and white acrylic paints
  4. White balloons to cover the plastic ball for a fleshy look
  5. Hard plastic see-through ball that was used to hold awful old candy
  6. Plastic little rocks for texturing

Tools used

  1. My bare hands when dealing with terracotta
  2. Soldering iron

Initial Ideas

arduino sketch 1.jpg
silly2.jpg

The first initial idea (see the sketch above)

was to make it that you could wear scuba goggles while keeping your thumb on top of the heart rate sensor. If your heart rate was too high, it would start flashing lights within the goggles and blast annoying sounds into your ears. Bringing you into a stressful situation all around while you try to calm yourself down.

With this I wanted to give the experience of a panic attack underwater and needing to calm yourself down.

The second idea

was to make a opening and closing flower. This was inspired by one of my concept designs for Building playful worlds assignment. I created a underwater environment where this red coral blooms. With that in mind, I wanted to try recreating it. It opens up as the player walks closer. The more fear/the higher the heartrate the player has the more it opens up.

To create that I tried using a ball with a bunch of little "petals" on it. Pulling /pushing down on it makes it so that the petals open and close on each other. (see video)

This was later discontinued mainly due to the lack of time and resources but kept in mind for possible future fun silly projects.


Keeping It Simple But Not Stupid

Using the LED from initial idea 1 and the stationary object from idea 2; I combined what I had together and made the final concept.

The coral will now blink according to the heartbeat instead of opening and closing.



Code


#include <Wire.h>
#include "MAX30105.h"
#include "heartRate.h"

MAX30105 particleSensor;

const byte RATE_SIZE = 4; // Increase this for more averaging. 4 is good.
byte rates[RATE_SIZE]; // Array of heart rates
byte rateSpot = 0;
long lastBeat = 0; // Time at which the last beat occurred
int lightValue = 0;
float falloffDuration = 500;

long oldTime;

float beatsPerMinute;
int beatAvg;

// LED pin
const int ledPin = 9;

// Thresholds for heart rate
int lowThreshold = 60; // Example: Low heart rate threshold
int highThreshold = 100; // Example: High heart rate threshold

void setup() {
pinMode(ledPin, OUTPUT); // Set LED pin as output

Serial.begin(115200);
Serial.println("Initializing...");

// Initialize sensor
if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) {
Serial.println("MAX30102 was not found. Please check wiring/power.");
while (1);
}
Serial.println("Place your index finger on the sensor with steady pressure.");

particleSensor.setup(); // Configure sensor with default settings
particleSensor.setPulseAmplitudeRed(0x0A); // Turn Red LED to low to indicate sensor is running
particleSensor.setPulseAmplitudeGreen(0); // Turn off Green LED
}

int EaseOut(int value, float delta)
{
float diff = pow(value / 255.0, 1.0 / 3.0);
diff = max(0, diff - delta / falloffDuration);
Serial.println(diff);
return diff * diff * diff * 255;
}

void loop() {
long irValue = particleSensor.getIR();

long currentTime = millis();
float delta = currentTime - oldTime;
oldTime = currentTime;
if (lightValue > 0)
{
lightValue = EaseOut(lightValue, delta);
analogWrite(ledPin, lightValue);
}

if (checkForBeat(irValue) == true) {
// We sensed a beat!
long beatDelta = currentTime - lastBeat; // Calculate time between beats
lastBeat = currentTime;

lightValue = 255;
analogWrite(ledPin, lightValue); // Half brightness for slow blinking
beatsPerMinute = 60 / (beatDelta / 1000.0); // Convert time between beats to bpm

if (beatsPerMinute < 255 && beatsPerMinute > 20) { // Remove anomalies from the average
rates[rateSpot++] = (byte)beatsPerMinute; // Store reading in array
rateSpot = rateSpot % RATE_SIZE; // Wrap variable

// Take average of readings
beatAvg = 0;
for (byte x = 0; x < RATE_SIZE; x++) {
beatAvg = beatAvg + rates[x];
}
beatAvg = beatAvg / RATE_SIZE;
}
}

Testing

Placement - Soldered - housed

... Was That Clay?

silly.jpg
Screenshot 2024-10-07 224757.png
silly5.jpg
silly6.jpg

Yes that was clay! It looks scuffed but it did the job!

Given the little time I had along with personal things I had to deal with; I couldn't get my hands on a 3d printer to print my first initial housing for the Arduino. Most of them were already busy with projects or out of order.

So why not bring back the primal times of 3d modeling?


Polishing the scuffed looking clay

Applied some paint and silly little rocks for texturing to hide the ugly terracotta and actually make something more presentable.