Set Up and Configure ESP32 Hardware
Once you have installed the MATLAB® Support Package for Arduino® Hardware, as described in Install the Support Package, you can configure communication
between the host computer and the ESP32 board. Type arduinosetup
in the MATLAB Command window and choose one of the following connection types.
Note
For setting up ESP32 and associated libraries for the support package installed on Linux, ensure that you have logged in as root user. Also, ensure that you launch MATLAB as root user.
Connection over USB
The ESP32 hardware communicates with the host computer via a USB cable as shown.
To configure your ESP32 hardware to communicate via USB:
Connect the ESP32 hardware via USB, by choosing the connection type USB. Click Next.
In the Upload Arduino Server screen, choose the board type and the port number from the
Choose board
andChoose port
menus.The supported ESP32 boards are
ESP32-WROOM-DevKitC
andESP32-WROOM-DevKitV1
.Then, select the libraries that you want to include in your ESP32 server.
Note
Selecting the Install ESP32 third-party library option is mandatory to work with ESP32 boards. This option appears in the screen only for the first time you select ESP32 board (the subsequent launch of Hardware Setup screen checks for ESP32 library installation and displays the option only if the library is not available).
Note
The
CAN
library is not supported for ESP32 board.Click Program to begin uploading the server to your ESP32 board.
After the upload is successful, click Next to proceed.
Click Test connection to test the connection between your host computer and the ESP32 board.
Click Finish to complete the hardware setup. To connect to your ESP32 board, see Connect to Arduino Hardware.
Connection over Wi-Fi
ESP32 hardware communicates with the host computer via Wi-Fi®, as shown.
To configure your ESP32 hardware to communicate via Wi-Fi:
Connect the ESP32 hardware via USB by choosing the connection type WiFi. Choose the encryption type of your Wi-Fi network, and enter the necessary credentials.
Note
WEP encryption type is not supported for ESP32 boards.
If you have previously configured your Arduino board using Wi-Fi via the
arduinosetup
interface, you can select the Retrieve last configuration from Arduino board option, which retrieves the necessary credentials from your previous configuration.If you select the Use static IP address box, make sure that you use an available static IP address and that your router allows the usage of static IP.
Note
Ensure that the
Subnet Mask
is255.255.255.0
and theDefault Gateway
is the IP address of the network gateway.
Click Next.
In the Upload Arduino Server screen, choose the board type and the port number from the
Choose board
andChoose port
menus.The supported ESP32 boards are
ESP32-WROOM-DevKitC
andESP32-WROOM-DevKitV1
.Then, select the libraries that you want to include in your ESP32 server.
Note
Selecting the Install ESP32 third-party library option is mandatory to work with ESP32 boards. This option appears in the screen only for the first time you select ESP32 board (the subsequent launch of Hardware Setup screen checks for ESP32 library installation and displays the option only if the library is not available).
Note
The
CAN
library is not supported for ESP32 board.Click Program to begin uploading the server to your ESP32 board.
After the upload is successful, click Next to proceed.
Click Test connection to test the connection between your host computer and the ESP32 board.
Click Finish to complete the hardware setup.
Connection over Bluetooth
The ESP32 hardware communicates with the host computer via Bluetooth®, as shown.
To configure your ESP32 hardware to communicate via Bluetooth:
Connect the ESP32 hardware via USB, and choose the connection type Bluetooth.
Choose the board type and the port number from the
Choose board
andChoose port
menus.Use the Enter the name of the device or select from a list of available device menu to select an Arduino device.
Select the libraries that you want to include in your ESP32 server. Click Program to begin uploading the server to your ESP32 board.
After the upload is successful, click Next to proceed.
If you are using a Windows® desktop computer, connect a Bluetooth dongle to your computer. You should use a dongle supporting Bluetooth 4.0 or higher to connect to the
ESP32-DevKitV1
orESP32-DevKitC
boards over Bluetooth.Click Test connection to test the connection between your host computer and the Arduino board and click Next.
Note
If you are using the
ESP32-DevKitV1
orESP32-DevKitC
board, your computer running MATLAB can detect Bluetooth. This computer acts as a Bluetooth central.Click Finish to complete the hardware setup.