Skip to content
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

Interfacing pulse senor with display shows abnormal reading #68

Open
bhavindave9 opened this issue Mar 13, 2018 · 2 comments
Open

Interfacing pulse senor with display shows abnormal reading #68

bhavindave9 opened this issue Mar 13, 2018 · 2 comments

Comments

@bhavindave9
Copy link

My main aim is to count Beats per minute form pulse sensor and displaying it on a display.
I am using the code from the example section of the pulsesensor playground. and clubbing it with my display.

I am using the following to build my project-
Pulse sensor
Arduino Uno
Nokia 5110 LCD display

Problem -
As I am using the code from examples as well as I have created a custom code to display the bpm along with the graphics.

  1. Both the code are running correctly without any error individually i.e [ 1) detecting the heartbeat and calculating bpm 2) custom display to display an integer for about a second ].
    But when I club both the code together code together to display bmp on display for a second and refreshing it, the program starts to malfunction and shows garbage value when there is no figure on sensor.

My assumption and doubt-
it is not advised to use delay for more than 20ms. but if I print the calculated bpm on display with the 20ms display it cannot be visible to the human eye and if I increase delay t0 200ms the pulse sensor will skip a beat and malfunction )

so what is the possible solution for it?

I tied to use millis() but it seems both timers cannot work together and throw a compilation error for uno.

please help me

I really appreciate it.

thanks
lcd.zip

@biomurph
Copy link
Contributor

IT doesn't look like the LCD library is messing too much with the Pulse Sensor code, but there must be something happening. It looks like the LCD library is using direct port control of the Arduino.
You might want to try to use the BPM_Alternative example. In that case I would suggest the following changes to what you already have.
First, don't use any delays in your loop.
Second, add a variable lastBPM that you can compare myBPM with

if (pulseSensor.sawStartOfBeat()) 
{
myBPM = pulseSensor.getBeatsPerMinute();      
if(myBPM != lastBPM){     
lastBPM = myBPM;
myGLCD.setFont(BigNumbers);
myGLCD.printNumI(myBPM, 11, 20);
myGLCD.update();
}
}

I don't know what therm is or what you're trying to do with that.

If you only update the LCD when the BPM changes, you won't be hitting it so hard.

Also, your threshold is set pretty high
Also, you are declaring Serial.begin twice...

@bhavindave9
Copy link
Author

Okay, thanks for the suggestions. I will try to update the code and let you know. Your suggestions are always appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants