-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not displaying BPM and IBI #27
Comments
@VeiTheOne |
I am using Phidget's VINT Hub as the board. The Graph visualizer works fine, and I have been trying to get it to display the BPM. The code works, there's just nothing to get the BPM. And I'm using the code listed here. Here's my current code, which is unchanged. import com.phidget22.*;
VoltageRatioInput heartSensor;
Scrollbar scaleBar;
PFont font;
PFont portsFont;
//Holds heartbeat data
float [] pulses;
float [] scaledPulses;
float zoom;
color eggshell = color(255, 253, 248);
//Sizing of windows
int PulseWindowWidth = 490;
int PulseWindowHeight = 512;
int BPMWindowWidth = 180;
int BPMWindowHeight = 340;
void setup() {
size(700, 600);
frameRate(100);
font = loadFont("Arial-BoldMT-24.vlw");
textFont(font);
textAlign(CENTER);
rectMode(CENTER);
ellipseMode(CENTER);
//Create scroll bar for zooming
scaleBar = new Scrollbar (400, 575, 180, 12, 0.0, 1.0);
pulses = new float[PulseWindowWidth];
scaledPulses = new float[PulseWindowWidth];
//Default zoom
zoom = 0.75;
//Drawing
resetDataTraces();
background(0);
drawDataWindows();
drawHeart();
fill(eggshell);
//Phidgets initialize
try {
//Create
heartSensor = new VoltageRatioInput();
//Address
heartSensor.setHubPort(0);
heartSensor.setIsHubPortDevice(true);
//Open
heartSensor.open(1000);
//Set data interval to minimum | This will increase the data rate from the sensor, and make your graph more responsive
heartSensor.setDataInterval(heartSensor.getMinDataInterval());
}
catch(Exception e) {
e.printStackTrace();
}
}
void drawDataWindows() {
noStroke();
fill(eggshell);
rect(255, height/2, PulseWindowWidth, PulseWindowHeight);
rect(600, 385, BPMWindowWidth, BPMWindowHeight);
}
void drawHeart() {
fill(250, 0, 0);
stroke(250, 0, 0);
smooth();
bezier(width-100, 50, width-20, -20, width, 140, width-100, 150);
bezier(width-100, 50, width-190, -20, width-200, 140, width-100, 150);
strokeWeight(1);
}
void drawPulseWaveform() {
float pulseVal = 0;
try {
pulseVal = (float)heartSensor.getVoltageRatio();
}
catch(Exception e) {
e.printStackTrace();
}
pulses[pulses.length-1] = ((pulseVal - 0.5)* 512); //pulseVal is between 0 and 1. Center and scale up to fit window.
zoom = scaleBar.getPos();
for (int i = 0; i < pulses.length-1; i++) {
pulses[i] = pulses[i+1]; // shifting all raw datapoints one pixel left
scaledPulses[i] = pulses[i] * -zoom + height/2; // adjust the raw data to the selected scale
}
stroke(250, 0, 0);
noFill();
beginShape();
for (int x = 1; x < scaledPulses.length-1; x++) {
vertex(x+10, scaledPulses[x]); //draw a line connecting the data points
}
endShape();
}
void draw() {
background(0);
noStroke();
drawDataWindows();
drawPulseWaveform();
drawHeart();
fill(eggshell);
text("Pulse Sensor Amped Visualizer - Phidgets", 245, 30);
text("IBI",600,585); // TODO for next project
text("BPM",600,200); // TODO for next project
text("Pulse Window Scale " + nf(zoom, 1, 2), 150, 585);
//Manage scroll bar
scaleBar.update (mouseX, mouseY);
scaleBar.display();
}
void resetDataTraces() {
for (int i=0; i<pulses.length; i++) {
pulses[i] = height/2;
}
} |
@VeiTheOne You may need to ask the source of that code about your problems. |
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:"Yu Gothic";
panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
***@***.*** Gothic";
panose-1:2 11 4 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:99.25pt 85.05pt 85.05pt 85.05pt;}
div.WordSection1
{page:WordSection1;}
-->Well, I’m just trying to get a bpm calculation working for an upcoming competition. Thanks tho. Sent from Mail for Windows From: Joel MurphySent: Friday, March 24, 2023 2:50 PMTo: WorldFamousElectronics/PulseSensor_Amped_Processing_VisualizerCc: Vei The One; MentionSubject: Re: [WorldFamousElectronics/PulseSensor_Amped_Processing_Visualizer] Not displaying BPM and IBI (Issue ***@***.*** is not the code that is in this repo.I don't have experience with Phidget.You may need to ask the source of that code about your problems.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***> Virus-free.www.avast.com
|
Ok, Email looks like shit.
|
And they don't have an issues page. |
Dang. Is there any community around it? A forum or anything? Our PulseSensor Arduino library does all the work to find the heartbeat in the signal and derive BPM and IBI. |
We got 3 pulse sensors from Phidgets. And I can't seem to find it. We were able to display the raw voltage, but none of us have yet to figure out how to get it to display the BPM. What's worse is that they said on the Phidgets page says "Stay tuned for part two." of the project. There has never been updates since, and that's where I'm stuck at, sadly. I'm using a VINT HUB0001_0 from Phidgets as the "board". |
Interesting. Looks like a lot of engineering for some simple interfacing. It would take some ramping up for us to make PulseSensor compatible with Phidgets. |
It says in the code that it's TODO for next project. Has anyone done this second project?
Plus, how can I have it show the BPM and IBI? I am using the Phidget VINT hub if that's a factor.
The text was updated successfully, but these errors were encountered: