Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
164 views
16 pages
ESP32 - Bluetooth Networking
Uploaded by
Kingshuk Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save ESP32 - Bluetooth Networking For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
164 views
16 pages
ESP32 - Bluetooth Networking
Uploaded by
Kingshuk Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save ESP32 - Bluetooth Networking For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save ESP32 - Bluetooth Networking For Later
You are on page 1
/ 16
Search
Fullscreen
ESP32 Bluetooth Networking User Guide fersion Espre: or Syste ms Copyright © 2019 BY |:About This Guide This document provides a guide with examples to using ESP32 to establish Bluetooth® networks for loT devices. Release Note Date Version Release notes 2017.03 vio First ola. 2019.05 via Updated figures. 2010.11 vie Undated the download lnk of EspB Documentation Change Notification Espressif provides email notifications to keep customers updated on changes to technical documentation. Please subscribe at hits.//www.espressif. com/en/subsoribe, Certification Download certi ates for Espressif products from /itps://www espressif com/en/Content 1. Introduction. 4.4. Overview 1 1.2, EspBlufi 2. APIs for Networking Development 2.1. BluFi Protocol. 22, APIs on ESP32 End.. 2.3. APIs on the EspBlufi APK End... Rob & 3. ESP32 Bluetooth Networking Examples 3.1. Hardware and Software Preparation 3.2, Setting ESP32 to Station Mode... 3.3. Setting ESP32 as a SoftAP1. 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 loT devices. Using Bluetooth for configuring Wi-Fi network presents the following advantages: The Bluetooth protocol is open and scalable. By using Bluetooth protocol, users can easily discover nearby devices via Bluetooth beacons. The Bluetooth protocol is secure, because the authentication of the device is done over a secure Bluetooth connection before the password is sent to the device. Users can also transmit data over Bluetooth to a smartphone, even when the router is not working, The phone can then uploads the data to the Internet, ‘The phone can now also connect to the Bluetooth device and send commands directly to control the device if the Wi-Fi network is down, 1.2. EspBlufi ESP32 is compliant with Bluetooth v4.2 BR/EDR and BLE specifications. Espressif has developed the app EspBlufi specifically for Bluetooth networking of IoT devices. The app is supported on Android 4.3 and above. For smartphones of Android 6.0 or above, because of Google's modification to the Android API, users must give their permission for access to their current location and enable the location information module to start the Bluetooth scanning, © EspBlufi can be downloaded via: httos://aithub.com/EspressifApp/EspBlufiForAndroid/ releases + Open EspBlufi after downloading it. In the user interface as shown in Figure 1-1, click on the [Ell icon in the upper right corner. Espressit 113 2019.111. Introduction Figure 1-1. EspBlufi User Interface * The Configure button will be shown in the interface and click this button. ‘BLUFI_DEVICE Figure 1-2, CONFIGURE Button * Configure the length of BLE mtu, BLE device fitering, and check the version of the app and Blufi repository. 8m mu deme BLE ene vs APP Hc Blu eas Figure 1-3. CONFIGURE Interface Espressit 23 2019.112, APIs for Networking Development APIs for Networking Development 2.1. BluFi Protocol Protocol documentation: hitps://docs.es if. -idt/erviates in jes blufi.htm! 2.2. APIs on ESP32 End 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 BIuFi can be used to exchange the key. The application layer needs to register relevant callback functions to BIuFi, Table 2-1 provides description of those functions. Table 2-1. Security-Related Functions, Function typedef void (tesp_blufi_negotiate_data_handler_t) (uinté_t “data, int len, uinte_t sroutput_data, int *output_len, Bool *need_free): typedef int (* esp_blufi_encrypt_func_t) (wint8_t ive. uint@_t Fcrypt_data, int cyprt_len) typedef int (* esp_blufi_decrypt_func_t) (wint8_t iv8, uinte_t =crypt_data, Int crypt_len) typedef uintie_t (*esp_bluti_checksum_func_t) (uint8_t ivB, uint@_t ‘data, int Len) Espressit ang Description *+ This tunction is used to re data” during key exchange should be output by passing the parameters output_data anc output_len to Blu + Alter BluFi calls negotiate_data_handler, output_data output oy negotiate_data_handler is sont + Since the length of data to be sent is not definite, **output_data has tomal loc a part of memory or use global variables to release memory via need_free The length of the encoded and decoded data must be the same, #8 inthis function means the B-bit sequence ofthe packets. It can be used for eight bits ofthe initialization vector. “The length of the encoded and decoded data must be the same, {v8 inthis function means the 8-it sequonce of the packets. It can be used for eight bits ofthe initialization vector The function is used to calculate the checksum, Calling this function returns the value of checksum. The returned value will be compared with the um at the end of the packet by Bl 2019.112, APIs for Networking Development 2.3. APIs on the EspBlufi APK End * Source code of EspBlufi for Android: https://github.com/EspressifApp/ EspBlufiForAndroid * Documentation of EspBIufi for Android: htins://github.com/EspressifAop/ EspBlufiForAndroid/biob/master/doc/ Introduction to the EspBiufi API Interface for Android cn.md © Source code of EspBlufi for iOS: hitos://aithub.com/EspressifApp/EsoBlufiForiOS ‘* Documentation of EspBlufi for iOS: hitos://ithub.com/EspressitAop/EspBlufiForiOS/ blob/master/doc/Blufi APP API for iOS CN.md Espressit ang 2019.118, ESP2 Bluetooth Networking Examples ESP32 Bluetooth Networking Examples 3.1. Hardware and Software Preparation * 1 x ESP32 module * 1x PC, connected to the module to supply power and print log for ESP32, ‘+1 x smartphone (Android 4.3 or above) ‘* Download and install EspBlufi on the smartphone, Tum on the Wi-Fi and Bluetooth capabilities on the phone. The link for downloading EspBluf is httos.//github.com/Espres /EspBlufiForAndroid/ 3.2. Setting ESP32 to Station Mode 1. Power on the module. The following log will be output to the serial port tool: J 3155) er: Startup ery lg (3165) oT: GarTscreateservice: handle of service handlet (5175) et: Bracdaco-ble-load-local-keys? func not ported 1 (3185) BLUFT_pEMO: 60 ADDR: 24:0a:c4:01 4dzbe 1 G15) BLUFI_DEMO: BLUFT VERSION 0100 1 185) BLUFI_DEMO: BLUFT Init Finish 2. Open the EspBlufi app, and refresh the interface by swiping down from the top of the screen. The nearby Bluetooth-enabled devices will be shown on the screen. Figure 3-1. EspBilufi interface Espressit 8/13 2019.118, ESP2 Bluetooth Networking Examples 3. Click on the ESP32 device in the interface as Figure 3-1 shows, and click Connect button [= ]to establish Btuetooth connection to it. Successful connection will yield the interface shown in Figure 3-2. CMa Conested 0AE-MT:56 Discover sence and characteristics Set mtu 128 complete we] eee Figure 3-2. Interface Showing Successful Connection Meanwhile, the following log will be output to the serial port tool: e 37875) E (e143) er: device 12 connected 48:63:0F:4 bbem_ble_resolve_random_addr_on_conn_cmp! unable to match and resol 186, server_ifad reasone0x0,connect_idea (38145) ‘smp_br_connect_caTTback 1s called on unexpected transport 2 (G8145)[BLUFT_peM0? BLUFT ble connect (38285) eT: MTU request POU with MTU size 64 Ir e (38285) E (38285) Tr C0188: em sereleoataLength fa'led, peer does nor support request EniT back not found for application comida BLUFT-Dewo: BLUFT get wift status from AP LW Note: Ifthe Networking bution isnot shown or can not be clicked in the interlace of Figure 3-2, it means that Blustooth connection has failed. 4. Click on the Networking button E8 to configure the network, get the dropdown menu for network configuration, as Figure 3-3 shows: Espressit wis 2019.118, ESP2 Bluetooth Networking Examples station NETGEAR a Figure 3-8. Network Configuration interface 5, Select the device mode from the dropdown menu, as Figure 3-4 shows, (BIUFi networking supports the following three mod. Station, SoftAP, and Station+SottAP}) ssaten rc u ° < Figure 3-4. Selecting Device Mode Espressit 73 2019.118, ESP2 Bluetooth Networking Examples 8. Select Station mode as an instance, click on the refresh button FISSID. Then, enter the password. . and choose the Wi- a moo Figure 3-5. Configuring the Station Mode 7. Click on the ™® button to complete the configuration. Successful configuration wil lead to the interface as Figure 3-6 shows. The information marked in red in Figure 3-6 shows the Wi-Fi mode (which is Station mode in this example) and the connection information (such as the AP's BSSID and SSID, as well as the connection status). Figure 3-6, Station Connection Information Espressit aig 2019.118, ESP2 Bluetooth Networking Examples Meanwhile, the following log will be output to the serial port tool: TF (421745) BLUFT_pEMO: BLUFY Set WIFI opmode 1 T (421845) BLUFT_DEMO: Recv STA SSID OVES_HOME 1 (421945) BLUFT_DEMO: Recv STA PASSWORD 12345678 1 (422085) eLUFT_DEMO: BLUFT requset wif connect to AP 122055) wit: n26 2, 9:2. 0, ap:255 255, stas 123615) Wiel: eave! Ini 2> uth ce 2, pre 123605) Wifl: State: auth —> assoc (0) 123645) wifl: state! assoc —> run (10. 123675) WiFl: connected with ovES_FeNe, channel 6 (124305) event: ip: 192-168.1.105, mask! 255.255.255.0, gw: 192.168.2.1 33685) WIFl: pa start, type 3.3. Setting ESP32 as a SoftAP. 1, Power up the module, Connect the EsoBluti 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. id SoftAP . Open : Sonar SonaP meet AP ssid Figure 3-7. Selecting SoftAP Mode 2. Configure the SoftAP mode, as Figure 3-8 shows, Select the security encryption mode, channel, and maximum number of Stations to be connected. Enter the SoftAP's SSID and password, Click on the | ##® button to complete the configuration. Espressit ang 2019.118, ESP2 Bluetooth Networking Examples “SofAP - WPA PSK - sana sone meni 10 - 2 . bluf soften 12345678, 2 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. BLUFL_DEVICE ‘SoRAPcurent conection: 0 Receive device status responce: op made SOFTAP Stachoconnect wifi now SoAPcurent connection: 0 Receive device status response: op made SOFTAP Stecleconnect wifi now SoRAP caren conection: 0 Receive device status response: (ep modeSOFTAP ‘Stacconnect wifi now 'SoRAP curent conection: Post configure params complete Receive device status response: cp mode SOFTAP ‘Staeconnect wifi now ‘SoRAP curent conection: mee me eX Figure 3-9. SoftAP Connection Information Espressit 10/13 2019.118, ESP2 Bluetooth Networking Examples Meanwhile, the following log will be outpu! the serial port too: I (141967) wifi: mode : softAP (24:0a:c4:01:4d:bd) 1 @42067) BLUFT_DEMO: Recy SOFTAP S510 bluti_softap , ssid Ten 13 1 (142167) BLUFT_DEMO: Rec SOFTAP PASSWORD 12345678 1 (142267) BLUFI_DEMO: Recy SOFTAP CHANNEL 10 1 (142357) BLUFI_DEMO: Recy SOFTAP MAX CONN NUM 2 1 (243107) BLUFT_DEMO: Recy SOFTAP AUTH MODE 4 4, Turn on the smartphone’s Wi-Fi capability. The SoftAP connected can be found in the WLAN interface, as Figure 3-10 shows, ‘enda_108858 7 om Om, EKA esp.020021 VES HOME TLWROaIN ‘lt softap TPUNK.842N 3P.A49090 a a alae ae wie Figure 3-10. The Configured ESP32 SoftAP 5. Connect the smartphone to the ESP32 SoftAP. As shown in Figure 3-11, the prompt fl wil appear, indicating that the Wi-Fi is connected. Espressit 113 2019.118, ESP2 Bluetooth Networking Examples eer) amTeU) ‘uso ves HOME sp.020c21 TUN 2420 Figure 3-11, WiFi Connection Prompt the serial port tool: nwhile, the following log will be outpu I (293557) wif: + ap:10 2, sta:255 255, prof:10 1 (293557) wif, 98:d6!F7:64:13!08 join, AID=1, n, 20 ‘The ESP32 device is successfully connected to Wi-Fi via Bluetooth networking, LW Note: Jues of connection time shown on the Espé examples. Connection time is subject to the. 209 screenshots in this document are provided only al situations Espressit 12/18 2019.11Disclaimer and Copyright Notice Information inthis document, including URL references, f subject to change without rote, THIS DOCUMENT IS PROVIDED AS IS WITH NO WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY, NON-INFRINGEMENT, FITNESS FOR ANY PARTICULAR PURPOSE, OR ANY WARRANTY OTHEAWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OF SAMPLE Alii nciding abit fr inkingement of ary proprietary rights, relating to tho use of irormatton n Bis documents dscamed. No Keansos enotes or ipl, by estoppel or ctherwise, to ary inelectual propary rights ae granted herein The WEF Aiance Member logos a trademark ofthe Wii ance, The Bletoth fgo is 2 rogetorod trademark of Btooth SIS : (rad rare, radars ad registred wairark rentioned inthis document are See ORCSLM opory of na reapoctve mors, ard ao hereby accrowodyed Cee ae LAC OUm| CoPytight © 2019 Espressif Inc. All rights reserved.
You might also like
Automatic Plant Watering Project Using ESP32 Web Server
PDF
No ratings yet
Automatic Plant Watering Project Using ESP32 Web Server
12 pages
LVGL Documentation V7.8.0-Dev
PDF
100% (1)
LVGL Documentation V7.8.0-Dev
437 pages
Esp32-H2 Technical Reference Manual en
PDF
100% (2)
Esp32-H2 Technical Reference Manual en
1,160 pages
CAN Protocol (V6 - 2)
PDF
100% (1)
CAN Protocol (V6 - 2)
68 pages
Tutorial 2
PDF
100% (1)
Tutorial 2
63 pages
Arduino OBD2 Simulator - 3 Steps - Instructables
PDF
100% (1)
Arduino OBD2 Simulator - 3 Steps - Instructables
7 pages
Introducing
PDF
100% (2)
Introducing
34 pages
ESP - Getting Started With The ESP32
PDF
100% (1)
ESP - Getting Started With The ESP32
62 pages
LVGL v7
PDF
No ratings yet
LVGL v7
173 pages
Project-4 ESP32
PDF
100% (2)
Project-4 ESP32
3 pages
CAN Bus Communication Spec
PDF
0% (1)
CAN Bus Communication Spec
7 pages
Arduino Esp8266
PDF
100% (1)
Arduino Esp8266
83 pages
IOT Lab Manual-New
PDF
No ratings yet
IOT Lab Manual-New
45 pages
DIY ESP32 SmartClock Guide V1 5
PDF
100% (1)
DIY ESP32 SmartClock Guide V1 5
19 pages
Introduction To Arduino and Raspberry Pi
PDF
100% (1)
Introduction To Arduino and Raspberry Pi
12 pages
ESP32 Boards Comparison
PDF
100% (2)
ESP32 Boards Comparison
17 pages
2017.04.ESP32 Intro
PDF
100% (2)
2017.04.ESP32 Intro
18 pages
BeagleBone Black Interfacing Hardware and Software - Yury Magda
PDF
No ratings yet
BeagleBone Black Interfacing Hardware and Software - Yury Magda
226 pages
Uart Mcu
PDF
100% (1)
Uart Mcu
13 pages
Arduino Rotary Encoder Menu - Educ8s.tv - Watch Learn Build
PDF
100% (1)
Arduino Rotary Encoder Menu - Educ8s.tv - Watch Learn Build
17 pages
IOT Based Home Automation by Using ESP8266 (NodeMcu)
PDF
100% (1)
IOT Based Home Automation by Using ESP8266 (NodeMcu)
2 pages
Getting Started With The ESPlorer IDE - Rui Santos
PDF
No ratings yet
Getting Started With The ESPlorer IDE - Rui Santos
18 pages
CAN Part2
PDF
No ratings yet
CAN Part2
44 pages
ESP32 DevKit ESP32-WROOM GPIO Pinout
PDF
100% (1)
ESP32 DevKit ESP32-WROOM GPIO Pinout
7 pages
BMP180 (Barometric Pressure Sensor) : Specifications
PDF
100% (4)
BMP180 (Barometric Pressure Sensor) : Specifications
34 pages
16FUSB Project - 1.2
PDF
100% (3)
16FUSB Project - 1.2
16 pages
Adafruit GFX Graphics Library
PDF
No ratings yet
Adafruit GFX Graphics Library
37 pages
ESP32 Bluetooth BLE Remote Control - 8 Steps - Instructables
PDF
No ratings yet
ESP32 Bluetooth BLE Remote Control - 8 Steps - Instructables
10 pages
Smart Home Automation Using Ibm Cloud
PDF
No ratings yet
Smart Home Automation Using Ibm Cloud
94 pages
Low Cost OBD2 Communications On K Line ISO 9141 2
PDF
No ratings yet
Low Cost OBD2 Communications On K Line ISO 9141 2
6 pages
OneGauge Product Catalog 2022 Version
PDF
No ratings yet
OneGauge Product Catalog 2022 Version
13 pages
Temperature and Humidity Sensor On An Arduino
PDF
No ratings yet
Temperature and Humidity Sensor On An Arduino
10 pages
ESP8266 ESP-01 USB Serial Programmer With CH340
PDF
No ratings yet
ESP8266 ESP-01 USB Serial Programmer With CH340
15 pages
Esp 32 Universal With Display Board Getting Started 2.4 Inch
PDF
No ratings yet
Esp 32 Universal With Display Board Getting Started 2.4 Inch
23 pages
Bluetooth Smart Ready Api Reference
PDF
No ratings yet
Bluetooth Smart Ready Api Reference
279 pages
IoT Protocols: Z-Wave and Thread
PDF
No ratings yet
IoT Protocols: Z-Wave and Thread
5 pages
Arduino Ecu Logger Based Obd2 Engine Monitor and Data Logger
PDF
No ratings yet
Arduino Ecu Logger Based Obd2 Engine Monitor and Data Logger
5 pages
Zigbee PRO
PDF
No ratings yet
Zigbee PRO
418 pages
Utility Owners Handbook 181pages en
PDF
No ratings yet
Utility Owners Handbook 181pages en
181 pages
Atmega8 Uc: Uart !!!
PDF
100% (1)
Atmega8 Uc: Uart !!!
16 pages
2.8inch E32R28T E32N28T ESP32-32E Demo Instructions
PDF
No ratings yet
2.8inch E32R28T E32N28T ESP32-32E Demo Instructions
29 pages
WiFi Controlled LED Using ESP8266 and Arduino
PDF
No ratings yet
WiFi Controlled LED Using ESP8266 and Arduino
2 pages
Obd2 Simulator - Ino
PDF
No ratings yet
Obd2 Simulator - Ino
4 pages
Esp32 Bluetooth Architecture en
PDF
No ratings yet
Esp32 Bluetooth Architecture en
32 pages
Esp32 Bluetooth Architecture en PDF
PDF
No ratings yet
Esp32 Bluetooth Architecture en PDF
35 pages
Esp32-C6 Hardware Design Guidelines en
PDF
No ratings yet
Esp32-C6 Hardware Design Guidelines en
33 pages
NextionLTS Instruction Set
PDF
No ratings yet
NextionLTS Instruction Set
49 pages
Getting Started 3.5 Inch
PDF
No ratings yet
Getting Started 3.5 Inch
24 pages
Introduction To QT: Build Great Apps Using QT Jeff Alstadt
PDF
No ratings yet
Introduction To QT: Build Great Apps Using QT Jeff Alstadt
49 pages
Introducing The Motorola HC908 Microcontroller
PDF
No ratings yet
Introducing The Motorola HC908 Microcontroller
26 pages
Carberry Brochure ENG 2 Web
PDF
No ratings yet
Carberry Brochure ENG 2 Web
25 pages
ETL Freescale Prog 805P18 UG
PDF
No ratings yet
ETL Freescale Prog 805P18 UG
19 pages
Raspberry Pi GPIO Home Automation
PDF
No ratings yet
Raspberry Pi GPIO Home Automation
22 pages
ESP32 Bluetooth Networking: User Guide
PDF
No ratings yet
ESP32 Bluetooth Networking: User Guide
16 pages
Arduino Modbus Slave - Jpmzometa
PDF
No ratings yet
Arduino Modbus Slave - Jpmzometa
2 pages
Install 9inch Touch Screen Tutorial Raspberry Pi
PDF
No ratings yet
Install 9inch Touch Screen Tutorial Raspberry Pi
17 pages
Contents CAN Projects With ARM and Arduino
PDF
No ratings yet
Contents CAN Projects With ARM and Arduino
8 pages
Beginning FPGA Programming - Partie68
PDF
No ratings yet
Beginning FPGA Programming - Partie68
5 pages
Home Automation With Raspberry Pi
PDF
No ratings yet
Home Automation With Raspberry Pi
5 pages