Control Tutorials for MATLAB and Simulink (2024)

Below you will find an extensive list of hardware-based activities that instructors and individuals can employ to learn the concepts behind the modeling, controller design, and controller implementation for dynamic systems. The activities as outlined employ an Arduino board (Uno, Mega 2560, etc.) interfaced with a host computer running MATLAB/Simulink, though the essence of the various activities can be achieved with alternative hardware and software platforms. Most of the activities employ the ArduinoIO package, though you can also use the standard Arduino Hardware Support Package. Both packages are freely available with the standard MATLAB/Simulink license. Details on these packages and their installation can be found by following the link below.

- ArduinoIO Package Installation and Introduction

Contents

  • RC Circuit
  • LRC Circuit
  • Simple Pendulum
  • Lightbulb
  • Boost Converter Circuit
  • DC Motor

RC Circuit

Overview: These activities employ a simple electrical circuit consisting of only a resistor and a capacitor. This type of circuit is a simple, but important, example of a dynamic system. The activities explore the modeling, analysis, and control of the circuit. The Arduino board is employed for generating the input to the circuit (via a digital output) and for reading the output of the circuit (via an analog input). The Arduino board also communicates the recorded data to Simulink for visualization and analysis.

Equipment: Arduino board, breadboard, resistor, capacitor, jumper wires, ohmmeter (optional), capacitance meter (optional); for Activity 1C you will also need three potentiometers (10k, 50k, 500k), three operational amplifiers, one AA battery, and two 9V batteries

Activity 1A: Time-Response Identification of a Resistor Capacitor (RC) Circuit

Topics covered: modeling electrical systems, first-order systems, system identification

The purpose of this activity is to demonstrate how to model a simple electrical system. Specifically, a first principles approach based on the underlying physics of the circuit and a blackbox approach based on recorded data are employed. The associated experiment is employed to demonstrate the blackbox approach, as well as to demonstrate the accuracy of the resulting models. This activity also provides a physical example of the common class of first-order systems.

Activity 1B: Frequency-Response Identification of a Resistor Capacitor (RC) Circuit

Topics covered: modeling electrical systems, first-order systems, system identification, frequency response, bode plots

In the previous activity we examined the time response of an RC circuit. The purpose of this activity is rather to understand the frequency response of the same circuit. Specifically, we experimentally construct the magnitude plot portion of the Bode plot for the RC circuit.

Activity 1C: Control of a Resistor Capacitor (RC) Circuit

Topics covered: model-based design, root locus, PI control, steady-state error, analog control

In this activity we learn how to implement a controller in order to modify a system's dynamic response. In particular, we employ a system's root locus to help tune a feedback controller in the presence of uncertainties in the model. This activity also demonstrates how to implement a control law using analog electronics.

LRC Circuit

Overview: These activities continue to explore the modeling and analysis of electrical circuits that was begun in Activity 1. Specifically, an inductor is added to the circuits. The Arduino board is still employed for reading the circuit's output and for communicating the data to the host computer, but now the input to the circuit is supplied by a battery via a pushbutton switch (or a transistor).

Equipment: Arduino board, breadboard, inductor, resistors, capacitors, jumper wires, switch (pushbutton), AA battery, transistor (optional), operational amplifier (optional), ohmmeter (optional), capacitance meter (optional)

Activity 2A: Time Response of an Inductor Resistor Capacitor (LRC) Circuit

Topics covered: modeling electrical systems, underdamped second-order systems, system identification

The purpose of this activity is to demonstrate how to model a simple electrical system. Specifically, a first-principles approach based on the underlying physics of the circuit is be employed. The associated experiment is employed to determine the accuracy of the resulting model and to demonstrate how the individual circuit components affect the response. This activity also provides a physical example of the common class of (underdamped) second-order systems.

Activity 2B: Electrical Circuits in Series

Topics covered: modeling electrical systems, loading, higher-order systems, filtering, isolation

The purpose of this activity is to demonstrate how to model circuits in series. In particular, the phenomenon of loading is investigated. Also, how to predict the response of higher-order systems is discussed.

Simple Pendulum

Overview: This activity employs a simple pendulum. A pendulum is an illustrative example of a mechanical system whose dynamics are periodic and nonlinear. The Arduino board is simply used to record and transmit the pendulum's angular position as indicated by a rotary potentiometer employed as a sensor.

Equipment: Arduino board, simple pendulum (slender metal bar with end weight), rotary potentiometer

Activity 3: Modeling of a Simple Pendulum

Topics covered: modeling rotational mechanical systems, nonlinear systems, underdamped second-order systems, sampling effects (aliasing, quantization), system identification

The purpose of this activity is to demonstrate how to model a rotational mechanical system. Specifically, the theory of modeling is discussed with an emphasis on which simplifying assumptions are appropriate in this case. The associated experiment is employed to demonstrate how to identify different aspects of a physical system, as well as to demonstrate the accuracy of the resulting model.

Lightbulb

Overview: In this activity we model a thermal system (a lightbulb) and implement different strategies for controlling the system's temperature using an inexpensive temperature sensor for feedback. The Arduino board is used for generating the control input to the system and for recording the system's output (its temperature). The control logic is developed in Simulink and is alternately run on the host computer or embedded on the Arduino board.

