1st Edition

Introduction to Microcontroller Programming for Power Electronics Control Applications Coding with MATLAB® and Simulink®

    452 Pages 256 B/W Illustrations
    by CRC Press

    452 Pages 256 B/W Illustrations
    by CRC Press

    448 Pages 256 B/W Illustrations
    by CRC Press

    Also available as eBook on:

    Microcontroller programming is not a trivial task. Indeed, it is necessary to set correctly the required peripherals by using programming languages like C/C++ or directly machine code. Nevertheless, MathWorks® developed a model-based workflow linked with an automatic code generation tool able to translate Simulink® schemes into executable files. This represents a rapid prototyping procedure, and it can be applied to many microcontroller boards available on the market. Among them, this introductory book focuses on the C2000 LaunchPadTM family from Texas InstrumentsTM to provide the reader basic programming strategies, implementation guidelines and hardware considerations for some power electronics-based control applications. Starting from simple examples such as turning on/off on-board LEDs, Analog-to-Digital conversion, waveform generation, or how a Pulse-Width-Modulation peripheral should be managed, the reader is guided through the settings of the specific MCU-related Simulink® blocks enabled for code translation. Then, the book proposes several control problems in terms of power management of RL and RLC loads (e.g., involving DC-DC converters) and closed-loop control of DC motors. The control schemes are investigated as well as the working principles of power converter topologies needed to drive the systems under investigation. Finally, a couple of exercises are proposed to check the reader’s understanding while presenting a processor-in-the loop (PIL) technique to either emulate the dynamics of complex systems or testing computational performance.

    Thus, this book is oriented to graduate students of electrical and automation and control engineering pursuing a curriculum in power electronics and drives, as well as to engineers and researchers who want to deepen their knowledge and acquire new competences in the design and implementations of control schemes aimed to the aforementioned application fields. Indeed, it is assumed that the reader is well acquainted with fundamentals of electrical machines and power electronics, as well as with continuous-time modeling strategies and linear control techniques. In addition, familiarity with sampled-data, discrete-time system analysis and embedded design topics is a plus.

    However, even if these competences are helpful, they are not essential, since this book provides some basic knowledge even to whom is approaching these topics for the first time. Key concepts are developed from scratch, including a brief review of control theory and modeling strategies for power electronic-based systems.

    1 Advances in Firmware Design for Power Electronics Control Platforms
    1.1 Embedded Control System
    1.2 Selecting a Development Board
    1.3 The C2000™ family of MCU from Texas Instruments™
    1.4 Scheme of a Power Electronics Control Problem

    I Embedded Development: Hardware Kits and Coding
    2 Automatic Code Generation through MATLAB®
    2.1 Model-Based Design and Rapid Prototyping
    2.2 Workflow for Automatic Code Generation
    2.3 Generate code for C2000™ microcontrollers
    2.4 TI C2000™ Processors Block-set

    3 Texas Instruments™ Development Kit
    3.1 TI C2000™ LaunchPad™ : F28069M Piccolo
    3.2 TI BOOSTXL-DRV8301 BoosterPack

    4 Software Installation
    4.1 TI Support Packages: Code Composer™ Studio and ControlSUITE™
    4.2 MATLAB® Support Package: Embedded Coder for Texas Instruments C2000 Processors
    4.3 Installation Procedure

    II Review of Control Theory: Closing the Loop
    5 Designing a Closed-Loop Control System
    5.1 Dynamical Systems
    5.2 Design a PI Controller in Continuous-Time Domain
    5.3 Derive a PI Controller in Discrete-Time Domain

    6 Design Example: PI-Based Current Control of an RL Load
    6.1 Simulink® Simulation
    6.2 Derive an Anti-Windup PI Controller Scheme
    6.3 Design Summary

    7 Manipulate the Variables Format: Data Types
    7.1 Fixed Point vs Floating Point Representation
    7.2 Single vs Double Precision
    7.3 Use of Scaling in Fixed Point Representation
    7.4 Converting from Decimal Representation to Single format
    7.5 Processing the Data: Implementation Hints

    III Real-Time Control in Power Electronics: Peripherals Settings
    8 Basic Settings: Serial Communication COM and Hardware Target
    8.1 Virtual Serial Communication through COM port

    9 Simulink® Configuration
    9.1 Simulink® Environments: Firmware vs Testing
    9.2 MCUs and Real-Time Control with Simulink®

    10 Serial Communication Interface (SCI) Peripheral
    10.1 Hardware Details
    10.2 Firmware Environment: Send and Receive data through serial communication
    10.3 Testing Environment: Send/Receive data through serial communication
    10.4 Time Variable Settings (Sample Rates)
    10.5 Examples on serial communication

    11 GPIO Peripheral - Digital Input/Output
    11.1 Hardware Details
    11.2 Firmware Environment: GPIO peripherals
    11.3 Examples with GPIO blocks

    12 Analog to Digital Converter Peripheral
    12.1 Operating Principle
    12.2 Hardware Details
    12.3 Firmware Environment: ADC Peripheral
    12.4 Example with ADC block
    12.5 Synchronization between ADC modules

    13 Pulse Width Modulator Peripheral
    13.1 Operating Principle
    13.2 Hardware Details
    13.3 Generation of PWM signals
    13.4 Firmware Environment: ePWM Peripheral
    13.5 Example with ePWM block
    13.6 DAC Peripheral - Filtered PWM
    13.7 Examples with DAC peripherals
    13.8 Synchronization between multiple ePWM modules
    13.9 Synchronization between ADC and ePWM modules: average measurements
    13.10 Events Execution within Sample Time

    14 Encoder Peripheral
    14.1 Operating Principle of Incremental Encoders
    14.2 Hardware Details
    14.3 Optical Rotary Encoder LPD3806
    14.4 Speed Computation
    14.5 Firmware Environment: eQEP Peripheral
    14.6 Example with eQEP block

    IV Real-Time Control in Power Electronics: Applications
    15 Open Loop Control of a Permanent Magnet DC Motor
    15.1 Required Hardware
    15.2 Linear Model of a PMDC Motor
    15.3 System Simulations
    15.4 Half-Bridge Configuration
    15.5 Full-Bridge Configuration

    16 Low-Side Shunt Current Sensing
    16.1 Sensor Characterization: Theoretical Approach
    16.2 Locked Rotor Test
    16.3 Sensor Characterization: Experimental Approach

    17 Current Control of an RL Load
    17.1 Required Hardware
    17.2 Linear Average Model and Controller Design
    17.3 System Simulations
    17.3.1 Detailed Modeling of the Actuation Variables
    17.4 Half-Bridge Configuration
    17.5 Variation of Load Parameters

    18 Voltage Control of an RLC load
    18.1 Required Hardware
    18.2 Guidelines for the Hardware Design of a RLC Load
    18.3 General State-Space Average Modeling Method
    18.4 System Simulations
    18.5 Half-Bridge Configuration
    18.6 Variations of LC Filter Parameters

    19 Cascade Speed Control of a Permanent Magnet DC Motor
    19.1 Required Hardware
    19.2 Linear Model of a PMDC Motor
    19.3 Cascade Control Architecture and Design
    19.4 System Simulations
    19.5 Full-Bridge Configuration
    19.6 Single Motor Configuration
    19.7 Back-to-Back (B2B) Configuration

    V Real-Time Control in Power Electronics:Load Emulation
    20 Debugging Tools and Firmware Profiling
    20.1 Processor-in-the-loop with Simulink®
    20.2 External Mode Execution with Simulink®

    21 Electric Propulsion Case Studies
    21.1 Urban Tramway
    21.2 Electric Racing Car

    A Appendix A: Basics of C
    A.1 Operations between numbers
    A.2 Structure of a C program
    B Appendix B: Custom Expansion Boards and Hardware Kits


    Mattia Rossi is a Research Assistant at Politecnico di Milano, Italy.

    Nicola Toscani is currently working as a Postdoctoral Research Fellow in the Department of Mechanical Engineering of Politecnico di Milano.

    Marco Mauri is an Assistant Professor in Electrical Machines and Drives at Politecnico di Milano, Italy.

    Francesco Castelli Dezza is a Full Professor in Electrical Machines and Drives at Politecnico di Milano, Italy.