يعتمد هذا المشروع على نظام مراقبة معدل ضربات القلب / نبضات القلب / معدل النبض باستخدام Arduino و Bluetooth ومستشعر النبض وتطبيق الهاتف الخلوي Android. بمساعدة هذا المشروع ، يمكن مراقبة معدل ضربات قلب الإنسان لاسلكيًا باستخدام وحدة Bluetooth وتطبيق الهاتف الخلوي android.
تطبيق Android قمت بتطويره لقياس معدل النبض من خلال Arduino ومستشعر النبض ووحدة Bluetooth.
مخطط الرسم البياني :
كود اردوينو:
#include <SoftwareSerial.h>
SoftwareSerial Genotronex(10, 11); // RX, TX
int ledpin=12;
int BluetoothData;
// Variables
int pulsePin = 0;
int blinkPin = 13;
int fadePin = 5;
int fadeRate = 0;
// Volatile Variables, used in the interrupt service routine!
volatile int BPM;
volatile int Signal;
volatile int IBI = 600;
volatile boolean Pulse = false;
volatile boolean QS = false;
// Regards Serial OutPut -- Set This Up to your needs
static boolean serialVisual = true; // Set to 'false' by Default. Re-set to 'true' to see Arduino Serial Monitor ASCII Visual Pulse
void setup(){
pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat!
pinMode(fadePin,OUTPUT); // pin that will fade to your heartbeat!
Serial.begin(115200); // we agree to talk fast!
interruptSetup(); // sets up to read Pulse Sensor signal every 2mS
// UN-COMMENT THE NEXT LINE IF YOU ARE POWERING The Pulse Sensor AT LOW VOLTAGE,
// AND APPLY THAT VOLTAGE TO THE A-REF PIN
// analogReference(EXTERNAL);
Genotronex.begin(9600);
Genotronex.println("Bluetooth DIY CHANNEL ..");
pinMode(ledpin,OUTPUT);
}
// Where the Magic Happens
void loop(){
serialOutput() ;
if (QS == true){ // A Heartbeat Was Found
// BPM and IBI have been Determined
// Quantified Self "QS" true when arduino finds a heartbeat
digitalWrite(blinkPin,HIGH); // Blink LED, we got a beat.
fadeRate = 255; // Makes the LED Fade Effect Happen
// Set 'fadeRate' Variable to 255 to fade LED with pulse
serialOutputWhenBeatHappens(); // A Beat Happened, Output that to serial.
QS = false; // reset the Quantified Self flag for next time
}
else {
digitalWrite(blinkPin,LOW); // There is not beat, turn off pin 13 LED
}
ledFadeToBeat(); // Makes the LED Fade Effect Happen
if (Genotronex.available()){
BluetoothData=Genotronex.read();
if(BluetoothData=='1'){ // if number 1 pressed ....
digitalWrite(ledpin,1);
Genotronex.println("LED On D12 ON ! ");
}
if (BluetoothData=='0'){// if number 0 pressed ....
digitalWrite(ledpin,0);
Genotronex.println("LED On D12 Off ! ");
}
}
delay(20); // take a break
}
No comments:
Post a Comment