Equipment: Arduino board, lightbulb, AC solid-state relay, temperature sensor

Activity 4: Temperature Control of a Lightbulb

Topics covered: blackbox modeling, first-order systems, ON/OFF control, PI control, steady-state error, embedded control, autocode generation

The purpose of this activity is to demonstrate how to control switched systems. The lightbulb is a binary system with only two states, on or off. The lightbulb is either connected to the AC source or it is not; its intensity cannot be modulated. In this experiment, we observe the resulting "chattering" behavior of the lightbulb and investigate alternative methodologies for reducing the frequency of this chatter, or smoothing the chatter, through the use of deadbands, low-pass filters, and Pulse-Width Modulation. This activity also provides exposure to Proportional (P) control, Proportional-Integral (PI) control, and first-order systems.

Boost Converter Circuit

Overview: These activities employ a type of DC-DC converter circuit called a boost converter circuit. A boost converter circuit takes a DC voltage input (i.e. from a battery) and can be controlled to produce a higher level of DC voltage at its output. This type of circuit has many important applications. The Arduino board is used for measuring the output of the circuit (via an analog input) and for controlling the level of the circuit's output voltage (via a digital output). The control logic is developed in Simulink and is alternately run on the host computer or embedded on the Arduino board.

Equipment: Arduino board, breadboard, AA battery, inductor, resistor, capacitor, diode, transistor (MOSFET), jumper wires

Activity 5A: Time-Response Analysis of a Boost Converter Circuit

Topics covered: modeling electrical systems, time-response analysis, system identification, pulse-width modulation

The purpose of this activity is to build intuition regarding the operation of a boost converter circuit. The activity also demonstrates two techniques for modeling and analyzing a simple electrical system. The first approach models the circuit based on its underlying physics and compares the predicted time response of the circuit to data taken from a physical implementation of the circuit. The second approach models the circuit based on experimentally obtained frequency response data and can be found in Part (b) of the activity.

Activity 5B: Frequency Response Identification of a Boost Converter Circuit

Topics covered: frequency response analysis, system identification, nonlinear systems, pulse-width modulation, bode plots

In this part of the activity we model the boost converter circuit based on experimentally obtained frequency response data. This technique provides intuition regarding frequency response analysis and demonstrates a blackbox approach for generating an approximate (local) model of a nonlinear system.

Activity 5C: Feedback Control of a Boost Converter Circuit

Topics covered: frequency response analysis, system identification, lead compensation, embedded control, autocode generation

The purpose of this activity is to demonstrate how to design a controller using frequency response techniques based on an empirically derived, and imperfect, plant model. Furthermore, this activity demonstrates how embedded controllers are often designed and implemented in practice using modern design and code generation tools.

DC Motor

Overview: These activities employ a simple DC motor which is a common and important type of actuator found in many industrial applications and consumer products. In particular, the motor is modeled, analyzed, and controlled to achieve a desired speed response. The motor's speed is estimated from the output of a quadrature encoder which is read via two digital inputs of the Arduino board. The motor's speed is controlled using pulse-width modulation via one of the board's digital outputs. The logic for estimating the motor's speed based on encoder counts and the logic for controlling the motor's speed is developed in Simulink. Initially this logic is run on the host computer, but subsequently all of the logic is downloaded to the Arduino board.

Equipment: Arduino board, breadboard, DC motor with quadrature encoder, battery (ex: lantern battery), diode, transistor (MOSFET), jumper wires

Activity 6A: Time-Reponse Analysis of a DC Motor

Topics covered: modeling electromechanical systems, time-response analysis, system identification, reduced-order models, pulse-width modulation, filtering

The purpose of this activity is to build intuition regarding the operation of an armature-controlled DC motor. The activity also generates a blackbox model for the motor based on its step response. This type of model is compared to a physics-based model. The need and effects of filtering are also explored.

Activity 6B: PI Speed Control of a DC Motor

Topics covered: pulse-width modulation, PI control, pole placement, steady-state error, disturbance rejection, saturation, integrator wind-up, embedded control

The purpose of this activity is to build intuition regarding the design and implementation of a PI controller for the speed control of a DC motor in the presence of an array of real-world complications. Specifically, we consider how to design the controller when we have an uncertain plant model and are limited in the amount of control effort we can supply. Furthermore, we analyze our system's performance in the presence of unwanted exogenous inputs, which in this case is a constant load disturbance.


Published with MATLAB® 8.2

Control Tutorials for MATLAB and Simulink (2024)
Top Articles
Latest Posts
Article information

Author: Golda Nolan II

Last Updated:

Views: 6498

Rating: 4.8 / 5 (58 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Golda Nolan II

Birthday: 1998-05-14

Address: Suite 369 9754 Roberts Pines, West Benitaburgh, NM 69180-7958

Phone: +522993866487

Job: Sales Executive

Hobby: Worldbuilding, Shopping, Quilting, Cooking, Homebrewing, Leather crafting, Pet

Introduction: My name is Golda Nolan II, I am a thoughtful, clever, cute, jolly, brave, powerful, splendid person who loves writing and wants to share my knowledge and understanding with you.