Skip to main content
Electric Motor Controls with Simulink search search close
Design, prototype, and test your brushless DC motor controls using Simulink and Speedgoat hardware

Learn How to

  • Create accurate motor models and fine tune controller gains by collecting data from hardware 
  • Monitor and control your real-time application directly from Simulink® models or with instrument panel apps 
  • Configure your controller model to generate compact and fast C code for any target microcontroller 
  • Automatically run test-cases and prove that your embedded motor controller meets requirements via Hardware-in-the-Loop testing 

Key Benefits

  • Design and test motor controls with MATLAB® and Simulink®-integrated solutions that enable you to fully adopt Model-Based Design  
  • Test your motor controls early and often. Cut back development costs by exposing design flaws as early as possible 
  • Shorten time-to-market of your motor controls by using automated code generation and automated testing
  • Protect your investment by reusing the same real-time equipment to test both, early control prototypes and final embedded controllers 

Reference Example


Electric motors impact almost every aspect of modern life. Together with the systems they drive, electric motors consume half of the electricity worldwide. Today manufacturers of electric motors are required to comply with energy consumption and efficiency policies, pushing them to steer their focus on delivering more energy-efficient power electronics and electric motors.  
This trend led to the massive adoption of brushless DC motors, including Permanent Magnet Synchronous Machines (PMSMs), due to their higher efficiency and power density. Leading engineering companies in the field face the challenge of keeping the pace of innovation. They have to deliver smarter and more power-efficient control software and stay competitive in such a dynamic market.
In an attempt to address these challenges, electric motor control engineers have been progressively relying on Model-Based Design and real-time simulation and testing to effectively design, develop, and test their new embedded motor controllers.


The Electric Motor Control reference example by Speedgoat aims to provide you with a starting point for electric motor control development using Model-Based Design. It consists of exercises that show you how to best combine the power of Speedgoat real-time solutions with Simulink®, Simscape Electrical™, and Motor Control Blockset™, among other MathWorks products, for motor control design and testing. Download the reference example and discover the process of developing a digital controller based on field-oriented control (FOC) algorithm, from the initial design stages to prototyping and final deployment and testing. 

The reference example leverages the Speedgoat HIL Demo Kit and the Electric Motor Control Kit. The latter features a small 100W Maxon PMSM motor with integrated Hall Sensor and Encoder, and the Speedgoat 1.4 kW Three-phase Inverter  that supports switching frequencies up to 50kHz. These kits seamlessly operate with the cost-effective IO397 Simulink Programmable FPGA I/O Module, which supports PWM generation and capture, with time resolution as low as 5ns, and quadrature encoding and decoding

Model-Based Design Workflow

The reference example walks you through the following four Model-Based Design workflow stages: 

  1. Start your journey right from your MATLAB® and Simulink® simulation environment. By using Stateflow™ and Simscape Electrical™, you can design a closed-loop and supervisory control algorithm using high-fidelity models of the physical electric motor, three-phase power inverter, and sensors included in the Speedgoat Electric Motor Control Kit


  1. After validating your control algorithm via desktop simulation, you will discover Rapid Control Prototyping as a critical enabler for the early and rapid validation and test of your motor controls. You will learn how to prototype your FOC controller on Speedgoat rapid prototyping hardware and quickly spin the Speedgoat Electric Motor Control Kit brushless DC motor using Simulink Real-Time™. 
  1. The journey continues with you learning how to configure early development controller models to generate and deploy efficient embedded code that you can run and efficiently test on an embedded target controller.


  1. The journey ends with testing of your digital controller by means of Hardware-in-the-Loop (HIL) testing with the Speedgoat HIL Demo Kit. You will learn how to expedite the testing and quality of your digital motor controller with test automation enabled by Simulink Test integration and deterministic plant simulation on real-time target computer.

The Authors

Chirag Patel

Chirag Patel
MathWorks Application​ Engineer

Pablo Romero

Pablo Romero
MathWorks Application​ Engineer

Manuel Fedou

Manuel Fedou
Senior Application Engineer Electrification

Product Highlights

Simscape Electrical™

Simscape Electrical™ provides reference examples and component libraries for modeling and simulating electronic, mechatronic, and electrical power systems. It includes models of semiconductors, motors, and components for applications such as electromechanical actuation, smart grids, and renewable energy systems. Simscape Electrical™ helps you design and develop control systems for electrical systems such as the Speedgoat Electric Motor Control Kit right from your Simulink®. The toolbox supports C-code generation enabling fast deployment to Speedgoat HIL simulators. 

 Related Content

Let us help you to find the right solution for your project


Request a Configuration Proposal

Get a proposal for a real-time target
machine configured to your needs.

Request a proposal

Request a Free Workflow Demo

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

Request a free demo

Have Questions?

Talk to our experts about your project
and application requirements.

Contact us
Follow Speedgoat LinkedIn