Troubleshooting serial plotter and BPM from ecg

I have this code that I made to get the ECG on the serial plotter, however it's really noisy, I don't understand how to make it less noisy and more clear like in the oscilloscope:

Also, I'm not getting the right BPM, please advice.

int analogPin = A0; 
int signal = 0; 
int bpm=0;

void setup() {

void loop() {
    signal = analogRead(analogPin); 
  delay (90);// debug value  

if (signal > 100){
    bpm= bpm+1;

    bpm= bpm*6;

if (bpm > 100){
  lcd.print("Sinus Tachycardia");
  } else if (bpm < 60){
    lcd.print ("Sinus Bradycardia");
  } else{
    lcd.print ("Normal Sinus");

Which board are you using?
What is the sensor?

Think about this. First time that your signal is over 100, bpm is incremented and multiplied; so now is 6. Next time through loop, you multiply again and bpm becomes 36 (signal < 100). And the third time through loop() (signal < 100), bpm is multiplied again and becomes 216.

You also never reset bpm so it will overflow.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

The oscilloscope is taking 250,000 samples per second.
Your sketch with a delay of 90ms between readings takes 11 samples per second.

You need to take readings more frequently (lower delay) to get a nicer looking trace.

It;s a breadboard, and I'm not using sensors at all. I'm connecting a wire to the patient simulator directly. I'll make the changes to stop the circuit to do the calculations better. Thank you

So, you're saying that's better if I have my delay maybe at 10ms? Sorry, I'm trying to understand.