Project tutorial
Bluetooth Low Energy: Subscription to a Service

Bluetooth Low Energy: Subscription to a Service © CC BY-SA

An example of how to subscribe to a characteristic of a service.

  • 25 views
  • 0 comments
  • 0 respects

Components and supplies

About this project

In this tutorial we are going to see an example of using Bluetooth Low Energy technology using the Arduino MKR WiFi 1010 and Arduino Nano 33 BLE Sense boards together with the ArduinoBLE library. Specifically, we are going to show an example of how you can subscribe to a characteristic of a service.

The Bluetooth on the Arduino Nano 33 BLE Sense is managed by the NINA B306 module (Bluetooth 5.0 qualification).

Data Sheet NINA B306

In the Arduino MKR WiFi 1010, Bluetooth is managed by the NINA -W102 module (Bluetooth 4.2 qualification).

Data Sheet NINA-W10

The following links explain the basic concepts of Bluetooth Low Energy technology that will help us understand how it works:

https://www.arduino.cc/en/Reference/ArduinoBLE

https://learn.adafruit.com/introduction-to-bluetooth-low-energy/introduction

In this project we will see how the central device will subscribe to a characteristic of a peripheral device service and will only receive information on the value of this characteristic in case its value is updated, in this way the central device will not have to request the value constantly.

To illustrate with an example what was explained above, we will mount a metal structure with a servomotor that will hold a hand drawn on paper that will move depending on the movement detected by the gesture sensor present on an Arduino NaNo 33 BLE Sense board.

The operation will be as follows:

The central device will connect to the peripheral device looking for the characteristic of the specified service to which you want to subscribe.

Once the connection is established if the gesture sensor of the Arduino Nano 33 BLE Sense (ADPS-9960) detects any of the following movements: UP, DOWN, LEFT and RIGHT, the peripheral device will write the corresponding value (associated with these movements) in the characteristic of the service whose central device is subscribed causing the servo motor to move in the direction marked by the movement (we will only consider the movements of UP, LEFT and RIGHT, the “DOWN” movement will be ignored).

NOTE: The latest version of the ArduinoBLE library is required.

Peripheral device: Arduino Nano 33 BLE Sense

Central Device: Arduino MKR WiFi 1010 + Arduino MKR Motor Carrier

Code

Sketch to load into the central device Arduino Nano 33 BLE Sense:
Sketch to load into the central device Arduino Nano 33 BLE Sense:
Sketch to load on the Arduino MKR WiFi 1010 peripheral device:
Sketch to load on the Arduino MKR WiFi 1010 peripheral device:

Comments

Similar projects you might like

Home Automation With Arduino 101 Using Bluetooth Low Energy

Project tutorial by naveen manwani

  • 2,385 views
  • 0 comments
  • 6 respects

Mini 4WD Arduino Robot Controlled by Bluetooth

Project tutorial by Avilmaru

  • 2,754 views
  • 1 comment
  • 15 respects

Monitor Your Energy Bill via Modbus, MKR WiFi 1010 and RS485

Project tutorial by 3 developers

  • 34,588 views
  • 20 comments
  • 83 respects

Bluetooth Controlled Servo

Project tutorial by JANAK13

  • 30,259 views
  • 25 comments
  • 50 respects

Spider-Man Mask with Servos and Bluetooth Control

Project tutorial by iiMc204

  • 6,086 views
  • 1 comment
  • 18 respects

Arduino Robot w/ GoPro and FPV iPhone Control via Bluetooth

Project in progress by AlxArd

  • 8,760 views
  • 7 comments
  • 41 respects
Add projectSign up / Login