Time flies. Four years have passed since I first create this website to share information on the use of Scilab in control engineering and related fields. I, as a university instructor, have used some of the developments as class materials. The site itself is still not very convenient for such purpose, because it is difficult for a student to find an article related to a topic or assignment, even though I have arranged some essential parts to study modules.
So I decide it is a good time to collect core articles on scilab.ninja and compose them as an e-book. During that process, I review the work and have a feeling that the book still lacks something. In addition to digesting feedback control basics and how to use Scilab/Xcos as study aids, the reader should be able to implement his/her design on a target board. That would close the learning loop.
This describes the how and why of my new book “Feedback Control with Scilab and Arduino.”
From Part I of this topic, we learn the basics of Scilab serial communication toolbox and construct a simple GUI to handle the connection and data transfer in form of ASCII strings. Things seem to work fine with general commands and responses, which so far are displayed on Scilab console as status message or parameter value retrieval.
For control system analysis and design purpose, data need to be plotted and processed in Scilab. So the received data string must be in some valid format ready to be executed. For example, suppose we request the CM1 board for a set of sampled input and output values, say, 100 points. It is preferable that the returned string be in a matrix format so that Scilab command execstr could be used to construct a matrix in the workspace easily. For such convenience, RED provides a command “scilab on” to append a variable name dstr and square brackets to the raw data. Then we can pass the whole received string to execstr without having to edit anything.
At present I am quite busy developing the controller module (CM1) together with the supplement DC motor simulator (EM1), as introduced in my Embedded Prototypes for Control Engineering article. The main purpose of these low-cost embedded systems are to serve as educational tools for control engineering, though, if one wishes to do so, the universal controller board can be used in certain real applications with up to two feedback loops.
Basic serial port communication in ASCII format is implemented on the target board for a user to issue commands and receive response, as well as capture data for analysis. Any UART terminal program such as HyperTerminal or CoolTerm can be used for such purpose. For classroom use, however, integration with Scilab would significantly improve user-friendliness of the board. What we need are a couple of Scilab functions to access the serial port. The required operations are open, read, write, and close. No need to be fancy. I have found The Serial Communication Toolbox on the ATOMS packaging system that provides just these basic functions and is very easy to use.
PID controllers are widely-used nowadays due to their ease of implementation and deployment, with many commercial products available on the market. To achieve desired performance, the controller gains need to be adjusted properly. Among many tuning schemes in the literature, the so-called Ziegler Nichols Frequency Domain (ZNFD) approach is one that can easily be understood and applied to a physical system. In this article we demonstrate simulation of manual ZNFD PID tuning, and then extend to an autotuning procedure using relay feedback. Basic theory can be read from  and our previous article Digital PID Controllers*.