Hi everyone,
New member here (apologies in advance if my post doesn't follow the group etiquette).
I'm using the Teensy 4.0 to read data from a sensor via I2C. My code is a slight variation of the sensor company's code; please find that code here. The delay() has been changed so the data is read in the range of 6-30 Hz, and I'm writing the data out via serial. Each value from the sensor is a short, and the values range from 255 to 1024 (no decimals or floating point).
There is some low frequency noise in the data, so I'd like to implement a low-pass filter on the Teensy to clean up the data. I'd like the filtering to be quick and energy-efficient (that's more important than perfect, high-fidelity filtering).
I read that the Teensy Audio Library has been optimized to use the DSP instructions and works well, but I couldn't figure out how to use the biquad or FIR filters from the Audio Library with non-audio inputs. In the Teensy audio example code for a biquad filter and example code for FIR filter, the input that was filtered was i2S. And in the Teensy Audio System Design tool, I wasn't sure if any of the input options would work for my system; in my code, each new sensor value is stored in a short. I also didn't know if I could change "AUDIO_SAMPLE_RATE_EXACT" to the frequency of my signal (I see that its in audiostream.h, not sure if I can modify Teensy core code). Additionally, I don't know enough about the DSP instructions to know if they'd be helpful for filtering my data values that are shorts, and not 32bit or 64bit.
Could you please share any advice on how to implement an energy efficient low pass filter for my sensor data? I'd prefer to use a library instead of seeking out the individual DSP instructions and writing something from scratch. To be clear, I am not using the Teensy audio board.
Thanks so much in advance! Also shoutout to all the developer and community members of Teensy - I've learned so much from y'all.
Best,
SK
New member here (apologies in advance if my post doesn't follow the group etiquette).
I'm using the Teensy 4.0 to read data from a sensor via I2C. My code is a slight variation of the sensor company's code; please find that code here. The delay() has been changed so the data is read in the range of 6-30 Hz, and I'm writing the data out via serial. Each value from the sensor is a short, and the values range from 255 to 1024 (no decimals or floating point).
There is some low frequency noise in the data, so I'd like to implement a low-pass filter on the Teensy to clean up the data. I'd like the filtering to be quick and energy-efficient (that's more important than perfect, high-fidelity filtering).
I read that the Teensy Audio Library has been optimized to use the DSP instructions and works well, but I couldn't figure out how to use the biquad or FIR filters from the Audio Library with non-audio inputs. In the Teensy audio example code for a biquad filter and example code for FIR filter, the input that was filtered was i2S. And in the Teensy Audio System Design tool, I wasn't sure if any of the input options would work for my system; in my code, each new sensor value is stored in a short. I also didn't know if I could change "AUDIO_SAMPLE_RATE_EXACT" to the frequency of my signal (I see that its in audiostream.h, not sure if I can modify Teensy core code). Additionally, I don't know enough about the DSP instructions to know if they'd be helpful for filtering my data values that are shorts, and not 32bit or 64bit.
Could you please share any advice on how to implement an energy efficient low pass filter for my sensor data? I'd prefer to use a library instead of seeking out the individual DSP instructions and writing something from scratch. To be clear, I am not using the Teensy audio board.
Thanks so much in advance! Also shoutout to all the developer and community members of Teensy - I've learned so much from y'all.
Best,
SK