Arduino Digital Low-Pass Filter 2.0

Arduino Digital Low-Pass Filter 2.0

Improving Current Sensor Readings with Digital Filtering

Introduction to the Project

  • The speaker introduces a new project involving an ACS 712 current sensor, noting that the output is noisy and unreliable due to noise levels around 100 milliamps.
  • The speaker considers using a digital filter to improve the sensor's readings, referencing a previous video on low-pass filtering techniques implemented in Python and Arduino.

Implementing Low-Pass Filtering

  • The speaker presents the difference equations for a first-order low-pass filter and shares code for reading from the ACS 712 sensor, which involves rescaling voltage to current based on specifications.
  • Variables are introduced to store historical data of raw and filtered signals (XNUS1 and YNUS1), essential for applying the difference equation in filtering.

Enhancements in Filtering Technique

  • After initial filtering, the speaker contemplates further improvements by simplifying coefficient derivation; previously done in Python, now integrated directly into Arduino code.
  • A new version of the digital low-pass filter (Arduino digital low-pass filter 2.0) is introduced, allowing users to adjust cutoff frequency without needing external software like Python.

Using the New Filter Class

  • Instructions are provided on how to implement this new filter class within Arduino code: copy it at the top of your script and create instances for each signal requiring filtering.
  • Four parameters are necessary: filter order (first or second), cutoff frequency in Hertz, sampling frequency (estimated as 1 kHz), and a boolean flag for automatic sampling frequency computation based on loop function duration.

Results of Filter Application

Video description

In this video, you'll learn how to use a low-pass filter to clean up a noisy signal on an Arduino. This video offers an easy to use implementation. For details about low-pass filters, see our earlier video: https://youtu.be/HJ-C4Incgpw You can find the code here on our GitHub page: https://github.com/curiores/ArduinoTutorials/tree/main/BasicFilters/ArduinoImplementations/LowPass/LowPass2.0 There's also a high-pass version now: https://github.com/curiores/ArduinoTutorials/blob/main/BasicFilters/ArduinoImplementations/HighPass/HighPass.ino with a few details about the derivation here: https://github.com/curiores/ArduinoTutorials/tree/main/BasicFilters/Design/HighPass