Skip to main content
HEIG-VD search search close
‘Ball on wheel’ demonstrator showcases real-time vision, motor control, and protocols technologies

Located in Yverdon-les-Bains, Switzerland, the School of Business and Engineering Vaud (HEIG-VD) offers ten bachelor programs in engineering and business management. Within HEIG-VD the Institute for Industrial Automation specializes in industrial technologies including the control of production machines, mechatronics, and signal and image processing.

“The complete realization within a Bachelor diploma work was only possible by using automatic code generation from Simulink®, and leveraging Simulink® Real-Time™ and Speedgoat hardware for real-time simulation and testing”

Prof. Dr. Raoul Herzog, Institute for Industrial Automation

Success Story

Ball on wheel

To showcase some of the latest technologies currently used in industry, a “Ball on Wheel” concept was proposed for a bachelor thesis, with the goal of maintaining the position of a ball balanced on a grooved wheel by rotating the wheel with a motor.



A Performance real-time target machine was chosen for running the real-time application, which was designed with Simulink®. This target machine is well suited to the task due to its exibility and high CPU performance, required for the vision algorithm.

To determine the position of the ball, a high speed Basler camera was connected to the target machine using the Camera Link interface. Support for the interface was provided by the Speedgoat IO811 frame grabber I/O module. As motor control wasn’t a key focus of the project, a Kollmorgen servo drive was used to drive a brushless motor to turn the wheel. It was connected to the real-time target machine via EtherCAT using the target machine’s on-board Ethernet port. Many Speedgoat customers implement motor control algorithms directly on their target machines in order to have greater control. 


Image Processing and Control

The camera was con gured to provide a grayscale rectangle of 50 x 2040 pixels to track the path of the ball. The Autothreshold block of the Simulink® Computer Vision System Toolbox was then used to reduce the image from grayscale to binary. This binary image was quickly scanned to give the approximate position of the ball, and then the grayscale image was analysed using interpolation to further improve accuracy. 

To control the position of the ball, the ball’s current position and angular velocity, and the velocity of the wheel, had to be determined. The velocities were computed using finite differences. Control of the motor was by a state feedback.

Several different excitation modes were implemented:

  • Wheel and ball kept at standstill.
  • Wheel rotating at a constant speed while keeping the ball balanced on top.
  • Delaying of control activation until ball reaches a maximum angle, in order to assess the region of attraction of the equilibrium point.
  • Ball position made to oscillate by imposing a sine wave using a feed-forward controller.

A panel was developed on Simulink® Real-Time Explorer running on the host computer to enable the parameters of the different excitation modes to be modified online, while the real-time application created from Simulink was running on the target machine.


The project was developed  by student Steve Vassaux for his Bachelor project in micro engineering. It was completed in 22 weeks while he continued to study for the rest of the Bachelor program. Mr. Vassaux received an award from the Swiss Society for Automatic Control (SGA/ASSPA) for his excellent work.

The demonstrator is a big attraction at exhibitions and can be used to explain model-based design workflows using Simulink®. It can also be configured to run as a stand-alone application, without a host computer. 


Yverdon-les-Bains, Switzerland

Download PDF

Speedgoat products used

MathWorks® products used

  • Simulink®
  • MATLAB® Coder™
  • Image Processing Toolbox™
  • Computer Vision System Toolbox
  • Simulink® Coder™
  • Simulink® Real-Time™

Related Success Stories



Curious how to accelerate control design innovation with a modular controller hardware setup?

Free Workflow Demo

See how Speedgoat can help you in the development of your control design for your application.

Schedule now

Have Questions?

Talk to our experts about your project and application requirements.

Follow Speedgoat LinkedIn