LCD Screen with pulse sensor

Hi guys

So I using this code from pulsesensor.com and I want to show the heart rate on an LCD screen. I have this LCD screen http://www.hobbytronics.co.uk/lcd-16-2-backlight-blue?keyword=lcd.

I have attached the code but to make it easier the code is:

#define PROCESSING_VISUALIZER 1
#define SERIAL_PLOTTER 2

// Variables
int pulsePin = 0; // Pulse Sensor purple wire connected to analog pin 0
int blinkPin = 13; // pin to blink led at each beat
int fadePin = 5; // pin to do fancy classy fading blink at each beat
int fadeRate = 0; // used to fade LED on with PWM on fadePin

// Volatile Variables, used in the interrupt service routine!
volatile int BPM; // int that holds raw Analog in 0. updated every 2mS
volatile int Signal; // holds the incoming raw data
volatile int IBI = 600; // int that holds the time interval between beats! Must be seeded!
volatile boolean Pulse = false; // “True” when User’s live heartbeat is detected. “False” when not a “live beat”.
volatile boolean QS = false; // becomes true when Arduoino finds a beat.

// SET THE SERIAL OUTPUT TYPE TO YOUR NEEDS
// PROCESSING_VISUALIZER works with Pulse Sensor Processing Visualizer
// GitHub - WorldFamousElectronics/PulseSensor_Amped_Processing_Visualizer: Processing code for pulse wave visualization
// SERIAL_PLOTTER outputs sensor data for viewing with the Arduino Serial Plotter
// run the Serial Plotter at 115200 baud: Tools/Serial Plotter or Command+L
static int outputType = SERIAL_PLOTTER;

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
// IF YOU ARE POWERING The Pulse Sensor AT VOLTAGE LESS THAN THE BOARD VOLTAGE,
// UN-COMMENT THE NEXT LINE AND APPLY THAT VOLTAGE TO THE A-REF PIN
// analogReference(EXTERNAL);
}

// 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
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
}

ledFadeToBeat(); // Makes the LED Fade Effect Happen
delay(20); // take a break
}

void ledFadeToBeat(){
fadeRate -= 15; // set LED fade value
fadeRate = constrain(fadeRate,0,255); // keep LED fade value from going into negative numbers!
analogWrite(fadePin,fadeRate); // fade LED
}

Thanks

PulseSensorAmped_Arduino_1.5.0.ino (3.25 KB)

Can someone help me through this?

Is there a question? What results are you getting? What results do you want?

Paul

The code you posted and attached doesn't compile anyway: it's incomplete. No point trying to get an lcd to work before you find the rest of the code.

The function "interruptSetup()" is missing, and I think once that's found it will complain about missing "serialOutputWhenBeatHappens()".

You sure you grabbed the whole sketch from wherever you found it?

Sorry there were 3 more files. I want to display the heart rate on the lcd.

AllSerialHandling.ino (1.22 KB)

Interrupt.ino (5.58 KB)

PulseSensorAmped_Arduino_1.5.0.ino (3.25 KB)

Timer_Interrupt_Notes.ino (12.1 KB)

I want to display the heart rate on the lcd.

Permission granted. Knock yourself out.

If you have a question about how to do that, feel free to ask it.

Hi

Yeah. If someone can help me that would be great

Well it looks to me like the variable you want to show is BPM.

But first you need to write or find a short sketch that gets your lcd working: they come in different flavours so you need to forget the pulse program for a while and get your lcd working.

Once you have that sorted you'll probably have a thing like myLCD.print(myVariable).

Start here or go to your lcd manufacturer's page and see what they have.

Once you have it working in a sketch of its own, copy all that crap into your main heartbeat sketch.. the library call, the begin and whatnot, and then you should be able to do a line like myLCD.print(BPM);

But start with just the lcd is my advice.

Hi I've done the hello world examples and got it to work. How would I display the bpm onto the screen?

vansarecool:
Hi I've done the hello world examples and got it to work. How would I display the bpm onto the screen?

By replacing the string "hello world" with your BPM variable.

Paul

It only shows the text. I want it to constantly change

vansarecool:
I've done the hello world examples

You could have mentioned that higher up the thread...

vansarecool:
It only shows the text. I want it to constantly change

Then post that code and someone can help.

What do you mean "the text"?

Got it working thanks guys

vansarecool:
Got it working thanks guys

Cool: perhaps post the fix for the benefit of someone else with similar problem?