NESSO N1 docs page - line plotter graphs

The NESSO N1 Arduino Docs web page has two graphs which plot data, but do not constrain the graphs within minimum and maximum data values allowing the line plotter to auto-adjust to a moving min/max. Not visually pleasing.

https://docs.arduino.cc/tutorials/nesso-n1/user-manual/#visualizing-the-output

Consider using a sketch similar to this for a pleasing visualization:

// line plotter using constant minimum and maximum values to keep graph from resizing

const int plotMIN = 0;
const int plotMAX = 1023;

void setup() {
  Serial.begin(1115200);
}

void loop() {
  Serial.print(plotMIN); // minimum value data point to plot
  Serial.print(","); // separator between data points
  Serial.print(analogRead(A0)); // floating value data point
  Serial.print(",");
  Serial.print(analogRead(A1));
  Serial.print(",");
  Serial.print(analogRead(A2));
  Serial.print(",");
  Serial.print(plotMAX); // maximum value data point to plot
  Serial.println(); // CR/LF sends this set of data points to line plotter
}

Same fun on the digital side...

// line plotter using constant minimum and maximum values to keep graph from resizing

const float plotMIN = -0.1;
const float plotMAX = 1.1;
unsigned long timer, timeout = 500;

void setup() {
  Serial.begin(1115200);
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  if (millis() - timer > timeout) { // compare "now" to timeout variable
    timer = millis(); // reset timer
    digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); // invert digital reading
  }
  Serial.print(plotMIN); // minimum value data point
  Serial.print(","); // separator between data points
  Serial.print(digitalRead(LED_BUILTIN)); // plot LED_BUILTIN value
  Serial.print(",");
  Serial.print(plotMAX); // maximum value data point
  Serial.println(); // CR/LF sends data points to plotter
}

One possible issue I can imagine is when the sensor data operates in a very small dynamic range For example, if a vibration sensor only outputs values between 498 and 502 using fixed min/max like 0 and 1023 will flatten the plot completely everything becomes a straight line. In that case the plot hides all the meaningful variation that would be visible with auto-scaling

It was an example range, not the only range. Adjust accordingly.

int plotMIN = 495;
int plotMAX = 505;

The digital example ranges from -0.1 to 1.1 to address your concern.

Yeah true you can adjust the min/max manually but I was mostly thinking about cases where the range shifts over time If the sensor baseline drifts fixed values might need constant retuning Not a big issue but something to keep in mind

Then you would add to the example sketch a range detection function to adjust min/max over time, and not use constants, as in the example sketch.

Not an issue at all. This was not for copy/paste. It was to create an animated plot that did not go higgldy piggldy... on official documentation.

Got it thanks for clarifying I wasn’t criticizing the example I just thought about scenarios where the data range drifts If the goal was only to keep the animation steady then yeah your approach makes sense

Any scenario can be programmed to work.

See Post #1.