Main Content

Get Started with IO Device Builder

System Requirements

To use the IO Device Builder, you need the following MathWorks® software:

Open IO Device Builder

To open the IO Device Builder app, follow these steps.

  1. Start MATLAB® and then open / create a Simulink® model.

  2. On the Hardware tab of the Simulink toolstrip, in the Prepare section, under Design, choose IO Device Builder.

    open IO device builder

    IO device builder welcome screen

  3. Click Next.

Select Working Directory and Add Third-party Source Files

Once the Source files location page loads, click Select to select the working directory.

The specified directory is where you can find the generated System object™, along with the corresponding cpp and h files, as well as the model.

Source files location

Click Add folder to add the third-party source files you downloaded.

Note

Third-party source files can be downloaded from the internet. For example, to add ADXL345 files, download the source files for ADXL345 sensor.

Click Next.

Source Files

Once the Source Files select the required source files and then click Next to continue.

source files

Add Block Name, Block Description, and Add Block Parameters

In the Block parameters page, specify a name, add description, and add the required parameters for the block.

block parameters

  1. Specify a name for the block in Block Name textbox.

  2. Enter a description for the block in Block description textbox.

  3. Add the required parameters for the block using Add and Remove buttons. Use Move up and Move down buttons to move the selected parameters up / down in the list.

    Note

    To determine the block parameters, open the INO file and search for the parameters. For example, for the ADXL345 accelerometer sensor, you can add the accelerometer range parameter from the Adafruit® GitHub® files.

  4. Click Next to move to the next page.

Add Outputs for the Block

In the Outputs page, add the required output ports for the block.

select outputs for block

After adding the required output ports, click Next to move to the next page.

Add Inputs for the Block

In the Inputs page, add the required input ports for the block.

select inputs for block

After adding the required input ports, click Next to move to the next page.

Preview Block Image

In the Preview page, a preview image of the block is shown along with the outputs and inputs your added.

model diagram with output

Click Next to move to the next page.

Generate System Object Files

In the Generate page, click Generate to generate the system object files for the block.

model diagram with output

Next Steps

In the Next steps page, information to update the setup and step methods are mentioned. Click Finish to complete the process.

  • The generated cpp file opens automatically.

  • Modify the generated cpp files step and setup function with the respective function calls from the third-party source files.

  • Then open the generated model and navigate to Modeling > Model Settings and in the Configuration Parameters dialog box, click Hardware Implementation and then select an Arduino® board and do the necessary modifications.

Note

Before performing Monitor and Tune action, perform these steps to set the default parameter behavior to tunable.

  1. In the Simulink model, press Ctrl+E. The Configuration Parameters dialog box appears.

  2. Navigate to Code Generation > Optimization and ensure that Tunable is selected for Default parameter behavior.

model diagram with output