Hi I have a project called SPO2 monitoring device which I have to monitor the % of oxygen in the blood. I have built up the circuit that will send, amplify and filter the signal to arduino and I have to convert it to find BPM and % of SPO2. I have code down the code to find SPO2 but however I have a problem in coding down the code to get BPM. Can any kind soul help me in this? I need the algorithm to get BPM of the heart. Deadline for my project is next week....
Posting the same question to different parts of the forum is unlikely to endear you forum members, but don't worry, I deleted the other one for you before anyone else found it.
You have a digital input that is ticking away with the heartbeat...
There are two methods to determine the rate...
Time the interval between pulses, and extrapolate out to 60 secs, or
Start a timer, begin counting - then after (say 5 secs), you have a number of pulses... multiply by 12 to get the beats per minute (5x12 = 60)
lastchancename:
You have a digital input that is ticking away with the heartbeat...
There are two methods to determine the rate...
Time the interval between pulses, and extrapolate out to 60 secs, or
Start a timer, begin counting - then after (say 5 secs), you have a number of pulses... multiply by 12 to get the beats per minute (5x12 = 60)
Does that help?
What do u mean there's a digital input ticking away with the heartbeat? For which pin you're referring to?
Where did the diagram come from.
I see several things in there that I can't explain.
An IR LED with 38nA drive current.
An NPN photo transistor with collector to ground.
An LM358 loaded with 1uF.
?
Leo..
Wawa:
Where did the diagram come from.
I see several things in there that I can't explain.
An IR LED with 38nA drive current.
An NPN photo transistor with collector to ground.
An LM358 loaded with 1uF.
?
Leo..
I drew the diagram on eagles software. The 1uF loaded is basically HPF. Wht do u mean things that you can't explain?
Bad practice to load (short) the output of an opamp with a large capacitance.
I have listed two other things.
An IR LED has a Vf of ~1.2volt at low currents.
If you use a 5volt supply and a 100k current limiting resistor, you get 0.038mA through the LED.
That will barely light it up.
Sparkfun uses 470ohm (8mA).
Never seen a photo transistor used like that (Does C1 ever discharge?).
Maybe you can explain.
Leo..
Wawa:
Bad practice to load (short) the output of an opamp with a large capacitance.
I have listed two other things.
An IR LED has a Vf of ~1.2volt at low currents.
If you use a 5volt supply and a 100k current limiting resistor, you get 0.038mA through the LED.
That will barely light it up.
Sparkfun uses 470ohm (8mA).
Never seen a photo transistor used like that (Does C1 ever discharge?).
Maybe you can explain.
Leo..
Thanks I will change the value of the resistor to a lower value. What would be a recommended value you would suggest to replace it?
Wawa:
Bad practice to load (short) the output of an opamp with a large capacitance.
I have listed two other things.
An IR LED has a Vf of ~1.2volt at low currents.
If you use a 5volt supply and a 100k current limiting resistor, you get 0.038mA through the LED.
That will barely light it up.
Sparkfun uses 470ohm (8mA).
Never seen a photo transistor used like that (Does C1 ever discharge?).
Maybe you can explain.
Leo..
I've placed the values wrongly on the schematic drawing. It's a 1k resistor.
camelbak123:
...however I have a problem in coding down the code to get BPM. Can any kind soul help me in this? I need the algorithm to get BPM of the heart....
I think your problem and deadline is more than finding an algorithm.
Sometimes we can help with a few lines of code, but you're missing the hardware - so you can't write any testable code until that's done.
lastchancename: I think your problem and deadline is more than finding an algorithm.
Sometimes we can help with a few lines of code, but you're missing the hardware - so you can't write any testable code until that's done.
But i got the waveform of the pulse ranging from 0.5-3hz from this circuit though..
What do u mean there's a digital input ticking away with the heartbeat? For which pin you're referring to?
So everyone was chasing 'that' statement.
If you have the heartbeat pulsing as you want it then let's start again...
Assuming the pulse amplitude is around 0-5V approximately - the Arduino can detect it easily.
If the pulse is less than that - then you may need to revisit the hardware.
Show us your code in </> code tags
If the sensor is working, then it's relatively trivial to detect and start thinking about your solution in code. Try the digitalRead() examples on your nominated Arduino input pin, and flash a LED, or send a character to the Serial Monitor to see how it works.
lastchancename:
OK.... you said in an earlier post...So everyone was chasing 'that' statement.
If you have the heartbeat pulsing as you want it then let's start again...
Assuming the pulse amplitude is around 0-5V approximately - the Arduino can detect it easily.
If the pulse is less than that - then you may need to revisit the hardware.
Show us your code in </> code tags
If the sensor is working, then it's relatively trivial to detect and start thinking about your solution in code. Try the digitalRead() examples on your nominated Arduino input pin, and flash a LED, or send a character to the Serial Monitor to see how it works.
Yeah I have the pulse waveform ranging from 0.5-3hz approx. I think i drew the schematic wrongly. The sensor is working too as i tested it on the oscilloscope. Why do i need to use digitalRead() as the sensor reading is going to be analog. Shouldn't it be analogRead instead? I'm confused between the two. Thanks for yr guidance
That wasn't the question. The frequency is irrelevant in this low-rate project.
Can you take a screen shot of your scope - showing the pulse waveform, or at least describe it for us.
digitalRead() and analogRead() are similar in many ways, but I can't immediately see what is analog about the pulse 'rate'... if it was blood 'pressure' then maybe.
What you need to do is read the input() - whichever one - then do the appropriate time/period calculation across the period between pulses as suggested in post #3 to derive the BPM.
If you need to filter the analog slope of the input waveform, then that is beyond the scope of this question - and indeed may be easier to handle in the analog front-end.
That wasn't the question. The frequency is irrelevant in this low-rate project.
Can you take a screen shot of your scope - showing the pulse waveform, or at least describe it for us.
digitalRead() and analogRead() are similar in many ways, but I can't immediately see what is analog about the pulse 'rate'... if it was blood 'pressure' then maybe.
What you need to do is read the input() - whichever one - then do the appropriate time/period calculation across the period between pulses as suggested in post #3 to derive the BPM.
If you need to filter the analog slope of the input waveform, then that is beyond the scope of this question - and indeed may be easier to handle in the analog front-end.
Hi this is the waveform. It's slightly noisy as my notch filter is not working well..