How to implement a high pass filter digitally to remove the dc offset from sensor data I'm trying to implement a high pass filter on sensor data to remove the dc offset. I'm aware I can subtract the mean of the data but I'm looking for a frequency domain approach. I've used the matlab's filterDesigner tool but I'm facing this problem: 
You can see in the time domain output (last plot in blue) that the filter takes some time to settle. I want to minimize that and get similar results as mean subtraction (the plot in orange). Here are the filter specifications.

Can anyone help with me with what parameters to tweek to have no &quot;settling time&quot;? I'm going to implement this on esp32 so I need the order to be low.
I'm pretty new to dsp so please be kind.
The filter you desire is often called a “DC removal” or a “DC cancelation” filter. Unfortunately there’s no way to design a useful IIR DC removal filter that has no “settling time”. Your designed filter’s “transition region” is the lower passband frequency (50 Hz) minus the upper stopband frequency (10 Hz). So your designed filter’s transition region is 40 Hz.
If you design a “sharper” DC removal filter having a transition region of 20 Hz then that filter will have a longer settling time. If you design a DC removal filter having a wider transition region of 100 Hz (a lower “performance” filter) then that filter will have a shorter settling time than the filter you designed. So tryingengineer, you’re faced with a trade-off; the higher the performance of a filter (narrower transition region) the longer will be its settling time.
By the way, IIR filters have nonlinear phase responses. If you seek a computationally-efficient  DC removal filter that has a linear phase response, see the material at:
https://www.dsprelated.com/showarticle/58.php