How to apply a Butterworth filter to data of varying sample rate?
I can figure out two options:


Interpolate data
Remember that filters are dynamical systems and solve the corresponding ordinary differential equation (ODE)


In the second method, you basically use the retrieved time step as the time step in the ODE solver. Assuming you have a second order system:

$$\ddot{y}+\frac{\omega_0}{Q}\dot{y}+y\omega_0^2=x\omega_0^2$$

For butterworth, $Q=\frac{1}{\sqrt{2}}$ Introduce two variables $u=y$ and $v=\dot{u}$, and you get two coupled first order ODE:

$$\left\{\begin{aligned}
     \dot{u}&amp;=v\\
     \dot{v}&amp;=x\omega_0^2-u\omega_0^2-\frac{\omega_0}{Q}v
    \end{aligned}\right.$$

Assuming you do not want to have a too high cutoff frequency

$$\left\{\begin{aligned}
   u&amp;\leftarrow u+v\Delta t\\
   v&amp;\leftarrow v+ \left(x\omega_0^2-u\omega_0^2-\frac{\omega_0}{Q}v\right)\Delta t\end{aligned}\right.$$

Where $\Delta t$ is the time difference between two steps. If you want $\omega_0 &gt; \frac{0.25\text{ Hz}}{2\pi}$, you need to consider the Euler backward method, or if you need more accuracy, the trapezoid method.

Addendum

You may not want the overshoots and undershoots of the Butterworth filter. Then, set $Q$ a bit lower. Probably, you want a critically damped system, which do not have any such effects. In that case, set $Q=\frac{1}{2}$. An interesting side-effect of choosing the ODE approach is that you get a filtered derivative for free (it is the $v$ component), if you were to trig on changes in acceleration.