This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123GXL: Digital Filtering



Hi,
I need to apply a high pass filter to a stream of data coming from an accelerometer. I can't apply a physical circuit filter because the data is coming in digitally via I2C from a 9-axis IMU. So I need to apply a digital high pass filter. I don't know much about digital filtering, but a friend did something similar with a 5th order butterworth high pass, so I thought I'd try there.

I hoped there might be some sort of filter library included in TivaWare but I haven't been able to find one. Is there a resource for digital filtering on the tiva launchpad platform? A part of the TivaWare library I've missed, or a generic C library someone could recommend me, or something like that?

Thank you.

  • Hello Zero_PD

    Did you check for CMSIS-DSP. A general google search for CMSIS DSP High Pass will show quite some resources,

    Regards
    Amit
  • I would like to second Amit here - the CMSIS DSP lib does provide several filter implementations.

    However, most accelerometers I know do have configuration options to limit the output rate, or pre-filter tha data. This would require reading IMU/accelerometer datasheet and probably changing some configuration register settings, but the runtime impact of this filtering on the MCU would be zero.

  • Thanks Amit, FM. My knowledge of DSP is so limited that the CMSIS-DSP library is hard to understand but I'll spend some time working on its sense. If anyone's familiar with whether it can do highpass filters let me know.

    I'm using the bno055. It's doing some internal filtering since it is a sensor fusion 9-axis board, but I thought an explicit external high pass filter might make the acceleration data cleaner. An acquaintance had better luck with his double integration to position when he ran the data from the bno055 through a butterworth highpass filter.
  • To ease experimentation with digital filters, I suggest you check out this site:

    In addition to nice plots, you get almost-ready-to-run C code.

  • This is a competitor's but it is a good general purpose reference. I think they missed a few things but it is a very good start

    www.analog.com/.../scientist_engineers_guide.html

    Also "Numerical Recipies" has a small section on filtering although it's more geared to analysis than control (the Fortran version is preferred IMO)

    Robert
  • Also don't underestimate the value of a simple filter. Sometimes you need a complex filter but many times a simple filter is sufficient and does not suffer the cost of a higher order filter.

    Robert
  • Big guns here have well advised and provided key/critical links to boost understanding.

    Yet - using a (likely) unstable signal generator (your complex device) may not prove the optimal means/method to gauge the effectiveness of your "digital filter."

    Instead - might a carefully prepared series of "hard values" (in place of your sensor's outputs) provide a better check of your filter's performance?
  • Good thought that.

    I have simulated an IIR in a spreadsheet for that purpose. The biggest difficulty was making sure the calculations were integer based. It was an integer based IIR and there are differences between integer and floating point implementations.

    Robert