user10994: I want to implement a digital controller C(z) on an Arduino Uno
(transfer function in the z domain) in order to control a plant
G(s) = 3750/[(s+10)(s+30)(s+100)].

I have implemented G(s) with electronics (op-amps, capacitors and
resistances). I want to realize C(z) on the Arduino Uno. The input to
the Arduino is the error signal (reference − output of G) and the
output of C(z) is the input of G(s). Finally, I will have a closed loop
system with negative unit feedback. The reference input is a unit step
signal (1 volt).
My problem is: how can I use PWM and filters in place of a DAC?

user7508: If you want to use PWM in place of a DAC, the normal thing to do is to
use some kind of analog low-pass filter. However, many people skip the
filter when the signal is meant for some system that inherently acts as
a low-pass. Example: dimming an LED, where the human eye is the filter.
In your case, since your plant looks like a third order low-pass filter
with cuts at 1.6, 4.8 and 16 Hz, you can probably skip the filter.
If you output on pins 5 or 6, the PWM frequency will be around
980 Hz
(exactly: fCPU/16384). At that frequency, your plant gain
relative to DC will be
G(j2π × 980 Hz) / G(0) ≈ 1.3 × 10−7 j
Probably low enough to not be an issue.

10994: <p>I want to implement a digital controller C(z) on an Arduino Uno
(transfer function in the z domain) in order to control a plant</p>

<pre><code>G(s) = 3750/[(s+10)(s+30)(s+100)].
</code></pre>

<p>I have implemented G(s) with electronics (op-amps, capacitors and
resistances). I want to realize C(z) on the Arduino Uno. The input to
the Arduino is the error signal <code>(reference − output of G)</code> and the
output of C(z) is the input of G(s). Finally, I will have a closed loop
system with negative unit feedback. The reference input is a unit step
signal (1 volt).</p>

<p>My problem is: how can I use PWM and filters in place of a DAC?</p>
 7508: <p>If you want to use PWM in place of a DAC, the normal thing to do is to
use some kind of analog low-pass filter. However, many people skip the
filter when the signal is meant for some system that inherently acts as
a low-pass. Example: dimming an LED, where the human eye is the filter.</p>

<p>In your case, since your plant looks like a third order low-pass filter
with cuts at 1.6, 4.8 and 16&nbsp;Hz, you can probably skip the filter.
If you output on pins 5 or 6, <a href="https://www.arduino.cc/en/Reference/analogWrite" rel="nofollow">the PWM frequency will be around
980&nbsp;Hz</a>
(exactly: f<sub>CPU</sub>/16384). At that frequency, your plant gain
relative to DC will be</p>

<p>G(j2π × 980 Hz) / G(0) ≈ 1.3 × 10<sup>−7</sup> j</p>

<p>Probably low enough to not be an issue.</p>
