-
Notifications
You must be signed in to change notification settings - Fork 187
Description
Hi,
I saw your video on YouTube (https://www.youtube.com/watch?v=eM4VHtettGg&ab_channel=CurioRes) demonstrating the LPF2.0.
I just tried your filter on my STM32 board to filter the ADC measurement of a current sensor (ACS758).
Just like in your video, I set up the 2nd-order LPF with a 4 Hz cutoff, as shown below:
LowPass <2> current_sens_adc_filter (4, 4e3, true);
However, I noticed that occasionally, the filter result "jumps" to a very high result despite the input being normal, or despite the input being zero (ADC pin pulled down to GND).
STM32 has a 12-bit ADC, so 4095 is the maximum number that can be input to the filter as a raw value, but sometimes I see that the output reaches even 36000.
I figured out that this happens only when I use the 2nd-order filter object of your class.
If I use a first-order filter object with the same cutoff frequency, the output is normal.
If I cascade two first-order filters, then also the output is normal.
I can conclude that the result jumps only when I use the 2nd-order filter object.
Can you please check?
Thanks,
Divyanshu
www.dtpc.in