Page 2
About This Guide This document provides a guide to using ESP32 in Bluetooth networking for IoT devices with examples. Release Note Date Version Release notes 2017.03 V1.0 First release. 2019.05 V1.1 Update figures. Documentation Change Notification Espressif provides email notifications to keep customers updated on changes to technical documentation.
2.2. APIs on ESP32 End ........................2.3. APIs on the EspBlufi APK End ....................3. ESP32 Bluetooth Networking Examples ................3.1. Hardware and Software Preparation ..................3.2. Setting ESP32 to Station Mode ....................3.3. Setting ESP32 as a SoftAP ......................
1. Introduction Introduction 1.1. Overview The ESP32, as a single 2.4 GHz Wi-Fi and Bluetooth combo chip, supports Wi-Fi setups via both SmartConfig and Bluetooth. Users can use ESP32 for secure configuration of Wi- Fi networking for IoT devices. Using Bluetooth for configuring Wi-Fi network presents the following advantages: The Bluetooth protocol is open and scalable.
Page 5
The Configure button will be shown in the interface and click this button. • Figure 1-2. CONFIGURE Button Configure the length of BLE mtu, BLE device filtering, and check the version of the app • and Blufi repository. Figure 1-3. CONFIGURE Interface Espressif ! /! 2 13 2019.05...
In the program of ESP32, security-related processes such as key establishment are determined and developed by the users. The app sends the “negotiate data” to ESP32 and the data packets will be sent to the application layer. If the data is not handled by the application layer, DH algorithm provided by BluFi can be used to exchange the key.
• Source code of EspBlufi for Android: https://github.com/EspressifApp/ EspBlufiForAndroid • Documentation of EspBlufi for Android: https://github.com/EspressifApp/ EspBlufiForAndroid/blob/master/doc/ Introduction_to_the_EspBlufi_API_Interface_for_Android__cn.md • Source code of EspBlufi for iOS: https://github.com/EspressifApp/EspBlufiForiOS • Documentation of EspBlufi for iOS: https://github.com/EspressifApp/EspBlufiForiOS/ blob/master/doc/Blufi_APP_API_for_iOS_CN.md Espressif ! /! 4 13 2019.05...
Examples 3.1. Hardware and Software Preparation • 1 × ESP32 module 1 × PC, connected to the module to supply power and print log for ESP32. • 1 × smartphone (Android 4.3 or above) • Download and install EspBlufi on the smartphone. Turn on the Wi-Fi and Bluetooth •...
Page 9
3. ESP32 Bluetooth Networking Examples Click on the ESP32 device in the interface as Figure 3-1 shows, and click Connect button ! to establish Bluetooth connection to it. Successful connection will yield the interface shown in Figure 3-2. Figure 3-2. Interface Showing Successful Connection Meanwhile, the following log will be output to the serial port tool: ...
Page 10
3. ESP32 Bluetooth Networking Examples Figure 3-3. Network Configuration Interface 5. Select the device mode from the dropdown menu, as Figure 3-4 shows. (BluFi networking supports the following three modes: Station, SoftAP, and Station+SoftAP.) Figure 3-4. Selecting Device Mode Espressif ! /! 7 13 2019.05...
Page 11
3. ESP32 Bluetooth Networking Examples 6. Select Station mode as an instance, click on the refresh button ! , and choose the Wi- FI SSID. Then, enter the password. Figure 3-5. Configuring the Station Mode 7. Click on the ! button to complete the configuration.
Meanwhile, the following log will be output to the serial port tool: 3.3. Setting ESP32 as a SoftAP 1. Power up the module. Connect the EspBlufi app to ESP32 via Bluetooth. Set the device mode as SoftAP in the network configuration interface, as Figure 3-7 shows. For details of doing so, please refer to Steps 1 to 4 in Section 3.2.
Page 13
3. ESP32 Bluetooth Networking Examples Figure 3-8. Configuring the SoftAP Mode 3. Success of the SoftAP configuration will lead to the interface as Figure 3-9 shows. The current Wi-Fi mode and the connection status are shown in the interface. Figure 3-9. SoftAP Connection Information...
Page 14
4. Turn on the smartphone’s Wi-Fi capability. The SoftAP connected can be found in the WLAN interface, as Figure 3-10 shows. Figure 3-10. The Configured ESP32 SoftAP 5. Connect the smartphone to the ESP32 SoftAP. As shown in Figure 3-11, the prompt will appear, indicating that the Wi-Fi is connected.
Page 15
Figure 3-11. Wi Fi Connection Prompt Meanwhile, the following log will be output to the serial port tool: The ESP32 device is successfully connected to Wi-Fi via Bluetooth networking. Note: All values of connection time shown on the EspBlufi app screenshots in this document are provided only as examples.
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?
Questions and answers