Week 11 - Homework 1: Research project (pulse sensor)

This was a group project made by Lina and Lisa :)

Simply put, a pulse sensor is a sensor that measures your heartbeat and converts it into data that is readable for computers. Pulse sensors are often used in hospitals for medical equipment and smartwatches, to name two examples.

This is what the pulse sensor that you can use for the arduino looks like:

Specifications:
- Diameter: ~16 mm
- Overall thickness: ~3 mm
- Working Voltage: 3V-5V
- Working current: 4mA at 5V

Looking at the backside of the sensor, where the wires are connected:
S: Stands for signal. This is connected to an inputpin on the Arduino board.
+: Stands for supply. Connect this to a source of power. 3V up to 5V
-: Stands for ground. Connect this to ground.

The electronics on the sensor is directly exposed; it is therefore recommended to cover both sides of the sensor with hot glue, vinyl tape or other non conductive materials (this is a step we missed when doing our circuit, which probably affected our results). Do not handle with wet hands or when the computer is charging (use on the computer's battery power).

How it works

The sensor is based on principle of photophlethysmography. It uses light to measure change in volume of blood in the measured area which causes a change in the light intensity recieved by the sensor. The sensor is used on top of a vein in a fingertip (not the thumb) or earlobe. The sensor has a LED lamp that illuminates the tissue. Blood absorbs light and how much light that is absorbed depends on the blood volume in the tissue. The amount of light that is not absorbed by the blood is recieved back into the sensor, who can then calculate the heart pulse rate based on the light signal pulses (which are equivalent to the flow of blood volume in the tissue).

The sensor needs to touch the skin with a pressure that is just right. If the sensor is pressed against the skin to hard, all the blood in the area will be squeezed out. If the sensor is pressed against the skin to lightly, the sensor will get noise in the readings from ambient light and movement.

Our circuit

For our circuit, we used a tutorial project from the website 'pulsesensor.com' called 'The "GettingStartedProject"'. It required a library to be downloaded, called 'PulseSensor Playground' which contained the code for this project and also a lot of other projects.

What this project was supposed to do is to show the pulse signal on Arduino's serial plotter and an LED light with in time with the hearbeat. The serial plotter is supposed to look similar to this:

And the setup on the board looked like this (the resistor is a 1k one):





The code:
/*  PulseSensor Starter Project and Signal Tester
 *  The Best Way to Get Started  With, or See the Raw Signal of, your PulseSensor.com™ & Arduino.
 *
 *  Here is a link to the tutorial
 *  https://pulsesensor.com/pages/code-and-guide
 *
 *  WATCH ME (Tutorial Video):
 *  https://www.youtube.com/watch?v=RbB8NSRa5X4
 *
 *
-------------------------------------------------------------
1) This shows a live human Heartbeat Pulse.
2) Live visualization in Arduino's Cool "Serial Plotter".
3) Blink an LED on each Heartbeat.
4) This is the direct Pulse Sensor's Signal.
5) A great first-step in troubleshooting your circuit and connections.
6) "Human-readable" code that is newbie friendly."

*/


//  Variables
int PulseSensorPurplePin = 0;        // Pulse Sensor PURPLE WIRE connected to ANALOG PIN 0
int LED13 = 13;   //  The on-board Arduion LED


int Signal;                // holds the incoming raw data. Signal value can range from 0-1024
int Threshold = 550;            // Determine which Signal to "count as a beat", and which to ingore.


// The SetUp Function:
void setup() {
  pinMode(LED13,OUTPUT);         // pin that will blink to your heartbeat!
   Serial.begin(9600);         // Set's up Serial Communication at certain speed.

}

// The Main Loop Function
void loop() {

  Signal = analogRead(PulseSensorPurplePin);  // Read the PulseSensor's value.
                                              // Assign this value to the "Signal" variable.

   Serial.println(Signal);                    // Send the Signal value to Serial Plotter.


   if(Signal > Threshold){                          // If the signal is above "550", then "turn-on" Arduino's on-Board LED.
     digitalWrite(LED13,HIGH);
   } else {
     digitalWrite(LED13,LOW);                //  Else, the sigal must be below "550", so "turn-off" this LED.
   }


delay(10);


}



Our result:

For our circuit, even though we got a signal and results in the serial plotter, the readings in the serial plotter was wildy irregular and not very realistic no matter how we tried to put pressure on the sensor. We also only got the LED to light up when first touched, not continually in time with the heartbeat.

We have two theories of why this might be the case:
1. The fact that we did not cover the sensor with non-conductive materials may have led to too much noise in the readings. This is the most likely cause.
2. The threshold value: even though we tried to adjust this number a few times with drastic changes, we didn't really see a lot of difference in the serial plotter. Had we put more time on changing the threshold, maybe we would have seen a difference eventually, but we ran out of time.

Kommentarer

Populära inlägg