Main Content

Communicate with Hardware in Normal Mode Simulation Using Connected I/O

You can use Connected I/O to communicate with the IO peripherals on the hardware during Normal mode simulation.

Normal mode simulation with Connected I/O is an intermediate step in the Model-Based Design workflow that bridges the gap between simulation and code generation by enabling Simulink® to communicate with the hardware before deploying the model on hardware. Connected I/O enables you to modify your model design and monitor the effect of the modified design using peripheral data from the hardware in a near real-time environment. You are not required to deploy the model on the hardware to monitor the effect of the modified design, which accelerates the simulation process. This interaction between Simulink (software) and Android™ device (hardware) is possible in Normal mode simulation only when you enable Connected I/O.

These sections explain:

Android Blocks Supporting Connected I/O

Use Connected I/O with the following sensor blocks from the Simulink Support Package for Android Devices. Without Connected I/O, these sensor blocks output zero during Normal mode simulation. With Connected I/O, these blocks read data from the connected sensors during Normal mode simulation.

How Connected I/O Works

Connected I/O creates a communication interface that enables the Simulink model and the IO Server to communicate with each other. The Simulink model resides in your computer, and the IO Server is an engine on the hardware that contains all the peripheral functions. The transport layer formats and transmits the data using the communication interface.

This diagram shows the connection that the Connected I/O creates between your computer and the hardware.

Communication in Normal Mode Simulation with Connected I/O

When you simulate a Simulink model in Normal mode with Connected I/O:

  1. The device driver block (for example, Accelerometer block) in the model request sensor data from the IO Server.

  2. The IO Server accepts the request and responds with the requested data. You can use any Simulink sink or dashboard block to view the received data. Using the peripheral data received, you can verify that your model design meets the requirements.

  3. If necessary, you can modify the design by adding, removing, or replacing any block in the Simulink model.

  4. After the model is modified, resimulate the model. During simulation, the data request from the model is communicated to the hardware. You can continue to modify and simulate the model until the expected behavior is achieved.


  • The communication in Connected I/O is an on-demand process. The hardware sends data only when receiving a data request from the Simulink model.

  • You do not have to build, deploy, and run the model on the hardware to monitor the effects of your changes in your model design.

Connected I/O in Model-Based Design

When you simulate a model in Normal mode without Connected I/O, Simulink does not communicate with the hardware. Simulink communicates with the hardware only when the code is generated and the model is deployed on the hardware in External mode. Normal mode simulation with Connected I/O is an intermediate step in the model-based design workflow that bridges the gap between simulation and code generation by enabling Simulink to communicate with the hardware before deploying the model on the hardware.

This Model-Based Design Workflow diagram displays a model-based workflow:

  1. Create a Simulink model.

  2. Simulate the model in:

    1. Normal mode simulation without Connected I/O: There is no hardware interaction and no code generation.

    2. Normal mode simulation with Connected I/O: The model communicates with the hardware. There is no code generation.

    3. External mode: The model is deployed on the hardware and generates code.

  3. Deploy the model to the hardware.

Model-Based Design Workflow

How Connected I/O Differs from External Mode

Connected I/O and External mode both enable you to communicate with the hardware during simulation. However, you use Connected I/O and External mode for different purposes. The table shows the actions that you can perform with each mode.

ActionExternal ModeConnected I/O
Obtain real-time dataYou can obtain real-time data with External mode.Enable the Simulink Pacing Option to get near real-time data.
Timing analysis of real-time dataTiming analysis of real-time data is possible because the Simulink model is running on the hardware in real-time.Timing analysis of real-time data is not possible because the Simulink model is running in your computer and not on the hardware.
Time required to start simulation1-2 minutesFew seconds
Code generationCode is generated on the hardware. No code is generated.

How to Enable Connected I/O

To simulate a model in Connected I/O during Normal mode simulation, you must enable the Connected I/O option:

  1. Create a Simulink model using the sensor and Display blocks.

  2. In the Simulation tab, set the Simulation Mode to Normal.

  3. In the Modeling tab, select Model Settings.

  4. In the Configuration Parameter dialog box, select Hardware Implementation.

  5. Set the Hardware board parameter to Android Device. This selection automatically populates the Hardware board settings parameter with the default values for the Android hardware.

  6. From the Groups list under Target hardware resources, select Connected I/O. The Enable Connected I/O option is selected by default.

    Configuration Parameters Enable Connected I/O for Android

  7. Click Apply. Click OK to close the dialog box.

  8. Additionally, you can change the rate of simulation by enabling the Simulink Pacing Option as described in Simulation Pacing.

  9. Enter the Stop Time in the Simulation tab and click Run. The SimulinkIOServer Android application is now installed on the Android device.

    The SimulinkIOServer application shows the following details:

    • Network

      • Name: Displays the name of the network to which the Android device is connected.

      • IP Address: Displays the IP address of the Android device.


      To establish a connection between the Android device and the host computer, ensure that they are connected on the same wi-fi network.

    • Device

      • Serial: Displays the serial number of the Android device.

    • Model

      This section displays data only from sensors supported by the connected Android device. For example, if the Android device does not support a humidity sensor, the section displays the message No relative Humidity Support. Data from the supported sensors is displayed in this section during simulation.


    While using the Location Sensor into the Simulink model, you will be prompted to set the location permission for obtaining the location information of the Android device. Once you grant the permission, the location data of the device is displayed in Simulink when Connected I/O runs. Otherwise, 0 is displayed. The input data obtained from other connected sensors is not affected.

  10. To close the SimulinkIOServer application, disable Connected I/O.