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?
1 Answer 1
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.
-
Generally have you got any other information for this project;Νίκος-Μάριος Κοκολάκης– Νίκος-Μάριος Κοκολάκης2015年07月10日 13:25:11 +00:00Commented Jul 10, 2015 at 13:25
-
No, and I guess you know the project better than I.Edgar Bonet– Edgar Bonet2015年07月10日 13:27:13 +00:00Commented Jul 10, 2015 at 13:27