College is a hectic and chaotic time in ones life, that is why it is very important to keep your stress level low. One way we like to do this is by working out, it helps keep your mind clear and body feeling healthy. That is why we created a portable biosensor that uses the human heart rate during an intense workout to provide information to users regarding the heart rate zone that they are in.
This is a way to help users ensure that they do not exert or push their body too hard beyond the maximum heart rate to a point that is dangerous. This sensor will also help users who are trying to lose weight or increase their stamina by making sure that they are maintaining their heart rate in specific zones.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Heart Rate Zones
This picture above shows the different heart rate zones. Each time the user enters a new zone, the watch will increasingly light up in order to alert the user as to which zone they are currently in. If the user goes over his/her maximum heart rate the watch will turn red and vibrate. Max heart rate is calculated using the individuals age and subtracting it from 220.
Step 2: Materials You Will Need
Below is a list of the materials and tools you will need for this project:
- Flora by Adafruit
- Pulse Sensor
- Vibrating Mini Motor Disc
- NeoPixel Ring - 12 RGBW LEDs - Cool White
- 220 ohm resistor
- NPN Transistor
- Alligator Clips
- Velcro watch cuff
- Button (optional)
Many of these materials can be found using this link: https://www.adafruit.com
Step 3: Preparation & Background
In order to be able to use these materials it is helpful to know and understand what some of them do.
A flora is Adafruit's wearable electronic platform. This is a very beginner friendly device that is small with a power supply that is easy to use. The image above shows where everything is located on the Flora.
For more information regarding Flora's, check out this website: https://learn.adafruit.com/getting-started-with-f...
NeoPixels is also Adafruit's brand for individually-addressable RGB color pixels and strips. Another important thing to note is that they do not just light up on their own, they require a micro controller such as an Arduino and coding. It takes some programming practice in order for the NeoPixels to do what you want them to do, so we had to look into this for our project. Programming was extremely important for this project, and experience in that area will help.
For more information regarding Neopixel's you can check you this website: https://learn.adafruit.com/adafruit-neopixel-uber...
A pulse sensor from Adafruit is also used in order to take your pulse. We then implement code in order for it to calculate Beats per Minute (BPM) for this project.
For further instruction and information for the pulse sensor please see this link: https://pulsesensor.com/pages/getting-advanced
There are libraries that you will need to download into the Arduino software in order for the code to communicate to your device using certain commands. This link below shows you how to download libraries into Arduino.
The following libraries are the ones you will need:
Click "clone or download" and follow the instructions above in the link to include them in your code.
Special thank you to Adafruit that provided us with some of the code used for our final product!
Step 4: Safety Information
It is really important to always keep the safety of you and the people around you in mind when working on different projects. First, it is important to always have the USB unplugged from the computer when you are moving and attached wires to the Flora, this is so that you do not shock yourself.
1. Fluids should be kept away from this device in case of a spill that could ruin the circuit
2. Avoid current flow through your body by only touching wires and other metal circuitry while power is OFF
Warning this is not a medical device, it strictly alerts you if your heart rate has exceeded max heart rate, it should not be compared to a heart rate monitor in the medical world. If you feel exhausted/fatigued and the watch has not alerted you that you are above max heart rate, you should still stop what you are doing for the watch may not always be accurate.
Step 5: Hints and Tips
Here are some hints and tips if you get stuck along the way:
- NeoPixels can display a variety of different patterns of lights, in order to make sure it works, use the sample code provided by the NeoPixel Library
- You can use a multimeter to measure continuity between connections after soldering to insure these connections are made correctly
- Make sure pulse sensor is securely fastened to watch cuff to insure that motion artifact is not affecting heart rate reading
- In prototyping stage if you are not getting good connections, make sure alligator clips are attached properly
- If code is not working properly, copy and paste parts of you code into a separate window
- Upload code after each part is copy and pasted
- This will show you where your code is working and not working
- The vibrating motor can be connected using a diode, resistor, and and a transistor instead of a Hectic Motor Controller. We found this method to be the cheapest option.
- To save time and frustration, make sure you use alligator clips for prototyping. You don't want to solder the prototype then find out a connection is not working.
Step 6: Assembly 1- Wiring NeoPixel Ring to Flora
To begin, take the NeoPixel ring and attach it using 3 wires and alligator clips. You will use alligator clips to build the prototype and end up soldering the parts together once you are satisfied with the product.
- Attach one wire that goes from "IN" on the Neopixel ring to to "#6"
- Attach one wire from "PWR" on NeoPixel ring to "VBATT" on the flora
- Attach one wire from "GND" on NeoPixel Ring to "GND" on the flora
Step 7: Assembly 2- Wiring the Button to Flora
THIS STEP IS OPTIONAL...if you want a button you can add one, we ended up using the on/off switch located on to Flora for this step, therefore it is not included in the code.
In this step what you need to do is...
- Connect a wire from any one of the 4 legs of the button to "#12" on the flora
- Connect a wire from any of the remaining 3 legs of the button to "GND" on the flora
Step 8: Assembly 3- Wiring Vibrating Motor to Flora
In order to connect the vibrating motor to the flora we used a diode, transistor, and a resistor. You want to first...
- Use alligator clips to attach the red wire of the vibrating motor to the end of the diode closest to the stripe on it
- Attach the blue wire of the vibrating motor to the other end of the diode
Step 9: Assembly 4- Wiring Vibrating Motor to Flora (Cont.)
Now attach the diode the one end of the diode (comes from red wire of vibrating motor) to "3.3V" on the Flora.
Step 10: Assembly 5- Wiring Vibrating Motor to Flora (Cont.)
Take the other side of the diode and grabbing your transistor, connect it to the transistor collector (right pin of transistor).
Step 11: Assembly 6- Wiring Vibrating Motor to Flora (Cont.)
Locate the transistor emitter (left pin of the transistor) to ground.
Step 12: Assembly 7- Wiring Vibrating Motor to Flora (Cont.)
The last step in the connecting the vibrating motor to the Flora is to locate the transistor base (center pin of the transistor) and connect it to a resistor and then the resistor to "GND" on the Flora.
Step 13: Assembly 8- Wiring Pulse Sensor to Flora
There are three wire connections you need to make in this step.
- Connect the purple wire of the pulse sensor to "#10" on the Flora
- Connect the red wire of the pulse sensor to "3.3V" on the Flora
- Connect the black wire of the pulse sensor to "GND" on the Flora
Step 14: Assembly 9- Attaching Battery to Flora
Locate the wires of the battery with the white connection on the end, plug that part into the battery component located on the Flora.
Step 15: Assembly 10- Complete Circuit Diagram
Now the circuit with all the alligator clips is complete. It may look like a mess but all the connections are now made! Now individual connections can be soldered together to make the watch more compact.
Step 16: Finally... the Code!
Once circuit is completed, the assembly will need a code that will make it do what we want it to do. The github code collects heart rate data from the Adafruit Pulse Sensor and categorizes them into 5 heart rate zones. When the individual's HR falls into the specific zones, it will cause the Neopixel ring to light up according to the zone he/she is in. When individual's HR is close to maximum HR, the Neopixel will color wipe in red and the vibrating motor will be activated indicating the HR is in a dangerous zone and individual needs to slow down.
Step 17: Watch Assembly
After soldering the parts together as shown in the circuit diagram, it's time to assemble the watch!
The NeoPixel ring is placed on top of the Flora and can be attached with glue or sewed securely using the open hole in the NeoPixel that was not soldered.Have your code running at this point to see where the first neoPixel lights up in order to put the watch in an orientation that makes sense to you. Make sure you DO NOT cover the on/off switch when doing this step.The Flora is also sewn onto the cuff through the remaining holes on the outside.
The battery can be tucked under the the Flora/NeoPixel ring along with the vibrator (and attachments).
The Pulse sensor is then sewed securely onto the part of the watch that will be fastened to the underside of your wrist. Make sure you have the right side facing upward when doing this.
Feel free to assemble differently according to materials that are available to you!
Step 18: End Product
This is how the final product should look like. Functional and stylist!
Step 19: Further Ideas
One way to take this idea further is adding the button that was shown as optional previously in the instrucable.
Another way is to add a separate code that can be used when you are not working out. This could be a real time clock, where one pixel shows the hour hand and the other the minute hand. For more information on this check out this link for the Real Time Clock feature.