Arduino boards with a Bluetooth Low Energy (BLE) chipset can act as a “host” for other BLE devices. That’s because the ArduinoBLE library has added BLE Central support.
BLE Central vs. Peripheral
Like most modern protocols, BLE devices fit into different roles: either central or peripheral. Central devices are typically something like a PC, Raspberry Pi, or smartphone. Peripherals tend to be smaller devices like a sensor, Bluetooth tag, or even a multimeter.
An advantage of supporting both roles is that an Arduino can now serve as a hub for other BLE devices.
ArduinoBLE Library v1.1.0
In the past, the ArduinoBLE library only supported the peripheral role. With the new v1.1.0 release, BLE-enabled Arduino boards can act as a central device.
The latest batch of Arduino Nano 33 boards includes a u-blox NINA-W102 module. It supports WiFi, Bluetooth, and BLE. The updated ArduinoBLE library works with boards like the MKR WiFi 1010, Uno WiFi Rev 2, Nano 33 BLE, Nano 33 BLE Sense, and Nano 33 IoT.
The library is available through the web-based IDE on Arduino Create or in the Library Manager for the IDE.
In the above screenshot, the Central Scan example scans for BLE devices. As you can see, there are many in my area. However, why not add one more?
Two Arduino, One BLE
Now I have attached a second Nano 33 BLE and have programmed it to use the periphery role. The code is just the LED and LEDControl examples included with the ArduinoBLE library. The one change I made is it uses serial to control the remote LED. The control code checks for a ‘!’ character to turn on and a ‘@’ character to turn off. As you can see, the two BLE devices are communicating without the use of another host. (Well, other than power!)
With BLE Central support in the ArduinoBLE library, Arduino boards can now connect to peripheral devices and perhaps even act as a hub for IoT applications. For more information, check out the post by Sandeep Mistry on the Arduino blog, where he explains the considerable effort to bring BLE Central support to the Arduino ecosystem.
Go to Source
Author: James Lewis