scieee AI-readable full text Open interactive document viewer

AutomationShield: An Open-Source Hardware and Software Initiative for Control Engineering Education

Takács, Gergely; Mikuláš, Erik; Gulan, Martin; Vargová, Anna; Boldocký, Ján

Abstract

This paper presents the AutomationShield open-source initiative and framework, which offers small and affordable devices suitable for take-home experiments in the education of future control engineers. Every device embodies a dynamic feedback system based on different physical phenomena. These devices, so-called shields, are meant to be installed on Arduino or similar development boards with the Arduino R3 compatible mechanical and electronic layout. An application programming interface and instructional examples in C/C++, MATLAB, and Simulink come with the devices. This interface serves hardware functions, so that the user may focus on creating embedded applications for automatic control. Hardware design and program codes are published under the open-source paradigm, and thus may be reproduced and built upon by anyone. In the paper we also focus on integration of the shields into the educational process and describe the experience and feedback gained so far.

Full text

AutomationShield: An Open-Source Hardware and Software Initiative for Control Engineering Education ⋆ Gergely Takács ∗Erik Mikuláš ∗Martin Gulan ∗,∗∗ Anna Vargová ∗,∗∗ Ján Boldocký ∗,∗∗ ∗AutomationShield.com Open-Source Initiative (e-mail: [email protected]om) ∗∗ Faculty of Mechanical Engineering, Slovak University of Technology in Bratislava, Námestie slobody 17, 812 31 Bratislava, Slovakia (e-mail: [email protected]) Abstract: This paper presents the AutomationShield open-source initiative and framework, which offers small and affordable devices suitable for take-home experiments in the education of future control engineers. Every device embodies a dynamic feedback system based on different physical phenomena. These devices, so-called shields, are meant to be installed on Arduino or similar development boards with the Arduino R3 compatible mechanical and electronic layout. An application programming interface and instructional examples in C/C++, MATLAB, and Simulink come with the devices. This interface serves hardware functions, so that the user may focus on creating embedded applications for automatic control. Hardware design and program codes are published under the open-source paradigm, and thus may be reproduced and built upon by anyone. In the paper we also focus on integration of the shields into the educational process and describe the experience and feedback gained so far. Keywords: control education, educational aids, open source, microcontroller, programming, Arduino, MATLAB, Simulink 1. INTRODUCTION Teaching of engineering disciplines has gone through several significant changes during the last century. According to Froyd et al. (2012), we can distinguish up to five important stages in the teaching of technology, of which, three phases of transformation are not completed yet. One of the ongoing trends is the return of increased emphasis on practical skills and independent laboratory work. This fact is also reflected in the increased requirements on the complexity and amount of laboratory equipment needed at universities. Control engineering and mechatronics laboratories often reach for off-the-shelf commercial solutions that are typically very expensive, large and delicate. These properties render commercial equipment inaccessible for student experiments, making it difficult to concentrate on assignments, projects or theses individually. Nevertheless, current trends in the education of the future generation of engineers and experts stresses the importance of the individual approach to practical work. Based on the recent discussion by Rossiter et al. (2019) and Rossiter (2020), and of our own experience, we may also recommend the intense use of take-home labs that students can borrow for home- ⋆The authors gratefully acknowledge the contribution of the Slovak Research and Development Agency under the grant APVV-18-0023, the Cultural and Educational Grant Agency of the Ministry of Education of Slovak Republic under the grant 012STU-4/2021. This paper was funded by the European Union under Horizon Europe Grant Agreement number 101079342 (Fostering Opportunities Towards Slovak Excellence in Advanced Control for Smart Industries). work or long-term projects. The alternative option for institutions to equip their controls teaching laboratories is to build custom-made experimental devices which can be in the form of large instruments such as the aforementioned commercial ones but at a much lower cost or, conversely, create much smaller devices to fulfill the requirements of a take-home laboratory. Our solution sits somewhere in between these worlds, combining the best of both. “AutomationShield” is an open-source hardware and software initiative focused on creating tools for control engineering and mechatronics education. At the very heart of the initiative are reference designs of extension modules for the popular Arduino microcontroller prototyping boards, which implement miniaturized versions of well-known feedback control experiments. These hardware extensions— known in the Arduino world as shields—are then, essentially, experimental systems on a single printed circuit board that can be also classified as pocket laboratories. In addition to the hardware, the software APIs and the libraries increase the value of our solution even more, distinguishing it from one-off homemade prototypes and elevating it more to the level of commercial solutions. When comparing our devices with off-the-shelf laboratory equipment, the most significant advantages can be identified as listed in Tab. 1. Most of the apparatus developed within the project were already published in various conference papers, but this is the first time we would like to introduce the results of our initiative in its entirety. Table 1. Feature comparison of AutomationShield (AS) devices with the commercial ones. Typical commercial devices AS devices •expensive, up to thousands of AC•low-cost, AC3 to AC35 •bulky •compact, fit into the palm •used only in laboratories •take-home experiments •closed hardware •open hardware •closed, commercial software •open software •fixed design of software •collaborative work on and hardware, given examples constant improvements •students are passive users •students are engaged Naturally, our efforts within this initiative are not entirely novel in the world of take-home laboratory kits for control and mechatronics education. In the last two decades many papers were published documenting custom-made laboratory equipment; more recently e.g. Zhou et al. (2020) introduced a single-board electromechanical system for use in teaching, Pinares-Mamani and Cutipa-Luque (2020) designed a cart inverted pendulum implemented on Arduino platform, and Park et al. (2020) proposed a commercially available pocket-sized temperature control lab. The recent COVID-19 pandemic accelerated the efforts aimed at creating take-home hardware even more; see e.g. the analysis of de Moura Oliveira et al. (2022) taking the above temperature control lab as demonstration kit. Although the aforementioned works present well-designed hardware with valuable examples of usage, a vast majority of portable control laboratories tend to contain improvised mechanical components, custom-made parts, or unconventional and hard-to-source sensors and actuators. Moreover, the construction details often remain unknown to readers or, the publicly available documentation is insufficient to replicate these devices. Uniqueness of the presented initiative lies in the wide range of affordable devices with comprehensive open-source documentation. The key attributes can be summarized by the following points: •Open hardware – downloadable electrical schematics, printed circuit board design ready for manufacturing, bill of materials, 3D CAD models •Open software – downloadable library for the application programming interface (API) for various software environments. •Price and simplicity – cheap construction, universally available parts, 3D-printed mechanical components. •Open teaching material – examples of system identification and feedback control. •Increased student activity – engaging the students in research through final theses and course projects, e.g.: Takács et al. (2020b), Takács et al. (2020a), Takács et al. (2021a), Takács et al. (2021b), Vargová et al. (2023a), Vargová et al. (2023b), and other. 2. OPEN HARDWARE Taking into consideration that one of the main goals of the project is to offer more than just one device, it is natural, that all the devices have a certain level of standardization. This standardization is observable either in hardware specifications or the software support spanning all currently supported interfaces. In this section, we will briefly introduce the main concept of the open-source hardware of the shields from the AutomationShield family. The mechanical base of each shield device is a printed circuit board (PCB) copying the shape of the Arduino Uno development board, assuming a de-facto standard Arduino R3 pin layout. The choice of this mechanical and electronic layout makes the shields compatible with numerous types of development boards, using the same standard. The first versions of shields were designed to use 5VTTL logic only, but newer releases maintain compatibility to 3.3V CMOS logic as well. The shield is then simply installed by pushing the headers into the microcontroller development board. The shield itself does not contain any microcontroller unit or power supply unit, everything is incorporated into the compatible development board. Note that the ubiquitous Arduino Uno is not the only compatible computing unit, most of the shields were tested on the Arduino Due and Arduino Zero boards based 32-bit ARM Cortex M microcontrollers. The R3 mechanical and electronic standard is also avaliable outside the Arduino ecosystem: the Nucleo series from ST Microelectronics or the powerful processor boards Metro M4 from Adafruit have the same mechanical and electronic design layout. The selection of electrical and mechanical components to be placed on the shield takes the availability and cost-effectiveness of these parts into account—making it possible for anyone to replicate these devices—while common and globally accessible commercial parts are always preferred for the designs. If custom mechanical elements are needed, 3D printing is used, whenever possible. The electronic and mechanical design of shields must contain only the necessary minimum of parts without superfluous complications. The shields must be simple enough so that even a beginner or a so called “maker” with even a modest equipment can easily manufacture them. Each shield from the AutomationShield family represents a dynamical system—with a sensor and an actuator present—making it possible to easily conduct input-output experiments, system identification, feedback control design, and testing. Open-source documentation is readily accessible in a collaboration-ready git repository (AutomationShield, 2023), where visitors may find circuit schematics, printed circuit board layouts, and CAD models of the 3D-printed parts, in both manufacturing-ready and editable formats. This not only allows for an easy replication of the shields, but also enables anyone to implement custom changes and improvements. Additionally, the bill of materials for each shield is available, usually with direct links to vendors, making the selection and ordering of specific parts easier. The currently available shields are listed in Tab. 2, with their photographs depicted in Fig. 1. The table provides a short description of the experiment implemented on the particular shield, a reference to related publication, price, and an overview of accessible didactic examples in various environments, which will be discussed in Sect. 3. It also provides information about the version of each device. This is because all shields are continuously upgraded, as more and more ideas arise, and can never be considered final. However, shields labeled as released are considered mature enough to be deployed for education and research. Besides the constant improvement of the existing shields,we are in the process of developing new devices. The upcoming one will feature an inverted rotational pendulum, commonly known as the Furuta pendulum. a b c d e g h i f Fig. 1. Photograph of shields released so far under the AutomationShield initiative. Current progress can be tracked on its dedicated GitHub wiki page (AutomationShield, 2023). Table 2. Overview of released AutomationShield (AS) devices and available didactic examples. API Arduino IDE MATLAB Simulink Mark in Fig.1 AS device Implemented experiment Reference Release Price⋆[AC] Identification PID LQR MPC Identification PID LQR MPC Identification PID LQR MPC (a) FloatShield Air levitation Takács et al. (2020a) R4 35.0 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ (b) MagnetoShield Magnetic levitation Takács et al. (2020b) R4 33.6 ✓ ✓ ✓ ✓ ✓ ✝ ✝ ✝ ✓ ✓ ✓ ✓ (c) MotoShield DC motor feedback control Takács et al. (2021) R1 21.6 ✓ ✓ ✓ ✓ ✓ ✓ ✓ (d) LinkShield Flexible link Takács et al. (2021b) R1 21.9 ✓ ✓ ✝ ✝ ✝ (e) AeroShield Propeller-driven pendulum Vargová et al. (2023a) R2 22.8 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ (f) HeatShield Thermal control Takács et al. (2019a) R1 4.9 ✓ ✓ ✓ ✓ ✓ ✓ (g) OptoShield Light emittency control Takács et al. (2019b) R1 2.9 ✓ ✓ ✓ ✝ ✝ ✝ ✓ ✓ (h) PressureShield Pressure control Vargová et al. (2023b) R1 18.1 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ (i) BoBShield Ball on beam Takács et al. (2021a) R2 9.6 ✓ ✓ ✓ ✓ ✓ ⋆ As available at the time of shield's release. ✝Cannot be deployed due to execution timing reasons. 3. OPEN SOFTWARE The other essential part of the initiative is the open software maintained in the distributed version control software Git. Each shield must have its application programming interface (API) to enhance the user experience. Such an interface abstracts the complexity of input-output functions and supports the design of feedback control applications. A student or researcher does not have to program the basic software for hardware elements, and may thus rather focus on essential tasks that are relevant from the control engineering perspective. Such functions include, for example, reading data from sensors, sending commands to actuators, reading the reference, or calibrating the hardware. Since all presented devices are built as extension shields for Arduino-inspired microcontroller boards, it is natural that an API for the open-source Arduino software (IDE) is available for all shields. As this environment is based on C/C++, the AutomationShield library treats all shields as a custom class, with a standardized set of methods. •begin() method serves for initialization of the given hardware, creating objects for sensors and actuators, if needed. •calibrate() method selects the maximal, minimal, or zero values for sensors and actuators, depending on the implemented experiment. These calibrated values are accessible also by other methods. Entire I/O functionality is handled by three methods, that use the read and write Arduino inspired nomenclature: •sensorRead() used for readings from the implemented sensors, •referenceRead() used to read reference from the potentiometer, if present on the board, and •actuatorWrite() used to write input values on the actuators. In addition, there are few other methods used for particular shields, depending on their hardware specifics, but the ones listed above represent the core of the API in all available environments with consistent naming convention. By means of them, one may easily create advanced functions. Besides the Arduino IDE API, an analogous programming structure is available for MATLAB and Simulink environment. In case of MATLAB, only a server code is uploaded to the microcontroller, therefore real-time control performance cannot be guaranteed. However, being able to use the high-level MATLAB scripting language allows one to run live experiments under this popular software platform and, most importantly, to create and test advanced feedback control functions with minimal programming effort. A more intuitive way to implement complex control loops and perform real-time experiments with the shields is the Simulink API. It relies on the Simulink Support Package for Arduino Hardware which supplies algorithmic units in blocks that enable to access the hardware functionality in an analogous manner to the Arduino IDE API. An undeniable advantage of distributing the open software on the GitHub hosting platform is the available support and discussion via forums (GitHub Issues), and documentation available on Wiki (AutomationShield, 2023). 4. AUTOMATIONSHIELD IN EDUCATION In this section we briefly demonstrate practical use of our shields via selected worked examples, and describe their use in the educational process as practiced and experienced at both our and other universities. 4.1 Worked examples In addition to the APIs for various environments, the AutomationShield library comes with a set of educational materials, mostly in the form of didactic examples accompanied with a comprehensive inline commentary integrated with the source code. Examples for teaching the concepts of control theory, system modelling and identification are available from different platforms, such as Arduino IDE, MATLAB and Simulink. All examples are available online, and were mentioned in more detail in publications listed in Tab. 2. Therefore, we only show here sample outputs of two of them implementing model predictive control (MPC) and linear-quadratic (LQ) control. Figure 2 demonstrates results obtained by 10 20 Position (cm) Reference r(k) Output y(k) Output y(k) (Filtered) 20 40 60 80 100 120 140 160 Time (s) 0 20 40 Voltage (V) Input u(k) Input u(k) (Filtered) 0 Fig. 2. Example of real-time model predictive control ofthe position of a levitating ball using FloatShield. 12 14 16 Position (mm) 0 20 40 60 80 100 120 Time (s) 0 5 10 Voltage (V) Input u(k) Input u(k) (Filtered) Reference r(k) Output y(k) Fig. 3. Example of real-time linear-quadratic control of the position of a levitating magnet using MagnetoShield. executing the example script FloatShield_MPC.ino in Arduino IDE on an Arduino Mega 2560 microcontroller board. The LQ control example, presented in Fig. 3, was launched in Simulink and deployed after automatic code translation to an Arduino DUE board, utilizing the example block scheme MagnetoShield_LQ_SIMO_DUE.slx. The input data in Fig. 2 and Fig. 3 were filtered using a low-pass filter for better readability. For the same reason, the output of the FloatShield example was smoothed with a moving average filter. Note that the noisy measured data in this case are caused by the uneven mass distribution of the levitating cork ball. 4.2 Experience from educational process Even though the shields are primarily intended for teaching control theory and automatic control concepts, our students first encounter the philosophy and fundamentals of the AutomationShield initiative within the Microprocessor Technology undergraduate course, where they acquire the knowledge and hands-on experience necessary for the creation of basic microcontroller applications. The shields recommended for this course are those with simple hardware makeup, such as OptoShield and HeatShield, where the inputs are simple PWM signals and the outputs are analog signals. Towards the end of the semester the students get to write their very own C++ library, including custom classes to create an API for the abovementioned shields. The required capabilities of the API are acquiring calibrated sensor measurements and driving the actuator with simple commands. Subsequently, students are tasked to measure the system response for identification and implement a discrete-time PID controller. Although this part of their activities is not directly included in the curriculum, it should emphasize the link between the theory learned in other courses and the methods applied to real hardware. This course received extremely positive feedback from the students, because it is one of the first courses where they encounter real hardware and get to apply their theoretical knowledge into practice. It is also conceived in a “zero to hero” fashion, since students are not required to have any extensive knowledge of programming or microelectronics. During the follow-up graduate course Microcomputers and Microprocessor Technology custom shields are built within keystone projects spanning the entire semester. Unlike the prerequisite course, this one is rather focused on practical training of the acquired skills, than gaining new ones. The new skills and theoretical knowledge can be divided into two groups: deepening of the prior knowledge and widening general overview in the fields of system identification and feedback control. Naturally, new technical engineering skill set is expected in such areas as listed below: •design of mechatronic systems; •computer-aided design (CAD) of mechanical components, electronic schematics and PCBs; •basics of object-oriented C/C++ programming; •creation of libraries for Arduino IDE; •managing a project using Git/GitHub and its tools; •soft skills—such as teamwork, coordination, effective engineering communication and planning. Gaining these skills is supported by project-based learning. Students form small teams of typically 5–7 persons, and choose a “problem” to work on together throughout the semester under the guidance of the instructors. The problem in this course is essentially the design of a new shield, or an improvement of an existing one. Usually, some benchmark systems known in control engineering education may be introduced to them, but teams are encouraged to come up with new ideas while respecting the basic premise that the designed experiment must be a dynamical system with at least one actuator and at least one sensor. Most of the existing shields created within this initiative are partially products of this course. Currently, we are incorporating the shields into the graduate courses on System Identification and Theory of Automatic Control, where after a classroom use students are handed out the devices as take-home experiments. Feedback from the students has already been very positive. 4.3 Feedback from other universities Over the years of developing AutomationShield, numerous educators and researchers have reached out to us with the interest in our project. For instance, colleagues from the University of Duisburg-Essen (Germany), the University of Tasmania (Australia), the Technical University of Ostrava (Czech Republic), and other contacted us because some of them already built examples for themselves and asked for additional information, planned to build shields or simply wished to share and discuss experience with these devices in teaching. After the IFAC World Congress 2020, where FloatShield was presented, we organized a joint discussion about the air levitation experiment with researchers from the University of Duisburg-Essen. The discussion focused on possibilities of using shields in the research of advanced control algorithms. A colleague from the Technical University of Ostrava, successfully implemented feedback control loops for MagnetoShield in Rexygen, an environment similar to Simulink. Also, the RWTH Aachen University in Germany obtained 40 FloatShield devices to incorporate them into their undergraduate control theory course. At the end of the course, students praised the very advantages of such an approach to teaching. From the feedback of the course instructors: “A particular group of students appreciated the noisy sensor data and the hands-on approach to tuning the calculated controllers for better performance. They claimed that, it was especially educational, to have personal experience with the differences between nominal systems and controllers and their practical realizations.” 5. CONCLUSION The main benefits of launching and maintaining the AutomationShield initiative for open hardware and software can be summarized as: •a wide range of standardized and affordable devices for control education, released or under development; •APIs and examples in Arduino IDE, MATLAB, and Simulink; •hands-on involvement of students in research; and •its publication in cooperation with the students. Nevertheless, there is still a lot of room for progress. From the educational point of view, we are currently integrating the shields into the curricula of selected courses, collecting and analyzing feedback of the students, and creating comprehensive study materials. Of particular interest would be an online, interactive exercise book accompanied by a detailed guide for the educator, incorporating modern teaching practices for a deeper understanding of studied topics. In addition to that, further improvements and additions to the existing hardware, software and didactic examples are virtually never-ending tasks. We also consider creating an open-source application with a graphical user interface to partially supplement Simulink, making the project more independent and strictly open-source, i.e. not relying on licensed software, even if it is a widely used and powerful tool in research, education, and industry. As the essence of the initiative is the open-source philosophy, anyone interested is welcome to contribute and collaborate. REFERENCES AutomationShield (2023). AutomationShield. GitHub Wiki page. www.AutomationShield.com. de Moura Oliveira, P.B., Soares, F., and Cardoso, A. (2022). Pocket-sized portable labs: Control engineering practice made easy in COVID-19 pandemic times. IFAC-PapersOnLine, 55(17), 150–155. 13th IFAC Symposium on Advances in Control Education. Froyd, J., Wankat, P., and Smith, K. (2012). Five major shifts in 100 years of engineering education. Proceedings of the IEEE, 100, 1344–1360. Park, J., Martin, R.A., Kelly, J.D., and Hedengren, J.D. (2020). Benchmark temperature microcontroller for process dynamics and control. Computers & Chemical Engineering, 135, 106736. Pinares-Mamani, O.G.C. and Cutipa-Luque, J.C. (2020). A low-cost didactic module for testing advanced control algorithms. HardwareX, 8, e00148. Rossiter, J. (2020). Blended learning in control engineering teaching; an example of good practice. IFAC-PapersOnLine, 53(2), 17252–17257. 21st IFAC World Congress. Rossiter, J., Pope, S., Jones, B., and Hedengren, J. (2019). Evaluation and demonstration of take home laboratory kit. IFAC-PapersOnLine, 52(9), 56–61. 12th IFAC Symposium on Advances in Control Education. Takács, G., Gulan, M., Bavlna, J., Köplinger, R., Kováč, M., Mikuláš, E., Zarghoon, S., and Salíni, R. (2019a). HeatShield: a low-cost didactic device for control education simulating 3D printer heater blocks. In IEEE Global Engineering Education Conference, 374–383. Takács, G., Konkoly, T., and Gulan, M. (2019b). OptoShield: A low-cost tool for control and mechatronics education. In 12th Asian Control Conference, 1001–1006. Takács, G., Mikuláš, E., Vargová, A., Konkoly, T., Šíma, P., Vadovič, L., Bíro, M., Michal, M., Šimovec, M., and Gulan, M. (2021a). An open-source miniature “ball and beam” device for control engineering education. In IEEE Global Engineering Education Conference. Takács, G., Vríčan, M., Mikuláš, E., and Gulan, M. (2021b). LinkShield: An early hardware prototype of a miniature low-cost flexible link experiment. In 27th International Congress on Sound and Vibration, 1–8. Takács, G., Boldocký, J., Mikuláš, E., Konkoly, T., and Gulan, M. (2021). MotoShield: Open miniaturized DC motor hardware prototype for control education. In IEEE Frontiers in Education Conference, 1–9. Takács, G., Chmurčiak, P., Gulan, M., Mikuláš, E., Kulhánek, J., Penzinger, G., et al. (2020a). FloatShield: an open source air levitation device for control engineering education. IFAC-PapersOnLine, 53(2),17288–17295. 21st IFAC World Congress. Takács, G., Mihalík, J., Mikuláš, E., and Gulan, M. (2020b). MagnetoShield: Prototype of a low-cost magnetic levitation device for control education. In IEEE Global Engineering Education Conference, 1516–1525. Vargová, A., Boldocký, J., Gulan, M., Staroň, M., Mikuláš, E., and Takács, G. (2023a). PressureShield: an opensource air pressure pocket lab for control engineering education. In 24th International Conference on Process Control, To appear. Vargová, A., Boldocký, J., Gulan, M., Tibenský, P., Mikuláš, E., and Takács, G. (2023b). AeroShield: An opensource propeller-driven pendulum device for control engineering education. In 22nd IFAC World Congress, To appear. Zhou, L., Yoon, J.Y., Andriën, A., Nejad, M.I., Allison, B.T., and Trumper, D.L. (2020). FlexLab and LevLab: A portable control and mechatronics educational system. IEEE/ASME Transactions on Mechatronics,25(1), 305–315.