Main Content

BLE Send

Send data using Bluetooth Low Energy (BLE) protocol

  • Library:
  • Simulink Support Package for Arduino Hardware / Common

  • Arduino BLE Send icon

Description

Use the BLE Send block to enable your Arduino® board to transmit data or instructions to a nearby device or sensor using the Bluetooth® Low Energy (BLE) protocol.

Note

The BLE Send block supports only the Arduino Nano 33 IoT, Arduino Nano 33 BLE Sense, and Arduino MKR Wifi 1010 boards.

Central Mode

A BLE device configured in the Central (Client) mode can scan and detect nearby BLE devices and determine their available services. When you set the Mode parameter to Central (Client), use the Scan button on the block to set up the BLE Setup wizard. The BLE Setup wizard scans for nearby BLE devices and determines the services and characteristics available on these devices. Once wizard detects nearby BLE devices, select a peripheral device and its characteristic using the Peripheral Device and Characteristic parameters.

Peripheral Mode

A BLE device configured in the Peripheral (Server) mode advertises its presence to other devices, broadcasting minimal information on the services it supports and the identity of the device. This allows BLE devices configured in the central mode to scan and detect nearby BLE devices and determine their available services. When you set the Mode of the device to Peripheral (Server), you must specify the Service and Characteristic of your device. Other devices with the same service and characteristic then receive the data sent from your Arduino board.

Service and Characteristic

BLE data exchange is based on the Generic Attributes (GATT) profile, which defines a hierarchical data structure. GATT consists of a service, such as Heart Rate service, that can contain several characteristics, such as Heart Rate Measurement or Body Sensor Location. Universal unique ID (UUID) defines both services and characteristics allowing different BLE devices to identify the services and characteristics of the connected device.

When a BLE device operates in the peripheral mode, the available services provided by the device are advertised to any listening BLE devices operating in the central mode. Only when the BLE central device establishes a connection to the BLE peripheral device are the characteristics within the service made available. Many services and associated characteristics are already available as standards, including the Heart Rate service.

You can optionally specify your own or custom services and characteristics using your own UUIDs for the service and characteristics. To enable custom UUID specification, select the Specify using UUID parameter.

Ports

Input

expand all

The block inputs data transmitted by a Bluetooth device as an N-by-1 array.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean

Parameters

expand all

Set the hardware of your BLE device to one of these modes.

  • Peripheral (Server) — When you select this mode, specify the Service and Characteristic of the Bluetooth device. Other Bluetooth devices then receive the data sent from your Arduino board that has the same service and characteristic.

  • Central (Client) — When you select this mode, scan and detect nearby BLE devices before selecting the peripheral device in the Peripheral device parameter and its characteristic in the Characteristic parameter.

Enable this parameter to specify the BLE Service and Characteristic using the Universal unique ID (UUID) values.

Dependencies

To enable this parameter, set Mode to Peripheral (Server).

Select the service broadcast by the BLE device when operating in the Peripheral (Server) mode. Available services that can be broadcast from the device are listed in the following table. When Specify using UUID is enabled, you can write a specific UUID value for the characteristic as a character array.

ServiceCharacteristic
Generic AccessDevice Name
Appearance
Peripheral Privacy Flag
Reconnection Address
Peripheral Preferred Connection Parameters
Generic AttributeService Changed
Glucose serviceGlucose Measurement
Glucose Measurement Context
Glucose Feature
Record Access Control Point
Health Thermometer serviceTemperature Measurement
Temperature Type
Intermediate Temperature
Measurement Interval
Heart Rate serviceHeart Rate Measurement
Body Sensor Location
Heart Rate Control Point
Blood pressure serviceBlood Pressure Measurement
Intermediate Cuff Pressure
Blood Pressure Feature
Running Speed and CadenceRSC Measurement
RSC Feature
SC Control Point
Sensor Location
Cycling Power serviceSensor Location
Cycling Power Measurement
Cycling Power Vector
Cycling Power Feature
Cycling Power Control Point
Location and NavigationLocation and Navigation Characteristic
Navigation
Position Quality
LN Feature
LN Control Point
Environmental SensingMagnetic Declination
Elevation
Pressure
Temperature
Humidity
True Wind Speed
True Wind Direction
Apparent Wind Speed
Apparent Wind Direction
Gust Factor
Pollen Concentration
UV Index
Irradiance
Rainfall
Wind Chill
Heat Index
Dew Point
Magnetic Flux Density - 2-D
Magnetic Flux Density - 3-D
Barometric pressure Trend
Body Composition serviceBody Composition Feature
Body Composition Measurement
Weight ScaleWeight Scale Measurement
Weight Scale Feature
Continuous Glucose Monitoring ServiceCGM Measurement
CGM Feature
CGM Status
CDM Session start Time
Indoor PositioningIndoor Positioning Configuration
Latitude
Longitude
Local North Coordinate
Local East Coordinate
Altitude
Uncertainty
Location Name
Pulse Oximeter ServiceRecord Access Control Point
PLX Spot-Check Measurement
PLX Continuous Measurement
PLX Features
Fitness Machine ServiceTreadmill Data
Cross Trainer Data
Step Climber
Stair Climber
Rower Data
Indoor Bike Data
Supported Speed Range
Supported Inclination Range
Supported Resistance Level Range
Supported Heart Range
Supported Power Range

Dependencies

To enable this parameter, set Mode to Peripheral (Server).

Select the BLE characteristic of the peripheral device. The available characteristics vary depending on the service you select in the Service parameter.

Dependencies

To enable this parameter, set Mode to Peripheral (Server).

Click this button to open the BLE Setup wizard. Use the wizard to discover nearby Bluetooth enabled devices and their characteristics. You can scan for the devices using the host computer or the Arduino board. To open and configure the BLE Setup wizard:

  1. Set Mode to Central (Client). The BLE Setup wizard allows you to scan nearby Bluetooth devices.

  2. Follow the instructions on the screen to import the device name and its characteristics to show in the Block Parameters dialog box under Peripheral device and Characteristic parameters, respectively.

  3. Close the BLE Setup wizard. Re-open the BLE Receive block and select from the available peripheral devices and characteristics.

Dependencies

To enable this button, set Mode to Central (Client).

Select from the available peripheral devices or sensors found using the BLE Setup wizard. If you cannot see any devices, click Scan to detect new BLE devices within the range of your host computer or Arduino board.

Dependencies

To enable this parameter, set Mode to Central (Client).

Select a characteristic for the peripheral device from the available characteristics. For a complete list of characteristics available under each BLE service, see the Service parameter.

Dependencies

To enable this parameter, set Mode to Central (Client).

Introduced in R2021b