Lauren BusserLinnette Martinez
Published

Hygge Gauntlet

The Hygge Gauntlet is a handknit gauntlet that uses a heartrate variability sensor to emit color therapy based on the wearer’s stress levels

IntermediateProtip17 hours473
Hygge Gauntlet

Things used in this project

Hardware components

Flora
Adafruit Flora
×1
Flora RGB Neopixel LEDs- Pack of 4
Adafruit Flora RGB Neopixel LEDs- Pack of 4
×2
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
×1
Adafruit Pulse Sensor Amped
×1
nLiten Forward-Emitting 10 LED strip
nLITEn Tech nLiten Forward-Emitting 10 LED strip
×1
nLITEn Controller
nLITEn Tech nLITEn Controller
×1

Software apps and online services

Arduino IDE
Arduino IDE
using Adafruit Libraries to connect the wearable microcontrollers.

Hand tools and fabrication machines

Sewing Needle
Yarn
Conductive Thread
Cotton Fabric
Scrap Yarn

Story

Read more

Schematics

Flora Connections

Flora schematic

Design Schematic

A sketch for how all the components are connected.

Design Schematic 2

Code

HyggeGauntlet.ino

C/C++
/*  HyggeGauntlet 
 *  Wearables 
 *  Authors: Linnette Martinez and Lauren Busser
--------------------------------------------------------------------*/

#define USE_ARDUINO_INTERRUPTS true    // Set-up low-level interrupts for most acurate BPM math.

//Libraries
#include <PulseSensorPlayground.h>     // Includes the PulseSensorPlayground Lib  
#include <Adafruit_NeoPixel.h>         // NeoPixels lib

//  Variables
const int PulseWire = 10;       // PulseSensor connected to ANALOG PIN 10
const int blinkLED = 12; 
const int stripPin = 12;  
int fadePin  = 8;   
int fadeRate = 255; 
boolean fadeCheck = false;    
int myBPM;
int Threshold = 550;           

PulseSensorPlayground pulseSensor;  // Creates an instance of the PulseSensorPlayground object 

// Set up use of NeoPixels
const int NUMPIXELS = 5;            // Put the number of NeoPixels you are using here
const int BRIGHTNESS = 50;          // Set brightness of NeoPixels here
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, stripPin, NEO_GRB + NEO_KHZ800);

void setup() {   

  Serial.begin(9600);     

  // Configure the PulseSensor object, by assigning our variables to it. 
  pulseSensor.analogInput(PulseWire);   
  pulseSensor.blinkOnPulse(blinkLED);       //auto-magically blink LED with heartbeat.
  pulseSensor.setThreshold(Threshold);   

  //setup NeoPixels
   strip.begin();
   strip.setBrightness(BRIGHTNESS);
   //for (int x=0; x < NUMPIXELS; x++) {  // Initialize all pixels to 'off'
   // strip.setPixelColor(x, strip.Color(0, 0, 0));
   //}
   strip.show();

  // Double-check the "pulseSensor" object was created and "began" seeing a signal. 
   if (pulseSensor.begin()) {
    Serial.println("We created a pulseSensor Object !");  //This prints one time at power-up,  or reset.  
  }
} //end setup function

void loop() {

  myBPM = pulseSensor.getBeatsPerMinute();  // sets BPM value

  // Constantly test to see if "a beat happened" and prints to Serial Monitor
  if (pulseSensor.sawStartOfBeat()) {         
   Serial.println("  A HeartBeat Happened ! "); 
   Serial.print("BPM: ");                        
   Serial.println(myBPM); 
  
   fadeCheck = true; 
   ledFade(); 
  
   if (fadeCheck == true){                    
       fadeRate = 255;                  // Set 'fadeRate' Variable to 255 to fade LED with pulse
       fadeCheck = false;                       
   }
   //heartBeat();                       
  } // if pulse reading beat

  //Set a default display color
  for (int i=0; i < NUMPIXELS; i++){
      strip.setPixelColor(i, strip.Color(0, 20, 20)); 
  }
  strip.show();

  delay(20);               
} //end loop function

void ledFade (){  //attempt of adding a fade effect
  fadeRate -= 15;                         
  fadeRate = constrain(fadeRate,0,255);
  setHeart(fadeRate); 
}

void setHeart(int fa){
  //initilize the R,G,B values
  //tested how BPM effected color combinations
  int r = (myBPM - 60) * 2 ;  
  int g = 300 - myBPM ;
  int b =  myBPM + fa;

  //set a contrain in case calculation went above max color value of 255
  if(g > 255) {  g = 255; }
  if(r > 255) {  r = 255; }
  if(b > 255) {  b = 255; }

  // Set specific thresholds to emit specific soothing colors
  // Checks BPM and sets color combination accordingly 
  if (myBPM <= 63){ //orange
    r = 255;
    g = 69;
    b = 0;  
  }
  if (myBPM > 63 && myBPM <= 70){ //Light Pink
    r = 255;
    g = 204;
    b = 255;  
  }
  if (myBPM > 70 && myBPM <= 90){ //Light Blue
    r = 47;
    g = 141;
    b = 255;  
  }
  if (myBPM > 90){  //Purple
    r = 213;
    g = 128;
    b = 255;  
  }
  //Set specified colors to each NeoPixel
  for (volatile int i=0; i < NUMPIXELS; i++){
      strip.setPixelColor(i, strip.Color(r, g, b)); 
      delay(100);
  }
  strip.show(); //Display colors
  delay(3000);  //Hold for 3 seconds
}

//fuction to display heartbeat. Not called for the purpose of this application
void heartBeat (){

for (volatile int i=0; i < NUMPIXELS; i++){
      strip.setPixelColor(i, strip.Color(255, 0, 0)); 
    }
    strip.show();
    delay(100);
}

Credits

Lauren Busser

Lauren Busser

1 project • 3 followers
Linnette Martinez

Linnette Martinez

0 projects • 2 followers

Comments