I am trying to implement PID control on a sensor signal that has many discontinuities in it. Due to these discontinuities, the differentiated signal does not provide a meaningful or useful signal I can use in my control, rather it is a series of jumps and zero values. Below is a figure showing my sensor data, and a smoothed version below which I've used MATLAB for: 
The smoothed function gives a much more meaningful derivative signal. I did the smoothing with MATLABs smoothing spline cure fitting. However, I realise that this operation will be computationally intensive to do on a microcontroller.
I wanted to ask: how do I go about smoothing my sensor signal on my microcontroller without introducing significant phase delays? The objective is to get a meaningful derivative signal that I can use in my control.