Van der Kamp used Simulink and the Simulink Support Package for Raspberry Pi to develop a rapid control prototyping system that enables students to test and refine their control designs on Raspberry Pi hardware.
The flexible support package system allowed van der Kamp to quickly add analog-to-digital and digital-to-analog interface boards to communicate with the DC motor and the inverted pendulum sensors, including encoders that measure the position of the cart and the pendulum. He wrote custom drivers for these boards and packaged them as C MEX S-functions for use in Simulink models.
After downloading and installing the Simulink Support Package for Raspberry Pi, van der Kamp verified the setup by testing it with a Simulink controller model for the loading bridge. The Raspberry Pi–based rapid control prototyping was used in the course the following semester.
Students enrolled in the course were already familiar with MATLAB and Simulink. Ostfalia University has acquired a Campus-Wide License that provides students with campus-wide access to MATLAB and Simulink software, and the tools are widely integrated into the electrical engineering curriculum.
Working in Simulink, students developed a plant model of the loading bridge based on differential equations.
They then developed a state controller model and ran closed-loop simulations in Simulink to check the stability of their designs. They incorporated the C MEX S-function blocks for the analog interface drivers into this model to enable communication with the plant.
Using Simulink external mode, they ran their controller model on the Raspberry Pi hardware with a step size of about one millisecond. In this mode, they could inspect and visualize sensor signals in real time and tune controller parameter values while the model was running.
After testing the controller on the loading bridge model, the students postprocessed data captured from the sensors and generated plots in MATLAB for their lab reports.
Ostfalia plans to expand the use of Simulink with the Raspberry Pi rapid control prototyping system to other classes, including one in which the students will use the system to develop controllers for a magnetic suspension.