Introduction
Bluetooth® Low Energy protocol is establishing itself as one of the main protocols in IoT ecosystem.
It allows transmitting data over 40 channels in the 2.4GHz
unlicensed ISM (Industrial, Scientific and Medical) frequency band.
Moreover, Web Bluetooth® is also trying to bring Bluetooth® control over web applications.
In the last few years, this technology did not catch on and struggle to establish itself as a standard between web browsers.
Theoretical Concepts
Before moving on and gets the hands dirty with the actual code, it’s very important to learn the main concepts on which Bluetooth® relies on. You can skip this slice and move to Hardware implementations if you’re already familiar with the terminology.
Bluetooth Low Energy Stack
The Bluetooth LE stack is made up by layers and functional modules (some of which are optional). It defines the way the host and the controller architectural blocks communicate.
- Generic Access Profile (GAP) defines:
- advertising for connectionless communication
- how to perform device discovery
- security levels and modes
- some UI standard
- Generic Attribute Profile (GATT)
Defines high level data types: services, characteristics and descriptors in terms of attributes in the attribute table. It also defines higher level procedures for ATT to work with the attribute table. - Attribute Protocol (ATT)
Allows the discovery and use of data in the server’s attribute table. - Security Manager Protocol (SMP)
It is used when executing security procedures such as pairing. - Logical Link Control and Adaptation Protocol (L2CAP)
Multiplexer within the host, ensuring protocols are serviced by the appropriate host. - Host Controller Interface (HCI)
Provides a bidirectional communication interface between host and controller. - Isochronous Adaptation Layer
Allows different frame durations to be used by devices using isochronous communication. - Link Layer
Defines air interface packet formats, bit stream processing procedures, link control and protocols for over-the-air communication. - Physical Layer
Defines aspects related to radio (RF) usage: modulation schemes, frequency bands, channel use, transmitter and receiver characteristics.
Hardware implementations
Arduino BLE communication
Almost any board from MKR and Nano families incorporates the NINA-W10 module from u-blox, which is a low power chipset operating in the 2.4GHz
range.
BLE communication is managed by ArduinoBLE library.
It allows you to read sensor values and write commands to actuators over BLE by exposing them on a set of GATT services and characteristics defined by 16-bit
universal identifiers (UUID).
Moreover, you can use the default 16-bit UUID assigned numbers or define custom UUIDs by your own.
Please refer to bluetooth-low-energy
directory of arduino-projects
repository to learn how to let your Arduino boards communicate via BLE.
Documentation
Useful links:
- Bluetooth® Low Energy Primer
- Bluetooth® assigned numbers
- 16-bit UUID assigned numbers
- NINA-W10 module
- ArduinoBLE library
bluetooth-low-energy
directory ofarduino-projects