SUMMER STEM-HEALTH CAMP
  • Home
  • 2025 RCC Camp
    • Day 1: Basic Coding >
      • Button Control
      • Multicolor LED
      • Fading multicolor led
      • Melody (sound)
    • Day 2: Servos and Potentiometers >
      • DC Motor
      • Ultrasound
      • Potentiometer and Motors
      • 2 servo control >
        • Analog Stick Control
      • PIR Motion Sensor
      • IR Light Proximity Sensor
    • Day 3 Making an ECG/EKG! >
      • ECG/EKG health lesson
      • OLED Screen Basics
      • Pictures to OLED
      • BPM on OLED
    • Day 4: Measuring Pulse >
      • Scrolling Screen Graph
      • How the body absorbs light
      • Screen Pictures
      • IR Temp Sensor And Screen
    • Day 5: Finishing up/Show >
      • IR Light Proximity Sensor
      • PIR Motion Sensor
      • CO2 Sensor
      • Ultrasound distance sensor
  • The Teachers
  • Our Partners
  • Archive
    • 2024 Health-STEM Coding Camp >
      • Home (2024)
      • The Teachers
      • Day 1: Basics and Lights
    • 2024 Coding/Robotics Camp >
      • Day 1: Basic Coding >
        • Saving your codes
        • Engineering design
      • Day 2 Servos >
        • 2 Servos, one potentiometer
        • Multicolor LED >
          • Fading multicolor led
    • Pictures from prior years
    • 2023 3D Design Camp >
      • Day 1: 2D design
      • Day 2: 3D design basics
      • Day 3: Constraints
    • 2023 Health-STEM Coding Camp >
      • PreAcademy prep
      • Day 1: Basics and Lights >
        • Multicolor LED
        • Button Control
      • Day 2: Ultrasound >
        • Ultrasound Health Lesson
        • Supplement Melody
        • Supplement: Servo >
          • Potentiometer and Motors
          • 2 servo control
      • Day 3: Measuring Pulse >
        • How the body absorbs light
        • OLED Screen Basics >
          • Scrolling Screen Graph
      • Day 4 Making an ECG/EKG! >
        • ECG Health Lesson
        • Pictures to OLED
        • BPM on OLED
      • Day 5: Finishing up/Show
    • 2021 STEM Camp (HS) >
      • The Teachers (2021)
      • PreAcademy prep
      • Day 1: Basics, Lights, and Temperature Sensor >
        • Day 1 Supplement: Measure Temperature
        • Day 1 Supplement: IR Temp Sensor
        • Day 1 Supplement: Identifying Resistors
        • Supplement: Controlling A Servo
      • Day 2: Measuring Pulse >
        • How the body absorbs light
        • IR Light Proximity Sensor
        • PIR Motion Sensor
      • Day 3 Supplement: OLED Screen Basics >
        • Display Screen Temperature
        • Scrolling Screen Graph
      • Day 4: Finishing up/Show
    • 2021 STEM Camp (MS) >
      • PreAcademy prep
      • Day 1: Basics, Lights, and Temperature Sensor >
        • Day 1 Supplement: Identifying Resistors
        • Day 1 Supplement: Measure Temperature
        • Day 1 Supplement: IR Light Proximity Sensor
      • Day 2: Ultrasound >
        • Day 2 Supplement: IR Temp Sensor
        • Day 2 Supplement: Controlling A Servo
      • Day 3: Measuring Pulse
    • 2020 STEM Camp
    • 2018 Lessons
    • 2017 Camp
  • Contact Us!

Day 2:        
Measure Pulse


Disclaimer: The Pulse Sensor you make for this activity should not be used for diagnostic purposes. If at any point you are concerned about your heart rhythm, you should consult your physician.


Materials for this Activity:


The Arduino and USB cord
Picture
Several Different LEDs
Picture
All the Resistor Strips
Picture

The Pulse Sensor​
Picture
Wires
Picture
Breadboard
Picture

Buzzer

Picture

Measuring the Heart Beat

Here is a video that shows the sensor you will build. This way, you know what to expect. We will use a sensor to get a plot of our heartbeat. Specifically, the sensor measures the IR light going through/off your skin. As blood pumps, this value changes. The graph portion starts at about 2:30 minutes.

Measuring Pulse

Pulse is one of the simplest and main resources healthcare professionals can use to know if something is wrong with you. This activity will help you learn basic Arduino wiring, how to read data from a sensor, and how to get information to display on your computer monitor. ​

Before we write the code, we need to get the library that runs the SpO2 sensor. 
In Arduino IDE:
  1. Go to Sketch -> Include Library -> Manage Libraries
  2. Type in “max3010x” into the search box
  3. Install/Download the “Sparkfun MAX3010x Pulse and Proximity Sensor Library”
Picture
Now we are ready to wire and code the sensor. ​

How to Wire the MAX Pulse Sensor

Flip over your sensor and find the 4 prong labels (Vin, SDA, SCL, GND). That row should have soldered pins in it. Use 4 wires to connect the sensor to the Arduino following these directions. 

Vin (volts in) to the 5V Arduino pin. 
GND (ground) to the GND Arduino pin.
​SDA to the Arduino A4 pin.
SCL to the Arduino A5 pin. 
Picture

Coding for the Pulse Sensor

Picture

Verify and Upload the Code to the Arduino (red light)

After you upload the code to the board successfully, check if the little red light came on that is on top of the sensor. If it did not, try these tips to get it to work. 
1) Double check your wiring and reupload
       Also try replacing all 4 wires with new ones and reupload
2) Switch the A4 A5 pins and reupload
3) Unplug the Arduino from the computer and plug it back in
4) Unplug the 5V and GND from the Arduino, upload the code, plug the 5V and GND in again, and upload code
Picture
If the red light is on, open the serial plotter. Need help? Ask a teacher!

