Please enable JavaScript to view this site.

How this block appears in a Simulink model?

wifi_setup_block_1
wifi_setup_block_2

What can be configured?

When WiFi mode is in Access Point mode:

wifi_setup_block_3

When WiFi mode is in Station mode:

wifi_setup_block_4

Configuration Parameter

Selectable Option/Value

Description

WIFI mode

WIFI STA-- WIFI

Configure ESP32 to function in Access Point Mode or Station Mode.

Device name

 

Name of the device to show in the device list in the router when the WiFi mode is in WIFI STA.

Enable static IP assignment

Check--Uncheck

In STA mode the user has the option to manually assign a static IP or allow the IP to be auto assigned.

IP Address

 

Enter the IP address.

Gateway address IP

 

Enter the gateway IP.

Subnet mask IP

 

Enter the subnet mask IP

Enable manual DNS IP

Check--Uncheck

Enable manual DNS IP

DNS IP

 

Enter the DNS IP

Enable WIFI custom configuration string

Check--Uncheck

Enable custom WIFI configuration parameters.

WIFI configuration string

 

For advanced users, the block can be used to configure additional parameters using this string.

INPUT/ OUTPUT Port

Port Name

Port Type

Date Type

Description

Trigger(rising)

Scalar

uint8

If 1 is received, the block will initialize the port. If 0 is received, the block will deinitialize the port and it can be used by another block.

SSID

Vector

uint8

User preferred network name

Password

Vector

uint8

User set network name password

Connected Devices

Scalar

uint8

Number of devices connected to the ESP32 Access point. This port will enable in WIFI AP mode

Connection Status

Scalar

uint8

The status port is 0 initially and becomes 1 when the the device connect to the user configured WIFI network. This port will enable in WIFI STA mode

When to use this block?

This block is used to setup a WIFI network with the user specified configurations.

How does this block work?

The WiFi libraries provide support for configuring and monitoring the ESP32 WiFi networking functionality. This includes configuration for:

Station mode (aka STA mode or WiFi client mode). ESP32 connects to an access point.

AP mode (aka Soft-AP mode or Access Point mode). Stations connect to the ESP32.

Demo

Demo file : esp32_wifi_scan_demo.slx

wifi_scan_block_3
wifi_scan_block_4

Description

This demo shows how to use the WIFI_block & WIFI scan block. In the model, the SSID,RSSI & Channels of all available WIFI APs around the esp32 will be output through the relevant ports in the WIFI Scan block.

Note: This demo can be found Wifi demo

What should be happening?

Once the program is uploaded, the information related to the WIFI scan will be output. You can use any kind of serial monitor to check the values output by the WIFI Scan block. The following example has use the opensource serial monitor application PUTTY.

Important:

Always the WIFI Setup should be used if the WIFI Scan block is used.

The WIFI mode should be STA

The sample time should not be less than 200ms

Baudrate: 115200

wifi_scan_block_5

Copyright 2022 Aimagin Co.,Ltd.