SDP8XX Low Pass Filter

Greetings,

I am trying to set a low pass filter to the code below on my Arduino Uno since I just wanna record data below 20 Hz (in the range of infrasound).
Unfortunately, I couldn't find any detail about LPF in the SPD810 datasheet. Can anybody please help me?

#include <Wire.h> 

void setup() {
  Wire.begin();
  Serial.begin(115200);

// //Differential Pressure,Triggered
  Wire.beginTransmission(0x25);
  Wire.write(0x37);
  Wire.write(0x2D);   
  Wire.endTransmission();
}

void loop() { 
  Wire.requestFrom(0x25, 9);
  for(int i=0; i<9; i++)
  {
    myData[i] = Wire.read();
  }
  
  int16_t Pressure_raw = myData[0]<<8|myData[1]; // Raw Pressure Data 
  //myData[2] = CRC of Pressure data
  
  float SF_pressure = myData[6]<<8|myData[7];  //Scale factor for differential pressure
  //myData[8] = CRC of scale factor data
  double Pressure = Pressure_raw/SF_pressure; 
   
Serial.print(Pressure,4);
Serial.print("\n");

  delay(50);   
}

According to the data sheet, section 5.2, in continuous mode:

When the reading speed is even slower than 25 ms, the sensor will continue to average, but with another algorithm. In this algorithm exponential smoothing is used, with a smoothing factor 𝛼 = 0.05.

I assume the sample interval in this case is 0.5 msec.

To implement a frequency cutoff using triggered mode and your own exponential filter, see this discussion of how to calculate the time constant: digital filters - Exponential weighted moving average time constant - Signal Processing Stack Exchange

1 Like

Thanks for your reply! :hugs: : :star_struck:

It may be the answer to my question but I have no idea about mathematics and just try to learn to program. So I couldn't use this discussion to calculate the time constant. Thanks anyway

What is special about 20 Hz? As your code stands, you sample the sensor in triggered mode every 50 milliseconds (20 Hz rate). In this case, pressure variations with frequency higher than 10 Hz (the Nyquist limit) will introduce potentially severe aliasing artifacts into the sampled data.

If this were my my project, I would take data as fast as the sensor can produce (which is considerably faster than the sensor step response of < 3 ms) and apply a standard low pass digital filter. There are web pages that will write the filter code.

1 Like

I am using SDP810 to measure the infrasound generated by the wind turbines. So it is important for this work that the sensor just record the frequencies under 20 Hz.
The FFT result shows me aliasing, so I want to prevent it by adding a filter to this code.

Great idea. I will use your suggestion to improve this and have to research more about writing the filter code. I hope I can find sth.

You might try TFilter http://t-filter.engineerjs.com

1 Like

If there's aliasing in the data you are reading there's no way to remove it - you have to prevent aliasing before the data is sampled. This probably means a combination of acoustic filtering over the sensor and sampling the sensor at full rate followed by a multi-pole low-pass digital filter.

If the sampling rate is 2kSPS for instance the acoustic filter's job is to prevent any energy at or above 1kHz from reaching the sensor, and the digital filter removes the signals between 10Hz and 1kHz (say).

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