Could an oscilloscope display the same shape of the signal as the serial plotter?

Hello Community!!

I'm looking forward to doing a simulation on proteus 8 of my signal that is related to my heartbeat sensor.

I'm expecting to display on the oscilloscope the same shape of the signal that is displayed on the serial plotter.

What else can I provide to get some help ?

I'm a newbie, so please just be patient!!


proteus simulation

Here is the code that I'm working with :



```
/*  PulseSensor Starter Project and Signal Tester
    The Best Way to Get Started  With, or See the Raw Signal of, your PulseSensor.com™ & Arduino.

    Here is a link to the tutorial
    https://pulsesensor.com/pages/code-and-guide

    WATCH ME (Tutorial Video):
    https://www.youtube.com/watch?v=RbB8NSRa5X4


  -------------------------------------------------------------
  1) This shows a live human Heartbeat Pulse.
  2) Live visualization in Arduino's Cool "Serial Plotter".
  3) Blink an LED on each Heartbeat.
  4) This is the direct Pulse Sensor's Signal.
  5) A great first-step in troubleshooting your circuit and connections.
  6) "Human-readable" code that is newbie friendly."

*/


//  Variables
int PulseSensorPurplePin = 0;        // Pulse Sensor PURPLE WIRE connected to ANALOG PIN 0
int LED10 = 10;   //  The on-board Arduion LED


int Signal;                // holds the incoming raw data. Signal value can range from 0-1024
int Threshold = 550;            // Determine which Signal to "count as a beat", and which to ingore.


// The SetUp Function:
void setup() {
  pinMode(LED10, OUTPUT);        // pin that will blink to your heartbeat!
  Serial.begin(9600);         // Set's up Serial Communication at certain speed.

}

// The Main Loop Function
void loop() {

  Signal = analogRead(PulseSensorPurplePin);  // Read the PulseSensor's value.
  // Assign this value to the "Signal" variable.

  Serial.println(Signal);                    // Send the Signal value to Serial Plotter.


  if (Signal > Threshold) {                        // If the signal is above "550", then "turn-on" Arduino's on-Board LED.
    digitalWrite(LED10, HIGH);
  } else {
    digitalWrite(LED10, LOW);               //  Else, the sigal must be below "550", so "turn-off" this LED.
  }


  delay(10);


}
```

It looks like you missed to connect GND to the scope.

A scope can show more precise curves than the Serial Plotter, provided it's connected and configured properly.

Did you use a real heartbeat sensor and scope or is it all simulated?

Note also that the serial plotter X axis is related to samples being received not time, so it's not exactly something like the scope where the X axis is real time unless you do print out data using some sort of time base and not just when readings are done.

for example this code

int x = 1;
void setup() {
  Serial.begin(115200);
  while (!Serial);
  Serial.println(F("f(x)"));
}

void loop() {
  Serial.println(x);
  x = -x;
  delay(random(100, 1000));
}

shows a perfect frequency

whereas the delays in between two samples vary between 100ms and 1s.

The following code would be the same signal as seen by a scope monitoring the x variable at 10Hz

int x = 1;
unsigned long printTime;
unsigned long randomDelay;
unsigned long lastRandom;

void setup() {
  Serial.begin(115200);
  while (!Serial);
  Serial.println(F("f(x)"));
  randomDelay = random(100, 1000);
}

void loop() {
  // print at 10Hz
  if (millis() - printTime >= 100) { // 10Hz
    printTime += 100;
    Serial.println(x);
  }

  if (millis() - lastRandom >= randomDelay) {
    x = -x;
    lastRandom += randomDelay;
    randomDelay = random(100, 1000);
  }
}

You'll see this on the scope / arduino serial plotter


clearly highlighting the fact that x evolution is not the perfect period we were seeing in the first example

It seems like the analogRead function is receiving a simulated input from the heart monitor, but the scope is only receiving a distorted digital on-off or square wave type signal.
Simulation problem? Have you check with the Proteus boards about connecting the scope to the simulated input signal?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.