Tools & Supplies
- Polar Wireless heart sensor educational starter pack
- FLORA main board
- 150 mAh lipoly battery (with charger)
- Eight FLORA NeoPixels or 8x8 LED matrix w i2c backpack
- Magnetic pin back
- Sugru
- Thin stranded wire
- Double-stick tape or foam
Upgrading to a higher end soldering iron setup, like the Hakko FX-888 that we stock in our store, will make soldering fun and easy.
Do not use a "ColdHeat" soldering iron! They are not suitable for delicate electronics work and can damage the Flora (see here).
Click here to buy our entry level adjustable 30W 110V soldering iron.
Click here to upgrade to a Genuine Hakko FX-888 adjustable temperature soldering iron.
Learn how to solder with tons of tutorials!
Click here to buy a spool of leaded solder (recommended for beginners).
Click here to buy a spool of lead-free solder.
Click here to buy a basic multimeter.
Click here to buy a top of the line multimeter.
Click here to buy a pocket multimeter.
Don't forget to learn how to use your multimeter too!
Circuit Diagram
Build Circuit
If using the LED matrix instead, solder it up according to the LED Backpack guide, then wire it to FLORA's 3.3v, SCL, SDA, and GND pins according to the circuit diagram.
Program it
/* Heart Rate Badge with heart-shaped neopixel display written by Becky Stern for Adafruit Industries Based on sample code from http://learn.parallax.com/KickStart/28048 */ #include <Adafruit_NeoPixel.h> // Parameter 1 = number of pixels in strip // Parameter 2 = pin number (most are valid) // Parameter 3 = pixel type flags, add together as needed: // NEO_RGB Pixels are wired for RGB bitstream // NEO_GRB Pixels are wired for GRB bitstream // NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels) // NEO_KHZ800 800 KHz bitstream (e.g. High Density LED strip) Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, 12, NEO_GRB + NEO_KHZ800); //Definitions const int HR_RX = 2; byte oldSample, sample; void setup() { strip.begin(); strip.show(); // Initialize all pixels to 'off' colorWipe(strip.Color(20, 0, 0), 50); // Red Serial.begin(9600); pinMode (HR_RX, INPUT); //Signal pin to input Serial.println("Waiting for heart beat..."); // Wait until a heart beat is detected while (!digitalRead(HR_RX)) {}; Serial.println ("Heart beat detected!"); } void loop() { sample = digitalRead(HR_RX); //Store signal output if (sample && (oldSample != sample)) { Serial.println("Beat"); heartBeat(); } oldSample = sample; //Store last signal received for (volatile int i=0; i<strip.numPixels(); i++){ strip.setPixelColor(i, strip.Color(20, 0, 0)); } strip.show(); } // Fill the dots one after the other with a color void colorWipe(uint32_t c, uint8_t wait) { for(uint16_t i=0; i<strip.numPixels(); i++) { strip.setPixelColor(i, c); strip.show(); delay(wait); } } void heartBeat (){ Serial.println("heartbeat"); for (volatile int i=0; i<strip.numPixels(); i++){ strip.setPixelColor(i, strip.Color(255, 0, 0)); } strip.show(); delay(10); }
Here's some code for a different version of the badge, using our i2c 8x8 matrix display. It scrolls your current beats per minute across the display, great for taking with you on your workout. You will need the GFX Library, Adafruit BusIO and the LED Backpack Library.
/* Heart Rate Badge with 8x8 i2c matrix displays beats per minute written by Becky Stern for Adafruit Industries BPM calculation adapted from http://randomcontent.wolfnexus.net/RandomSite/arduino-hrm/ */ #include <Wire.h> #include "Adafruit_LEDBackpack.h" #include "Adafruit_GFX.h" volatile int diff1 = 0; volatile int diff2 = 0; volatile int diff3 = 0; volatile int diff4 = 0; volatile int diff5 = 0; volatile int diff6 = 0; volatile int diff7 = 0; volatile int diff8 = 0; volatile int diff9 = 0; volatile int diff10 = 0; int BPM, BPMforDisplay; unsigned long iterationCounter; int animationPosition = 4; byte oldSample, sample; long pulsetime, lastpulsetime; Adafruit_8x8matrix matrix = Adafruit_8x8matrix(); void setup() { Serial.begin(9600); Serial.println("8x8 LED Matrix Test"); pinMode(10, INPUT); Serial.println("Waiting for heart beat..."); //Wait until a heart beat is detected while (!digitalRead(10)) {}; Serial.println ("Heart beat detected!"); matrix.begin(0x70); // pass in the address matrix.setTextSize(1); matrix.setTextWrap(false); // we dont want text to wrap so it scrolls nicely matrix.setTextColor(LED_ON); } void loop() { /* sample = digitalRead(10); //Store signal output if (sample && (oldSample != sample)) { Serial.print("Beat: "); Serial.println(BPM); HRpulse(); } oldSample = sample; //Store last signal received */ if (animationPosition < -20){ animationPosition = 6; BPMforDisplay = BPM; } sample = digitalRead(10); //Store signal output if (sample && (oldSample != sample)) { Serial.print("Beat: "); Serial.println(BPM); HRpulse(); } oldSample = sample; //Store last signal received if (iterationCounter % 900 == 0){ matrix.clear(); matrix.setCursor(animationPosition,0); matrix.print(BPMforDisplay); matrix.writeDisplay(); //delay(100); animationPosition--; } iterationCounter++; //Serial.println(iterationCounter % 1200); } void HRpulse() { pulsetime = millis(); rollBuffer(); diff1 = pulsetime - lastpulsetime; if (diff10 != 0) { BPM = 60000 / ((diff1 + diff2 + diff3 + diff4 + diff5 + diff6 + diff7 + diff8 + diff9 + diff10)/10); } lastpulsetime = pulsetime; } void rollBuffer() { diff10 = diff9; diff9 = diff8; diff8 = diff7; diff7 = diff6; diff6 = diff5; diff5 = diff4; diff4 = diff3; diff3 = diff2; diff2 = diff1; diff1 = 0; }
Wear it!
This guide was first published on Jul 09, 2013. It was last updated on Mar 08, 2024.