Advanced Control

Advanced Control with the Arduino IDE

One of the advantages of using the Arduino microcontroller is the massive amount of support documentation and useful code libraries that are available. If there is a particular control architecture you wish to implement, there is a good chance that someone has published related Arduino code online. For example, see this guide to PID control using the Arduino, and this PID Arduino library.

Advanced Control with LabVIEW

LabVIEW is a development environment from National Instruments that uses a graphical programming language. Software code is created by dragging and dropping functional blocks and creating connections between these blocks. The following "virtual instrument", used in testing the performance of a PneuNets Bending Actuator, was created in LabVIEW.

The LabVIEW Interface For Arduino Toolkit can be used to create Arduino sketches in the LabVIEW environment.

Advanced Control with Simulink

Simulink from Mathworks is also a graphical programming language in which code is created by manipulating functional blocks in the development environment. One of the advantages of environments like LabVIEW and Simulink is that a designer can make use of provided robust algorithms, without having to make their controllers from scratch. The following block diagram was made in Simulink and used to implement closed-loop control of a PneuNets Bending Actuator.

The Arduino Support package for MATLAB allows you to develop software/algorithms using Simulink’s graphical programming language and download this algorithm to an Arduino device. The package has a built-in compiler that converts the block diagram into code that can be embedded and run remotely on the Arduino. This page contains details on how to set up and use the support package.

Using Simulink with Arduino

This page describes the steps required to set up Simulink to work with Arduino. The instructions assume that you have MATLAB installed on your computer.

To use Simulink to create code that can be run on the Arduino, we need to install the Arduino Support Package from Simulink. We can install the support package from directly within the MATLAB environment. To do this, do the following:

  1. Open up MATLAB.
  2. Navigate to Resources/Add-Ons and click the drop-down arrow.
  3. Click “Get Hardware Support Packages”
  4. When the Support Package Installer box opens up, select “Install from Internet”.
  5. A box that looks like the following will open up. Select ‘Arduino’ in the box on the left, and check ‘Install’ for the entry that has ‘Simulink’ under the Required Base Product (this should be the only entry).
  6. Follow through with the installation

Using the Arduino Support Package

  1. In the MATLAB command prompt, type in simulink and hit ‘enter’.
  2. When the library browser opens up, scroll down and you should see a new library entitled ‘Simulink Support Package for Arduino.’
  3. You can drag-and-drop these blocks into your model as you would normal Simulink blocks. You can also use blocks from other libraries.