Customer Stories

Ostfalia University Students Use Simulink and Raspberry Pi Hardware for Rapid Control Prototyping

Challenge

Develop a low-cost rapid control prototyping system for a graduate electrical engineering lab on state controller design

Solution

Use Simulink and Simulink Support Package for Raspberry Pi to enable students to run control design models interactively on Raspberry Pi hardware

Results

  • Lab setup costs reduced by thousands of euros
  • Interactive controller tuning and visualization enabled
  • Students freed to complete work outside the lab

“The low-cost rapid control prototyping system that we created with the Raspberry Pi enables students to design and implement controllers by combining what they’ve learned in lecture with Simulink skills they already have—and without spending valuable class time learning another software package.”

Interface board designed to connect Raspberry Pi to experiment.

Interface board designed to connect Raspberry Pi to experiment.


The electrical engineering master’s program at Ostfalia University of Applied Sciences includes a control design course in which the students model, simulate, and implement a state controller using MATLAB® and Simulink®. The course, Praktikum Moderne Regelungsverfahren, teaches students control design skills that are in high demand in automotive and other industries across the region.

In a final lab project, the students design a state controller for an inverted pendulum, verify the controller via simulation, and then deploy it to a rapid control prototyping system. Based on low-cost Raspberry Pi™ hardware, the system was developed by Axel van der Kamp, a Ph.D. student at Ostfalia, at the request of the course instructor, Dr.-Ing. Dagmar Meyer.

“With their Simulink model running on the Raspberry Pi, students can easily see how well the controller design is working, and even tune parameters to make it work better,” says van der Kamp. “Another big advantage of this approach is its low cost. The Raspberry Pi setup costs less than a textbook. It was ideal for this student project.”

Challenge

The course lab assignments culminate in the design of a control system for a loading bridge like those used to move shipping containers onto a ship or aircraft. The controller must minimize the oscillation of a container—modeled as an inverted pendulum—as it is moved along on a cart driven by a DC motor.

Dr.-Ing. Meyer needed an economical prototyping system for this introductory controls lab. The system needed to have enough computing power for the project and be easy for students to learn and use.

Crane trolley used in the experimental setup.

Crane trolley used in the experimental setup.

Solution

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.

Loading bridge lab setup.

Loading bridge lab setup.

Results

  • Lab setup costs reduced by thousands of euros. “The controller designs for the loading bridge project are not especially complex and, as a result, do not need all the processing power and capabilities of commercial hardware,” says van der Kamp. “Simulink and Simulink Support Package for Raspberry Pi enabled us to create an alternative prototyping lab setup for this project that costs thousands of euros less.”
  • Interactive controller tuning and visualization enabled. “With Simulink external mode, the students can watch the input and output data of their controller live as it runs on the Raspberry Pi and adjust controller parameters on the fly,” notes van der Kamp. “That level of interactivity was impossible before.”
  • Students freed to complete work outside the lab. “With the Campus-Wide License, our students can work with MATLAB and Simulink not only in the lab, but at home or anywhere on campus using their own laptops,” says van der Kamp. “This flexibility increases their motivation to complete course projects.”

Ostfalia University of Applied Sciences is among the nearly 1000 universities worldwide that provide campus-wide access to MATLAB and Simulink. With the Campus-Wide License, researchers, faculty, and students have access to a common configuration of products, at the latest release level, for use anywhere—in the classroom, at home, in the lab or in the field.