• BME 200
  • Final Project - Part II - Due Nov 29 by 9:30 AM

    Now that you have learned the basics of the Arduino, you know enough to create your own pulse sensor.

    You have been given a pulse sensor that has three wires. The red wire goes to +5V, the black wire goes to ground (GND) and the purple wire goes to analog input 0. Once you attach the sensor to the Arduino and write your program, you will have created a very simple photoplethysmograph.

    Deliverables

    There are two deliverables for this project:

    Here is a partial program to get you started:

    void setup() {
         Serial.begin(9600);
    }
    
    void loop() {
         value = analogRead(pin number);
    
         delay(10);
    }
    

    This code will not run as-is. You will need to edit some of the statements and possibly declare some variables (like int). As you go through the exercises below, you will modify the code and experiment with the sensor.

    Report guidelines

    Compile your results in Word or Pages or Google Docs. The program you use is unimportant but to receive full credit you must adhere to the following style rules:

    Exercises

    1. Plug the pulse sensor into the Arduino and edit the sample code above until you have a program that continuously reads data from Analog Input port 0 and prints the data to the Serial Monitor. Capture a screen shot of your Serial Monitor window showing the values. Include both your code and the screen shot in your report.

    2. Another way to present data is by plotting the numbers on a graph. You can plot the numbers generated by the pulse sensor by choosing Serial Plotter instead of Serial Monitor from the Tools menu. Choose Serial Plotter and let it plot some data. Capture a screen shot and include it in your report. Make sure that the number next to baud in the Serial Plotter is the same number that you used in Serial.begin(); in your program.

    3. Find the range of output from your sensor. Remember, the intensity of light sensed by the sensor is inverted (a bright light should cause a low output value and vice versa). Use a box, cup, dark closet, or some other object that will block all ambient light from the sensor. What is the maximum integer value that you can get your sensor to display? What happens after about five seconds? Provide a screen shot of the Serial Plotter or Serial Monitor to support your findings. Find the minimum value that the sensor can detect by shining a flashlight on it. What happens after about five seconds? Include a screen shot of the Serial Plotter or Serial Monitor during this experiment too.

    4. From your findings in number 3, what do you hypothesize might be the absolute maximum and minimum values that you could measure? (Hint: the analog input on the Arduino is 10 bit, which means that it can represent a total of \(2^n\) input values, where \(n\) is the number of bits. The sensor outputs a voltage between 0V and 5V. A 0V output from the sensor would be the minimum number that your program can measure. A 5V output from the sensor would be the maximum number that your program can measure. What number do you think 2.5V would create in your program?

    5. Place the sensor on a table top in a room of average brightness while your program is running. Look at the data in the Serial Plotter. Approximately what value does the sensor record when it is not attached to anything? How does this value compare to the maximum and minimum that you just determined? Why do you think the sensor was designed to have this value as its resting value?

    6. Attach the pulse sensor to your index finger or thumb with the pulse sensor on the fingerprint side of the finger/thumb. Gently wrap the velcro strip around your finger/thumb to help hold the sensor in place. Sit still and breathe normally. Have your partner record the signal and display it in the Serial Plotter. Capture a screen shot of the Serial Plotter and include it in your report. What does the peak height tell you, or in other words, what is the peak height proportional to? What event in the cardiac cycle does the main peak signify? (Hint: look at the cardiac cycle graph in the textbook (Figure 8.16) or online). Can you see a dicrotic notch in your waveform? What does the dicrotic notch signify?

    7. Observe the Serial Plotter while gently squeezing the sensor to your finger/thumb. Continue squeezing for several pulses. What happens to the waveform when you do this? What explanation can you think of that explains your observation? Include a screen shot of your Serial Monitor with your explanation.

    8. Try recording your pulse from your forehead and earlobe. View the output in the Serial Plotter and include screenshots of each. How is the signal the same? Different? Which location (among finger/thumb, forehead, earlobe) provides the “best” signal according to your experimentation? What reasons can you think of that explain your observations?

    9. Edit your program so that the on-board LED blinks during each pulse. (Hint: use an if statement). Be prepared to demonstrate this program in class. Include a copy of your program in the report.

    10. Write a program that will capture five pulses worth of data in the Serial Monitor then stop the Arduino. For full credit on this problem, use a combination of if and while() statements to automatically stop the program after five pulses. You may also stop the Arduino after five pulses manually by unplugging the Arduino to get a maximum of 50% credit on this exercise. Include a copy of your program in the report.

    11. Using the program in Exercise 10, capture five pulses and then copy and paste the data from the Serial Monitor into Excel. Create a line plot of the data in Excel and insert it into your report. Explain in words how you could estimate the number of beats per minute using only the data that you recorded. Then, use this method to come up with an estimate of the recorded pulse rate. Have your partner measure your pulse rate manually on the wrist and compare the result with your measured estimate. Record both values in your report. What are some reasons that the two values might be different?

    12. Why do you think the pulse sensor uses a green light emitting diode (LED)? Why not another color? Search online and consult multiple sources to come up with an answer. Section 11.4.3. in your textbook may also provide some hints. Cite your sources in the report.





    Last updated:
    November 27, 2018