Extra 5% OFF Use Code: OL05
Free Shipping over ₹999

ESP32 BLE

The ESP32 is equipped not only with Wi-Fi but also with Bluetooth and Bluetooth Low Energy (BLE). This article provides a brief overview of BLE and its potential applications, followed by examples of using BLE with the ESP32 in the Arduino IDE. Let’s delve into what BLE is and explore some ESP32 examples.

Introduction Bluetooth Low Energy (BLE)


Bluetooth Low Energy, or BLE, is a power-efficient version of Bluetooth designed for short-distance data transmission with minimal bandwidth requirements. Unlike traditional Bluetooth, which is always active, BLE remains in a sleep mode until a connection is established. This characteristic results in significantly lower power consumption, with BLE using approximately 100 times less power than standard Bluetooth, depending on the specific use case.

Moreover, BLE is versatile, supporting not only point-to-point communication but also broadcast mode and mesh network configurations.

Application


Given its characteristics, BLE is well-suited for applications requiring periodic exchange of small data amounts while running on a coin cell. Industries such as healthcare, fitness, tracking, beacons, security, and home automation find BLE particularly valuable for its ability to efficiently handle these types of tasks.

BLE Server and Client

Bluetooth Low Energy (BLE) involves two device roles: the server and the client. The ESP32 has the capability to function as either a client or a server.

In the BLE context, the server actively advertises its presence, making it discoverable by other devices. It holds the data that the client can access.

On the other hand, the client scans for nearby devices, identifies the server it seeks, establishes a connection, and awaits incoming data. This communication method is known as point-to-point.


As highlighted earlier, Bluetooth Low Energy (BLE) also encompasses broadcast mode and mesh network:

  1. Broadcast Mode: In broadcast mode, the server disseminates data to numerous connected clients. This enables the efficient transmission of information from a single source to multiple recipients.
  2. Mesh Network: Mesh network functionality in BLE establishes a many-to-many connection among all devices. This interconnected network structure allows seamless communication between various devices, offering a versatile and collaborative approach to data exchange.

GATT

GATT, which stands for Generic Attributes, establishes a hierarchical data structure accessible to connected Bluetooth Low Energy (BLE) devices. Essentially, GATT outlines how two BLE devices communicate by sending and receiving standardized messages. Gaining an understanding of this hierarchical structure is crucial as it simplifies the process of utilizing BLE and developing applications for it.

BLE Services


In the hierarchy of Bluetooth Low Energy (BLE), the highest level is occupied by a profile, comprising one or more services. Typically, a BLE device encompasses multiple services.

Each service includes at least one characteristic or may reference other services. A service essentially acts as a repository of information, such as sensor readings.

Predefined services established by the Bluetooth Special Interest Group (SIG) encompass various data types, including but not limited to Battery Level, Blood Pressure, Heart Rate, Weight Scale, etc. Understanding this structure is vital for comprehending how BLE devices organize and exchange information.

Within the Bluetooth Low Energy (BLE) hierarchy, a characteristic is always associated with a service and serves as the location where the actual data resides (value). This characteristic entails two fundamental attributes: the characteristic declaration, providing metadata about the data, and the characteristic value.

In addition to the characteristic value, descriptors may follow, providing further details on the metadata outlined in the characteristic declaration.

The properties of a characteristic articulate how its value can be interacted with. Essentially, these properties encompass the operations and procedures available for use with the characteristic including,

  • BroadcastRead
  • Write without response
  • Write
  • Notify
  • Indicate
  • Authenticated Signed Writes
  • Extended Properties

UUID


Each service, characteristic, and descriptor possesses a Universally Unique Identifier (UUID), a distinctive 128-bit (16 bytes) number. For instance:

UUID: 55072829-bc9e-4c53-938a-74a6d4c78776


In essence, the UUID serves the crucial role of uniquely identifying information. For instance, it can be employed to identify a specific service offered by a Bluetooth device.

BLE with ESP32


The ESP32 has the capability to function either as a BLE server or a BLE client. The ESP32 BLE library for Arduino IDE provides numerous examples for BLE functionality on the ESP32. It’s important to note that this library is included by default when you install the ESP32 on the Arduino IDE.

Please ensure that the ESP32 board is selected under Tools > Board to view and access the ESP32 examples related to BLE.

    Leave a Reply

    Your email address will not be published.

    Need Help?