# Can I implement continuous time feedback regulator in an Arduino microcontroller?

Arduino is a digital mikrocontroller. But I wonder if it's possible to implement an continuous time feedback regulator in an Arduino microprocessor?

Continuous time feedback regulators such as PID:

$$K = P(e(t)-D\frac{\mathrm{d} }{\mathrm{d} x}e(t) + I\int_{0}^{\infty} e(t) dt)$$

Or LQG regulator (this is a LQR with kalmanfilter only, not the model): $$\dot{\hat{x}} = (A - KC)\hat{x} + Bu + Ky + Kn - KC\hat{x}$$

$$u = r - K\hat{x}$$

Or do it need to be a digital feedback regulator? I mean....those feedback regulators works exellent by using operational amplifiers.

I know that operational amplifier works in real time. But an Arduino working in 16 Mhz speed, and that's very fast too.

continuous time feedback regulator in an Arduino microprocessor.

You can get at most a very accurate approximation of the continuous time system using Arduino by converting the continuous time model of your system into a discrete-time version: once you have the transfer function of you continuous time control system (filter or controller) you can operate a discretization through some well-known method such as the Bilinear transform and then obtaining the digital (dicrete-time) version to implement.

PS: do not confuse the real-time with the continuous time.

EDIT: Every time you deal with the "digital world" (memories, sample&hold processing) you need a discrete-time version of your continuous time model. You cannot directly implement it as it is (beside using an automatic code generator, but even in that case an automatic conversion continuous-to-discrete is also needed). Just to have an example, if you have a simple low-pass filter, easy to build with analog electronic components (resistor and capacitor) as: $$W(s) = \frac{1}{1+sRC}$$

to implement it into a discrete-time system (such as microcontroller) you need its discrete time version which will have comparable performance under certain conditions:

$$W(z) = {\frac {1+z^{{-1}}}{(1+2RC/T)+(1-2RC/T)z^{{-1}}}}$$

The most important thing to observe when a model of a system is converted is Nyqvist-Shannon sampling theorem.

• Comments are not for extended discussion; this conversation has been moved to chat. – Mark Booth Jun 30 '17 at 10:28