05-04-2018 05:14 PM
hello every one
actually I am trying to use the pulse sensor XD-58C to determine the rate heart and the BPM with labview . so can you help me please
thank you
05-04-2018 06:59 PM
Do you know LabVIEW? If the answer is "No", use some of the links at the beginning of this Forum to learn LabVIEW. [Would you think of doing a Project using Java if you didn't know anything about Java?].
Do you know anything about your sensor? Do you know how it works? How are you planning to acquire data from this sensor? You need to understand your sensor, know its manner of operation, understand what data it provides to you, and know how to get that data into your computer.
Once you are prepared (plan to spend 4-6 hours, minimum, if you are "starting from scratch" to pay attention to the above paragraphs), write a plan (use Word or NotePad, just get the ideas down on the page, including how you plan to incorporate "time" into your data and analysis). Once you are satisfied with the Plan, then implement it in LabVIEW using the skills you have learned.
Bob Schor
05-12-2018 05:45 PM
hii
how are you ,, actually I solve my problem thank you so much
05-14-2018 04:33 AM
@ichrakk wrote:
hii
how are you ,, actually I solve my problem thank you so much
What was your problem and how you solved it?
So that others whoever faces the same issue will get to understand in later point of time.
05-14-2018 06:18 AM
HI
Actually my problem was how to blind the arduino and labview and the pulse sensor, body temperature and the accelerometer BNO055 ,,, so this is my project , you find the arduino code and labview code too .
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
#include <PinChangeInt.h>
#include <eHealth.h>
Adafruit_BNO055 bno = Adafruit_BNO055(55);
int sensor_pin = 0;
int led_pin = 13;
volatile int heart_rate;
volatile int analog_data;
volatile int time_between_beats = 600;
volatile boolean pulse_signal = false;
volatile int beat[10]; //heartbeat values will be sotred in this array
volatile int peak_value = 512;
volatile int trough_value = 512;
volatile int thresh = 525;
volatile int amplitude = 100;
volatile boolean first_heartpulse = true;
volatile boolean second_heartpulse = false;
volatile unsigned long samplecounter = 0; //This counter will tell us the pulse timing
volatile unsigned long lastBeatTime = 0;
void interruptSetup()
{
TCCR2A = 0x02; // This will disable the PWM on pin 3 and 11
OCR2A = 0X7C; // This will set the top of count to 124 for the 500Hz sample rate
TCCR2B = 0x06; // DON'T FORCE COMPARE, 256 PRESCALER
TIMSK2 = 0x02; // This will enable interrupt on match between OCR2A and Timer
sei(); // This will make sure that the global interrupts are enable
}
ISR(TIMER2_COMPA_vect)
{
cli();
analog_data = analogRead(sensor_pin);
samplecounter += 2;
int N = samplecounter - lastBeatTime;
if(analog_data < thresh && N > (time_between_beats/5)*3)
{
if (analog_data < trough_value)
{
trough_value = analog_data;
}
}
if(analog_data > thresh && analog_data > peak_value)
{
peak_value = analog_data;
}
if (N > 250)
{
if ( (analog_data > thresh) && (pulse_signal == false) && (N > (time_between_beats/5)*3) )
{
pulse_signal = true;
digitalWrite(led_pin,HIGH);
time_between_beats = samplecounter - lastBeatTime;
lastBeatTime = samplecounter;
if(second_heartpulse)
{
second_heartpulse = false;
for(int i=0; i<=9; i++)
{
beat[i] = time_between_beats; //Filling the array with the heart beat values
}
}
if(first_heartpulse)
{
first_heartpulse = false;
second_heartpulse = true;
sei();
return;
}
word runningTotal = 0;
for(int i=0; i<=8; i++)
{
beat[i] = beat[i+1];
runningTotal += beat[i];
}
beat[9] = time_between_beats;
runningTotal += beat[9];
runningTotal /= 10;
heart_rate = 60000/runningTotal;
}
}
if (analog_data < thresh && pulse_signal == true)
{
digitalWrite(led_pin,LOW);
pulse_signal = false;
amplitude = peak_value - trough_value;
thresh = amplitude/2 + trough_value;
peak_value = thresh;
trough_value = thresh;
}
if (N > 2500)
{
thresh = 512;
peak_value = 512;
trough_value = 512;
lastBeatTime = samplecounter;
first_heartpulse = true;
second_heartpulse = false;
}
sei();
}
/**************************************************************************/
/* Arduino setup function (automatically called at startup)*/
/**************************************************************************/
void setup(void)
{Serial.begin(9600);
pinMode(led_pin,OUTPUT);
interruptSetup();
/* Initialise the sensor */
if(!bno.begin())
{ /* There was a problem detecting the BNO055 ... check your connections */
Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
while(1); }
bno.setExtCrystalUse(true);}
void loop(void)
{// the loop routine runs over and over again forever:
int8_t temp = bno.getTemp();
Serial.print(temp);
float temperature = eHealth.getTemperature();
// Serial.print("Temperature (ºC): ");
Serial.print(temperature,1);
// Serial.println("");
imu::Vector<3> euler = bno.getVector(Adafruit_BNO055::VECTOR_EULER);
int a=round(abs(euler.x()));
if(a<10000 &a>999) Serial.print(a);
else if(a<1000 & a>99){Serial.print("0");Serial.print(a);}
else if(a<100 &a>9){Serial.print("00");Serial.print(a);}
else {Serial.print("000");Serial.print(a);}
//Serial.print("\tY: ");
int b=round(abs(euler.y()));
if(b<10000 &b>999) Serial.print(b);
else if(b<1000 & b>99){Serial.print("0");Serial.print(b);}
else if(b<100 &b>9){Serial.print("00");Serial.print(b);}
else {Serial.print("000");Serial.print(b);}
// Serial.print("\tZ: ");
int c=round(abs(euler.z()));
if(c<10000 &c>999) Serial.print(c);
else if(c<1000 & c>99){Serial.print("0");Serial.print(c);}
else if(c<100 &c>9){Serial.print("00");Serial.print(c);}
else {Serial.print("000");Serial.print(c);}
Serial.print("\n");
// delay(BNO055_SAMPLERATE_DELAY_MS);
// Serial.print("BPM: ");
if (heart_rate<1000 & heart_rate >99)
Serial.print(heart_rate);
else if (heart_rate <100 & heart_rate > 9)
{Serial.print("0");Serial.print(heart_rate);}
else
{Serial.print ("00");Serial.print(heart_rate);}
delay(200); // take a break
}
08-16-2018 10:21 PM
volatile int peak_value = 512;
volatile int trough_value = 512;
volatile int thresh = 525;
volatile int amplitude = 100;
I am also making project with this sensor.
Please explain me how these values are calculated.
08-17-2018 04:47 AM - edited 08-17-2018 04:48 AM
itisnicetoseeyoumakingsuchanefforttohelpushelpyou.ialwaysputtonsofunformattedcodeinforumpoststoengagethepeoplei'dliketohelpme.perhapsyouwouldbebetteradvisedtofirstreadsomeoftheforumguidelinestonotoffendeveryonebeforetheycouldhelpyou.
regards
05-05-2019 07:31 AM - edited 05-05-2019 07:31 AM
Hei! Can you help me please? I want to do the same thing. In labview an interface for pulse sensor with arduino.
05-06-2019 02:08 AM
Hi Lucian,
It looks like (although never marked as solved) this thread already has a solution.
You can either try implementing the code in the very long post above, if it suits your needs, or you could try opening a new thread to discuss your problem. You'll likely get more and better help if the thread is focused on your issues and your problem is the one described in the first post. When you do this, please try to add as much detail as possible to make it easier for people to give good help/advice.
06-20-2022 01:56 AM
Thank you so much
this code is very important for me
so i can also complete my project