Introduction: Air Quality Sensor and Heart Rate Monitor
The goal of this tutorial is to combine an air quality sensor and heart rate monitor to show the relationship between air quality levels and an increased risk of heart disease.
According to the American Heart Association, "studies have shown increases in deaths and hospitalizations when there are high concentrations of smog."
"Pollution is also believed to have inflammatory effects on the heart, causing chronic cardiovascular problems. Medical researchers are particularly concerned about pollution particles smaller than 2.5 microns, which are usually related to fuel combustion. Because they are so tiny, they aren’t easily screened and more readily enter the human body. They then begin to irritate the lungs and blood vessels around the heart. Data suggest that over time pollutants aggravate or increase the process of disease in the arteries." AHA 2016 Article
To help draw attention to this wide spread health concern our mash-up can be installed in public places to create conversations about air quality and heart disease. A further application would be adapting this technology into fit-bits.
Step 1: Know Your Supplies
1 Arduino
1x 100ohm
2x 180ohm Resistors
1 10k ohm Potentiometer
3x 8-12inch diameter Chinese Lanterns or similar
1 Package of RGB LEDs (we used 3-color common anode)
1 Air Quality Sensor (we used Grove Dust Sensor)
Heat Shrink
Solder and Soldering Iron
Chinese Lanterns (10inch diameter- not as big I thought)
Wire (at least 3ft- depends on install location)
Scissors
String
Electrical Tape
Hot Glue Gun and Hot Glue Sticks
Drill
Plastic Clothes Hanger with Pant Clips
(Metal Clothes Hanger)
Step 2: Testing the LDR and the Arduino
Set up and LED and LDR to test the functionality. We will replicate this circuit when building the heart rate sensor with the hangar clip. Look at this tutorial to understand how a Light Dependent Resistor works.
https://learn.adafruit.com/photocells/using-a-phot...
Arduino Code to read the photosensor:
<p>* Photocell simple testing sketch. Connect one end of the photocell to 5V, the other end to Analog 0.</p><p>Then connect one end of a 10K resistor from Analog 0 to ground </p><p>Connect LED from pin 11 through a resistor to ground </p><p> */ int photocellPin = 0; // the cell and 10K pulldown are connected to a0int photocellReading; </p><p> // the analog reading from the sensor dividerint LEDpin = 11; </p><p> // connect Red LED to pin 11 (PWM pin)int LEDbrightness; // </p><p>void setup(void) { // We'll send debugging information via the Serial monitor Serial.begin(9600); } </p><p>void loop(void) { photocellReading = analogRead(photocellPin); </p><p> Serial.print("Analog reading = "); </p><p>Serial.println(photocellReading); </p><p> // the raw analog reading // LED gets brighter the darker it is at the sensor // that means we have to -invert- the reading from 0-1023 back to 1023-0 </p><p>photocellReading = 1023 - photocellReading; //now we have to map 0-1023 to 0-255 since thats the range analogWrite uses LEDbrightness = map(photocellReading, 0, 1023, 0, 255); </p><p> analogWrite(LEDpin, LEDbrightness); </p><p>delay(100);}</p>
Step 3: Part 1: Building a Heart Rate Monitor
This version of the heart rate monitor follows the instructable at https://www.instructables.com/id/Homebrew-Arduino-...
Materials required:
1) Arduino
2) Light Dependent Resistor (LDR)
3) Bright Red LED
4) Clothes hanger with clips
Step 4: Improvements to Heart Rate Monitor
REVISIONS:
Changed out the Red LED for a brighter RGB LED
For comfort Glue LED to TOP of Hanger Clip instead of inside! See Pics
Suggestions:
We Highly Recommend ordering Arduino Heart Rate sensor instead of making your own: https://www.sparkfun.com/products/11574. It is more accurate and way less of a headache!
Or following this tutorial https://www.instructables.com/id/Heart-Sensor-With-... using a photodiode instead of a light dependent resistor.
The ambient light easily affects the LDR and caused alot of headaches!
Step 5: Part 2.
Objective: Create LED pulsing that is in-sync with Heart Rate monitor. The LED will pulse at the same rate as the person's heart beat.
Supply list:
1x 100ohm
2x 180ohm Resistors
1 10k ohm Potentiometer
3x 8-12inch diameter Chinese Lanterns or similar
RGB LEDs (we used 3-color common anode)
Heat Shrink
Solder and Soldering Iron
Step 6: Connecting the LED to the Heart Rate Monitor.
Start with one RGB LED plugged into the bread board. Use the heart rate measurement to pulse the LED at the calculated frequency. Resting heart rate is around 70 bpm for most people. After you have one LED working, you can add more or use a longer lead cable to place the LED elsewhere, like we did.
The 10k variable resistor is used to fine tune the voltage divider for the photoresistor.
Arduino Code to read the photosensor for the Heart Rate Monitor:
void updateHeartRate() { int heartRateMeasurement = analogRead(A0);<br>hrt = map(heartRateMeasurement, 0, 1023, 0, 100); if (hrt != oldHeartRate) { // if the heart rate has changed Serial.print("Heart Rate is now: "); // print it Serial.println(hrt); hrtPeriod = 1/(hrt/60000.0); //Serial.print(" Pulse Period is: "); //Serial.println(hrtPeriod); oldHeartRate = hrt; // save the level for next comparison } void loop() { long currentMillis = millis(); // if 200ms have passed, check the heart rate measurement: // if (currentMillis - previousMillis >= 200) { previousMillis = currentMillis; updateHeartRate(); } }
Step 7: Part 3. Adding the Air Quality Senor to the LED and Heart Rate Monitor
Now that the LED is blinking in time with the heart rate monitor we can add in the air quality sensor.
We will be using a Grove Dust Sensor (http://wiki.seeedstudio.com/wiki/Grove_-_Dust_Sens... but other types of air quality sensors could be used instead. We chose this one because it measures particulate matter. However, the units of measure do have to be converted to compare to standard the Air Quality Index (Next Step)
Note: the air quality sensor has to be in the upright position (vertical) so that it can collect samples!
Connecting the Dust Sensor is pretty simple...just plug in 3 corresponding color jumper wires (yellow - arduino digital port 8, red- power rails , black- power rails).
Use the Arduino code from the Wiki link above to create a new sketch which captures air quality readings every 30 seconds.
Once this code is working combine this sketch with the Heart Rate Monitor sketch.
We will come back to the Dust Sensor once we have done some calculations....
Step 8: Converting the Dust Senor (pcs/.01cf) to Air Quality Index:
For our project we use the corresponding AQI ranges:
0-50 = Green
51-150 = Yellow
151+ = Red
These AQI numbers need to be converted from 1 ug/m3 (microgram / cubic meter) to pcs/.01cf for the Grove Dust Sensor. I recommend using a different Air Quality sensor to get more accurate results without having to convert units!
AQI to ug/m3 :
0-12 = Green
13-55 = Yellow
56+ = Red
ug/m3 to pcs/.01cf - see calculations above
Helpful Conversion Links:
Use the EPA website to help convert values: https://airnow.gov/index.cfm?action=resources.con...
C++ code found at https://github.com/intel-iot-devkit/upm/pull/409/f... (shown in picture above)
Use the code below with your calculated limits on concentration levels to fire the LED colors accordingly.
Arduino code:
if (concentration > high limit)
RED LED ON
else if (concentration > medium limit)
RED LED ON
GREEN LED ON
else (concentration > 0)
GREEN LED ON
*For calculations I assumed the particle diameter of 2.5*
Step 9: Changing the LED Color Corresponding to AQI
The LEDs are designed for 3Volt drop across the LED to occur at approximately 20milliAmps (mA). To provide this current we used a resistor in series with the LED the value of the resistor is calculated with a 5V power supply and the 3V drop at 20mA. The limiting resistor is found to be 100ohms.
Each color in a single LED requires its own current limiter. Since we used Red and Green LEDs there are two different capacitors.
Red has a 2V drop.
Green has 3V drop.
Calculations are shown accordingly.
Step 10: Part 4. Chinese Lanterns
Supplies:
Chinese Lanterns (10inch diameter- not as big I thought)
Wire
Scissors
String
Electrical Tape
LEDs
(Clothes Hanger)
For effect we put our LED into simple Chinese lanterns to help the light emanate!
I tried purchasing my lanterns in the store but without success. In the end, I ordered them on Amazon.
Follow the instructions provided with the lanterns for quick assembly.
I strung mine together with regular cotton sewing string and used a clothes hangar as the mounting point. If I knew where I was going to install them I would have made the setup more permanent.
Cool adaptations to your Chinese lanterns:
https://www.instructables.com/id/Simple-Elegant-Pap...
https://www.instructables.com/id/Mobius-Lantern/
https://www.instructables.com/id/Dotted-Tissue-Pape...
https://www.instructables.com/id/Dotted-Tissue-Pape...
Tip: Make sure your LED is bright enough to shine through the lantern and you have enough wire for the LED to reach the lantern!
Step 11: Bundling LED's
After you have built your lanterns you are now ready to bundle LED's to increase the brightness. This is not necessary but does help the effect.
Measure out the amount of wire you will need between your lanterns and breadboard.
Splice the wire to solder the leads to the LED terminals. You only need to solder one lead to each of the LED terminals (3 solder joints total). For our purposes we only did 2 LED's to show the process.
Use heat shrink and electrical tape to cover the solder joints-making sure that the wires do not touch.
On the other end of the wire cord repeat a similar process:
1. Strip three wire ends
2. Solder to three wire
Step 12: Final Step: Install and Demo
Future Improvement options:
Use a series of op amps to amplify the small signal change of the photoresistor and to filter out noise!