This heart rate badge was created using Adafruit and Bitalino products. It was designed not only to monitor the heartrate of the user, but to also provide real time feedback through the use of different colored LEDs for different ranges of heartrates.
What you will need:
1 Adafruit FLORA - Wearable electronic platform: Arduino-compatible - v3
4 Adafruit Neopixels - v2
1 spool of conductive thread
1 Bitalino ECG sensor
1 Bitalino Arduino Sensor Cable
1 Bitalino 3 pronged lead cable
3 stick-on electrodes
3 female-alligator clip leads (like these)
1 USB to microUSB cable (to upload code)
1 Lithium battery
1 sewing needle
1 tube of adhesive (preferably E6000)
1 pack of red embellishment jewels
Step 1: Glue the Red Embellishment Jewels Onto the Vest
Use the E6000 (or other adhesive) to glue the red embellishment jewels onto the left chest of the vest in the shape of a heart. I cut out a picture of a heart to guide me as I was gluing. The heart does not have to be a specific size, but it should be large enough to fit 4 Neopixels on the inside.
Step 2: Decide on the Placement of Components
It is important to think about where you want to sew on all of the components of the system. When using conductive thread, the "VBATT" (power) and "GND" (ground) leads cannot cross or else it will create a short circuit and become very hot. You will want to ensure that you can sew these two paths without intersecting.
Here is a picture of where I decided to sew on each component. I will ultimately sew them onto the inside of the vest so they are hidden and the appearance is nicer. The LEDs are bright enough to shine through the layer of fabric.
When placing the components on the backside of the vest, I traced the shape of the heart so that I knew where the border was, placed the components where I wanted them, and drew the pathways that I was going to stitch. This helped to ensure I would have plenty of room between the threads going to the power source and ground.
Step 3: Sew the Adafruit Components Onto the Vest
You can now begin sewing the components onto the vest. Make sure that you are double checking all of your connections as you sew and that any knots you make are tight.
You can tape the Adafruit Flora in place until you start sewing components into the vest. After you start sewing, the flora will be attached to the vest. You can even leave the tape on afterward if necessary.
All of the negative (-) leads on the Neopixels need to be strung together and connected to GND on the Flora, all of the positive (+) leads need to be strung together and connected to VBATT on the Flora, and all of the Neopixels need to be strung together following the arrows printed on the components (see circuit diagram above). The thread that follows the arrows through the middle of the Neopixels needs to be connected to Pin 6 on the Flora. This is how the Flora will communicate with the Neopixels.
You can tie a knot on one side of the connection, ensuring it is very tight because the thread needs to be in contact with the metal. You then need to follow your guidelines drawn on the vest, keeping the stitching as tight as possible to ensure power and ground will not touch. On the other side of the connection I looped the thread through the hole a few times and then tied a knot.
Note: If you are using a medium sized needle, it should be able to fit through the holes on the Neopixels.
You will want to trim any ends of the thread close to the knot, again, to ensure power does not touch ground.
Step 4: Run a Test Code
Open the Arduino IDE program on your computer. If you do not have it already downloaded, it can be found here:
If this is your first time using the Adafruit flora, you will need to do several steps to connect it with your laptop. Here is a step-by-step guide on how to set up the Flora:
Once the flora is connected to your laptop, you will want to ensure that you have sewed the Neopixels onto the vest correctly. You can find a test code in the Arduino IDE software by going to File --> Examples --> Adafruit Flora Neopixel Library --> floratest.
Upload the code to the Flora by plugging in the microUSB into the Flora and the other end into your computer. Click the arrow button in the upper left hand corner of the software to Upload the code.
If everything is hooked up correctly, all 4 Neopixels should cycle through various colors.
Unplug the Flora from the computer once you have successfully run the test code.
Step 5: Add the ECG Components
It is now time to add the Bitalino ECG components now that we have the Adafruit components functioning properly.
Plug the Bitalino Arduino Sensor Cable into the side of the ECG sensor with the Bitalino logo and 4 dots – not the side with 3 dots. Plug the 3 prong lead cable into the other end of the sensor. Snap the Electrodes into the prongs. You will need to peel off the white stickers on the back later, before using.
The three loose ends from the Bitalino Arduino Sensor Cable will get attached to the Flora. This is how the ECG sensor will communicate with the Flora. The Black lead gets connected to "GND" (ground), the red lead gets connected to "3.3V" (power), and the purple lead gets connected to pin "#10". Use female-alligator clips to make the connection.
The electrode connected to the red lead gets placed on your right chest, the white lead goes onto your left chest, and the black lead goes onto your side by your hip.
Step 6: Adjust the Code
The code for the Heartrate Monitor is attached as a file. Copy and paste this into the Arduino IDE software. The only thing that will need to be adjusted is the threshold, which is user dependent. Use the serial plotter (Tools --> Serial Plotter) to view your heartbeat and choose a value toward the top (or bottom) of your heartbeat. You will want to pick a value high enough that does not pick up noise that is not an actual heartbeat, but low enough that it will catch all heartbeats. I used 450 as my threshold. You can run the program and feel your pulse to see if the beats match up. Remember you must use the microUSB plugged into the Flora and your computer to upload a new code.
Step 7: Make the Vest Wearable
The only addition that is needed at this point to make the vest wearable is a Lithium Battery. Plug the lithium battery into the Flora, which will power it without a cord going to the computer. The Flora will always store the last code that was uploaded to it, so each time you plug in the battery, the code will run.