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. 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.

    Choose the connection type

  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.

    Upload Arduino server window

  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.

    Test Arduino connection window

  6. 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.

ESP32 board connected to host computer over WiFi

To configure your ESP32 hardware to communicate via Wi-Fi:

  1. 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 is 255.255.255.0 and the Default Gateway is the IP address of the network gateway.

    Choose connection type window

    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.

    Upload Arduino server window

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

  6. 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:

  1. Connect the ESP32 hardware via USB, and choose the connection type Bluetooth.

  2. Choose the board type and the port number from the Choose board and Choose port menus.

  3. 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.

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

  5. 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 or ESP32-DevKitC boards over Bluetooth.

  6. 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 or ESP32-DevKitC board, your computer running MATLAB can detect Bluetooth. This computer acts as a Bluetooth central.

  7. Click Finish to complete the hardware setup.

See Also