Real time numerical differentiation of signals I am trying to implement a PID controller in Python and I am having some problems with real time numerical differentiation of my my discrete signal. 

I am using the following method:

$$d{\frac{x_n}{t}} = \frac{x_{n-1}-x_n}{d_t}$$

Where $d_t$ is the time difference of the measurement time of $x_n$ and $x_{n-1}$.

The differentiation is accurate to some point but the results on real time systems are not as accurate as I would like to be. The differential controller does not really improve the stability of the system in most cases. At high gains it starts introducing noise into the system.

Most numerical differentiation methods recommend going into the future ($x _{n+1}$) and sadly for my system that's not possible. Such as:

$$\frac{x_{n+1}-x_{n-1}}{2\times d_t}$$

Are there any methods for calculating real-time differentiation with better accuracy?
Your original differentiator, which should be $x(n)-x(n-1)$, is called a "first difference" differentiator. That differentiator amplifies high-frequency noise. As a next step I suggest you try what's called the "central difference" differentiator defined by:

$$ \mathit{Diff} = \frac{x(n)-x(n-2)}{2} $$

which does not amplify high-frequency noise.