Not sure about Sampling Frequency

Hello

Im new to Arduino and Im having trouble with some data sampling. I’m using a MAX30102 Sensor in wich I’ve configured the Sampling Rate at 200 Hz (8 bits for the ADC range), through I2C comunication. and sending the data through serial COM3 at 115200 bauds.

When I read the data on matlab I get a 5000 sample vector (reading data for 120 seconds or 3 minutes). So Im wondering why this is happening since Im getting around 40 SPS.

I must add Im also using the Analog Read for a thermistor. But Ive read the clock for ARDUINO UNO is 16 MHz so I guess it should be a problem.

Then Again Im a bit of a noob with this stuff, so any guidance in this matter would be most Helpful.

Thanks in advance

Hi; I've looked at the data sheet for the MAX30102 and can see no problem; could you add the relevant sections of your code to make all this clearer?

Hello thanks for your reply, my code is s:

void setup()
{
  Serial.begin(115200);
  Serial.println("Initializing...");

  // Initialize sensor
  if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) //Use default I2C port, 400kHz speed
  {
    Serial.println("MAX30105 was not found. Please check wiring/power. ");
    while (1);
  }

  
  byte ledBrightness = 0x1F; //Options: 0=Off to 255=50mA
  byte sampleAverage = 8; //Options: 1, 2, 4, 8, 16, 32
  byte ledMode = 2; //Options: 1 = Red only, 2 = Red + IR, 3 = Red + IR + Green
  int sampleRate = 200; //Options: 50, 100, 200, 400, 800, 1000, 1600, 3200
  int pulseWidth = 411; //Options: 69, 118, 215, 411
  int adcRange = 4096; //Options: 2048, 4096, 8192, 16384

  particleSensor.setup(ledBrightness, sampleAverage, ledMode, sampleRate, pulseWidth, adcRange); //Configure sensor with these settings



}

void loop()
{
int  analogPin = A1;
  Serial.println(particleSensor.getIR()); //Send raw data to plotter
  Serial.println(analogRead(analogPin));

Its nothing special, thats why im worried

Again thanks for your reply, Im most grateful

I’m not sure serial print can operate at those speeds. Perhaps another member might help?