Main Content

Setting up a WiFi TCP/IP Connection with Connected IO in Simulink

Perform these steps to setup and configure WiFi TCP/IP connection with Connected IO in your Simulink model.

  1. Open a new Simulink model.

  2. Insert a WiFi TCP/IP Send block and establish a connection with a Constant block.

  3. Double-click the WiFi TCP/IP Send block to open the Block Parameters dialog. Modify the default Local IP Port setting (25000) to your preferred value.

  4. In the Simulink model, on the Modeling tab, click Model Settings to open the Configuration Parameters dialog box.

  5. In the Configuration Parameters dialog box, select the appropriate hardware from the Hardware Board drop-down list, such as Arduino MKR WiFi 1010.

  6. Navigate to Target hardware resources > WiFi properties and configure the WiFi properties by specifying the SSID and WiFi encryption settings according to your network requirements.

  7. On the Hardware tab of the Simulink model, navigate to the Mode section. Select Connected IO and initiate the simulation by clicking Run with IO.

  8. Check the diagnostic viewer to view the IP address assigned to the target.

These steps ensure the correct setup and configuration for using WiFi TCP/IP communication in your Simulink model.

Run the host model to receive data from the target model

  1. Open a new Simulink model.

  2. Add a TCP/IP Receive block and connect it to a Display block.

  3. Double-click on the TCP/IP Receive block. Ensure that the IP address is same as the IP address displayed in the diagnostic viewer of Connected IO mode . Also, the port must be same as the value specified in the WiFi TCP/IP block.

  4. In the Simulation tab of the Simulink model, click Run. Observe the Scope to confirm that the target hardware is successfully transmitting the data, which includes a ramp signal and a pulse.