Seeing your pulse data. Serial Plotter

See if you see your pulse data. You will have to wait about 10 seconds for the graph to cycle through the first 500 data points and then the plotter will zoom in on the data's y-axis. ​
Picture

Here is a screenshot of Mr. Dorsey's data from the serial plotter after it zooms. 
Here are tips to get a good reading. 
1) Use your thumb, it is bigger and has more blood flow. (Fun fact, you shouldn't take someone else's pulse with your thumb. You'll just feel your own pulse...)

2) Do not push down too hard on the sensor (that would restrict blood flow) 

3) Keep pressure on the sensor as constant as possible. Hopefully values center on about the same values. 
Picture
4) Putting the sensor on a breadboard may also help so that you can just lay your hand loose on it. 

"Calibrating": Getting Plot to Start Close to Zero

See Dorsey's data in the example above? The pulse data goes from about 100200 and 100800? It may help to center this closer to zero. To do this, we could try to -100,000 from the serial print in my loop. Here is an example for what I did and an example plot that was made by doing it. Your number to subtract will be different, but use the values on your graph to pick it. 
Picture
Pick your correction value and add it to the Serial.println like above, your number may be different. Reupload to board and see what your graph looks like. Hopefully after 10 seconds of running your serial plotter your graph has values less than 1000 and looks similar to this. 
Picture
Now we are ready to actually start doing some cool things with the sensor. 

Light Blinks when your Heart Beats! 

In this activity, we will turn on a light every time your heart beats. In order to do this, you need to have already calibrated your sensor from the above steps. 
We need to set a "threshold value". That means a limit value. See here how the values go below 100 almost every time my heart beats.

I can set that as a threshold value to tell the Arduino to blink a light every time my our heart beats and the values go below 100.  Here is how to do that. 
Picture

Code for Heart Beat to Blink onboard LED Light

Play around with your correction for awhile and find a good threshold value like I did in the above picture. Then add that if else statement for it to blink whenever the value falls below that point.

You can also attach your buzzer to pin 13 and ground and it will buzz each time your heart beats. Warning, it's pretty loud lol. 
Picture
Proudly powered by Weebly
  • Home
  • 2025 RCC Camp
    • Day 1: Basic Coding >
      • Button Control
      • Multicolor LED
      • Fading multicolor led
      • Melody (sound)
    • Day 2: Servos and Potentiometers >
      • DC Motor
      • Ultrasound
      • Potentiometer and Motors
      • 2 servo control >
        • Analog Stick Control
      • PIR Motion Sensor
      • IR Light Proximity Sensor
    • Day 3 Making an ECG/EKG! >
      • ECG/EKG health lesson
      • OLED Screen Basics
      • Pictures to OLED
      • BPM on OLED
    • Day 4: Measuring Pulse >
      • Scrolling Screen Graph
      • How the body absorbs light
      • Screen Pictures
      • IR Temp Sensor And Screen
    • Day 5: Finishing up/Show >
      • IR Light Proximity Sensor
      • PIR Motion Sensor
      • CO2 Sensor
      • Ultrasound distance sensor
  • The Teachers
  • Our Partners
  • Archive
    • 2024 Health-STEM Coding Camp >
      • Home (2024)
      • The Teachers
      • Day 1: Basics and Lights
    • 2024 Coding/Robotics Camp >
      • Day 1: Basic Coding >
        • Saving your codes
        • Engineering design
      • Day 2 Servos >
        • 2 Servos, one potentiometer
        • Multicolor LED >
          • Fading multicolor led
    • Pictures from prior years
    • 2023 3D Design Camp >
      • Day 1: 2D design
      • Day 2: 3D design basics
      • Day 3: Constraints
    • 2023 Health-STEM Coding Camp >
      • PreAcademy prep
      • Day 1: Basics and Lights >
        • Multicolor LED
        • Button Control
      • Day 2: Ultrasound >
        • Ultrasound Health Lesson
        • Supplement Melody
        • Supplement: Servo >
          • Potentiometer and Motors
          • 2 servo control
      • Day 3: Measuring Pulse >
        • How the body absorbs light
        • OLED Screen Basics >
          • Scrolling Screen Graph
      • Day 4 Making an ECG/EKG! >
        • ECG Health Lesson
        • Pictures to OLED
        • BPM on OLED
      • Day 5: Finishing up/Show
    • 2021 STEM Camp (HS) >
      • The Teachers (2021)
      • PreAcademy prep
      • Day 1: Basics, Lights, and Temperature Sensor >
        • Day 1 Supplement: Measure Temperature
        • Day 1 Supplement: IR Temp Sensor
        • Day 1 Supplement: Identifying Resistors
        • Supplement: Controlling A Servo
      • Day 2: Measuring Pulse >
        • How the body absorbs light
        • IR Light Proximity Sensor
        • PIR Motion Sensor
      • Day 3 Supplement: OLED Screen Basics >
        • Display Screen Temperature
        • Scrolling Screen Graph
      • Day 4: Finishing up/Show
    • 2021 STEM Camp (MS) >
      • PreAcademy prep
      • Day 1: Basics, Lights, and Temperature Sensor >
        • Day 1 Supplement: Identifying Resistors
        • Day 1 Supplement: Measure Temperature
        • Day 1 Supplement: IR Light Proximity Sensor
      • Day 2: Ultrasound >
        • Day 2 Supplement: IR Temp Sensor
        • Day 2 Supplement: Controlling A Servo
      • Day 3: Measuring Pulse
    • 2020 STEM Camp
    • 2018 Lessons
    • 2017 Camp
  • Contact Us!