Facing Issue Of Very High Filter Result With LowPass2.0 Filter

by ADMIN 63 views

Introduction

In the world of signal processing, filters play a crucial role in removing unwanted noise and extracting meaningful information from signals. The LowPass2.0 filter is a popular choice for filtering out high-frequency noise and preserving low-frequency components. However, as with any complex system, issues can arise when using this filter. In this article, we will delve into the issue of very high filter results with the LowPass2.0 filter and explore possible solutions.

Background

The LowPass2.0 filter is a 2nd-order low-pass filter designed to remove high-frequency noise and preserve low-frequency components. It is commonly used in various applications, including audio processing, image processing, and sensor signal processing. The filter is implemented using a combination of first-order filters, which are cascaded to achieve the desired 2nd-order response.

The Issue

In a recent video on YouTube, a user demonstrated the use of the LowPass2.0 filter on a STM32 board to filter the ADC measurement of a current sensor (ACS758). The user reported 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). The maximum output value reached 36000, which is significantly higher than the maximum input value of 4095.

Analysis

To investigate this issue, we need to analyze the filter implementation and the possible causes of the high output values. The user reported that the issue occurs only when using the 2nd-order filter object of the LowPass2.0 class. If a first-order filter object is used with the same cutoff frequency, the output is normal. Additionally, if two first-order filters are cascaded, the output is also normal.

Possible Causes

Based on the analysis, there are several possible causes of the high output values:

  1. Numerical instability: The 2nd-order filter implementation may be prone to numerical instability, which can cause the output values to become large.
  2. Overflow: The filter may be overflowing, causing the output values to wrap around and become large.
  3. Rounding errors: The filter may be introducing rounding errors, which can cause the output values to become large.

Solutions

To resolve the issue of very high filter results with the LowPass2.0 filter, we can try the following solutions:

  1. Use a different filter implementation: We can try using a different filter implementation, such as a 1st-order filter or a different 2nd-order filter implementation.
  2. Increase the filter order: We can try increasing the filter order to reduce the high-frequency noise and prevent the output values from becoming large.
  3. Use a different cutoff frequency: We can try using a different cutoff frequency to reduce the high-frequency noise and prevent the output values from becoming large.
  4. Implement a saturation mechanism: We can implement a saturation mechanism to prevent the output values from becoming large.

Conclusion

In conclusion, the issue of very high filter results with the LowPass2.0 filter is a complex problem that requires careful analysis and troubleshooting. By understanding the possible causes of the high output values and trying different solutions, we can resolve the issue and ensure that the filter produces accurate and reliable results.

Recommendations

Based on the analysis and solutions presented in this article, we recommend the following:

  1. Use a different filter implementation: We recommend using a different filter implementation, such as a 1st-order filter or a different 2nd-order filter implementation.
  2. Increase the filter order: We recommend increasing the filter order to reduce the high-frequency noise and prevent the output values from becoming large.
  3. Use a different cutoff frequency: We recommend using a different cutoff frequency to reduce the high-frequency noise and prevent the output values from becoming large.
  4. Implement a saturation mechanism: We recommend implementing a saturation mechanism to prevent the output values from becoming large.

Future Work

In future work, we plan to investigate the numerical stability of the LowPass2.0 filter implementation and explore ways to improve its performance. We also plan to implement a saturation mechanism to prevent the output values from becoming large.

References

  • [1] LowPass2.0 Filter Implementation (YouTube video)
  • [2] STM32 ADC Documentation
  • [3] ACS758 Current Sensor Documentation

Appendix

The following is the code snippet used to implement the LowPass2.0 filter:

LowPass <2> current_sens_adc_filter (4, 4e3, true);

Q: What is the LowPass2.0 filter and how does it work?

A: The LowPass2.0 filter is a 2nd-order low-pass filter designed to remove high-frequency noise and preserve low-frequency components. It is commonly used in various applications, including audio processing, image processing, and sensor signal processing. The filter is implemented using a combination of first-order filters, which are cascaded to achieve the desired 2nd-order response.

Q: What is the issue with the LowPass2.0 filter?

A: The issue with the LowPass2.0 filter is 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). The maximum output value reached 36000, which is significantly higher than the maximum input value of 4095.

Q: Why does the issue occur only with the 2nd-order filter object?

A: The issue occurs only with the 2nd-order filter object because the 2nd-order filter implementation may be prone to numerical instability, which can cause the output values to become large. Additionally, the 2nd-order filter may be overflowing, causing the output values to wrap around and become large.

Q: What are the possible causes of the high output values?

A: The possible causes of the high output values are:

  1. Numerical instability: The 2nd-order filter implementation may be prone to numerical instability, which can cause the output values to become large.
  2. Overflow: The filter may be overflowing, causing the output values to wrap around and become large.
  3. Rounding errors: The filter may be introducing rounding errors, which can cause the output values to become large.

Q: How can I resolve the issue of very high filter results with the LowPass2.0 filter?

A: To resolve the issue of very high filter results with the LowPass2.0 filter, you can try the following solutions:

  1. Use a different filter implementation: Try using a different filter implementation, such as a 1st-order filter or a different 2nd-order filter implementation.
  2. Increase the filter order: Try increasing the filter order to reduce the high-frequency noise and prevent the output values from becoming large.
  3. Use a different cutoff frequency: Try using a different cutoff frequency to reduce the high-frequency noise and prevent the output values from becoming large.
  4. Implement a saturation mechanism: Implement a saturation mechanism to prevent the output values from becoming large.

Q: What are the recommendations for resolving the issue?

A: Based on the analysis and solutions presented in this article, we recommend the following:

  1. Use a different filter implementation: Try using a different filter implementation, such as a 1st-order filter or a different 2nd-order filter implementation.
  2. Increase the filter order: Try increasing the filter order to reduce the high-frequency noise and prevent the output values from becoming large.
  3. Use different cutoff frequency: Try using a different cutoff frequency to reduce the high-frequency noise and prevent the output values from becoming large.
  4. Implement a saturation mechanism: Implement a saturation mechanism to prevent the output values from becoming large.

Q: What is the future work planned for resolving the issue?

A: In future work, we plan to investigate the numerical stability of the LowPass2.0 filter implementation and explore ways to improve its performance. We also plan to implement a saturation mechanism to prevent the output values from becoming large.

Q: What are the references for further reading?

A: The following references provide further information on the LowPass2.0 filter and its implementation:

  • [1] LowPass2.0 Filter Implementation (YouTube video)
  • [2] STM32 ADC Documentation
  • [3] ACS758 Current Sensor Documentation