Pulse Sensor [S032]



* Specs

Heart rate data can be really useful whether you’re designing an exercise routine, studying your activity or anxiety levels or just want your shirt to blink with your heart beat. The problem is that heart rate can be difficult to measure. Luckily, the Pulse Sensor Amped can solve that problem!

The Pulse Sensor Amped is a plug-and-play heart-rate sensor for Arduino. It can be used by students, artists, athletes, makers, and game & mobile developers who want to easily incorporate live heart-rate data into their projects.It essentially combines a simple optical heart rate sensor with amplification and noise cancellation circuitry making it fast and easy to get reliable pulse readings. Also, it sips power with just 4mA current draw at 5V so it’s great for mobile applications.

Simply clip the Pulse Sensor to your earlobe or finger tip and plug it into your 3 or 5 Volt Arduino and you’re ready to read heart rate! The 24" cable on the Pulse Sensor is terminated with standard male headers so there’s no soldering required. Of course Arduino example code is available as well as a Processing sketch for visualizing heart rate data.

* Contents

- Arduino Source : https://github.com/WorldFamousElectronics/PulseSensor_Amped_Arduino (ZIP)

- Processing Source : https://github.com/WorldFamousElectronics/PulseSensor_Amped_Processing_Visualizer  (ZIP)

- Connect

White - A0

Black - 5V / 3V

Blue - GND

- in processing 

port = new Serial(this, "COM4", 115200);  // make sure Arduino is talking serial at this baud rate

- Key Code

//  Variables

int pulsePin = 0;                 // Pulse Sensor purple wire connected to analog 

pin 0

int blinkPin = 13;                // pin to blink led at each beat

int fadePin = 5;                  // pin to do fancy classy fading blink at each beat

int fadeRate = 0;                 // used to fade LED on with PWM on fadePin


// Volatile Variables, used in the interrupt service routine!

volatile int BPM;                   // int that holds raw Analog in 0. updated every 2mS

volatile int Signal;                // holds the incoming raw data

volatile int IBI = 600;             // int that holds the time interval between beats! Must be seeded! 

volatile boolean Pulse = false;     // "True" when User's live heartbeat is detected. "False" when not a "live beat". 

volatile boolean QS = false;        // becomes true when Arduoino finds a beat.


// Regards Serial OutPut  -- Set This Up to your needs

static boolean serialVisual = false;   // Set to 'false' by Default.  Re-set to 'true' to see Arduino Serial Monitor ASCII Visual Pulse 



/* interruptsetup */

volatile int rate[10];                    // array to hold last ten IBI values

volatile unsigned long sampleCounter = 0;          // used to determine pulse timing

volatile unsigned long lastBeatTime = 0;           // used to find IBI

volatile int P =512;                      // used to find peak in pulse wave, seeded

volatile int T = 512;                     // used to find trough in pulse wave, seeded

volatile int thresh = 525;                // used to find instant moment of heart 

beat, seeded

volatile int amp = 100;                   // used to hold amplitude of pulse 

waveform, seeded

volatile boolean firstBeat = true;        // used to seed rate array so we startup 

with reasonable BPM

volatile boolean secondBeat = false;      // used to seed rate array so we startup with reasonable BPM


interruptSetup();                 // sets up to read Pulse Sensor signal every 2mS 

Posted by RDIoT

댓글을 달아 주세요