Main Content

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 over either USB or WiFi. 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.

ESP32 board connected to host computer over USB

To configure your ESP32 hardware to communicate via USB:

  1. Connect the ESP32 hardware via USB, by choosing the connection type USB. Click Next.

  2. In the Upload Arduino Server screen, choose the board type and the port number from the Choose board and Choose port menus.

    The supported ESP32 boards are ESP32-WROOM-DevKitC and ESP32-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.

  3. Click Program to begin uploading the server to your ESP32 board.

  4. After the upload is successful, click Next to proceed.

  5. Click Test connection to test the connection between your host computer and the ESP32 board.

  6. Click Finish to complete the hardware setup. To connect to your ESP32 board, see Connect to Arduino Hardware.

Connection over WiFi

ESP32 hardware communicates with the host computer via WiFi, as shown.

To configure your ESP32 hardware to communicate via WiFi:

  1. Connect the ESP32 hardware via USB by choosing the connection type WiFi. Choose the encryption type of your WiFi 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 WiFi 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 is 255.255.255.0 and the Default Gateway is the IP address of the network gateway.

    Click Next.

  2. In the Upload Arduino Server screen, choose the board type and the port number from the Choose board and Choose port menus.

    The supported ESP32 boards are ESP32-WROOM-DevKitC and ESP32-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.

  3. Click Program to begin uploading the server to your ESP32 board.

  4. After the upload is successful, click Next to proceed.

  5. Click Test connection to test the connection between your host computer and the ESP32 board.

  6. Click Finish to complete the hardware setup.

See Also