Main Content

Setting up a WiFi UDP Connection with Connected IO in Simulink

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

  1. Open a new Simulink model.

  2. Insert a WiFi UDP Send block and establish a connection with a Constant block.

  3. Double-click the WiFi UDP Send block to open the Block Parameters dialog. Modify the default Local IP port setting 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 UDP Receive block and connect it to a Display block.

  3. Double-click on the UDP 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 UDP 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.