Bluetooth LE Long-Range Demo

Last Updated on : 2025-06-04 03:18:00download

Overview

Bluetooth Low Energy (LE) Long Range is a key enhancement introduced by the Bluetooth Special Interest Group (SIG) in the Bluetooth 5.0 standard, designed to address the distance limitations of conventional Bluetooth LE communications. Its core technological innovation lies in the adoption of the LE Coded PHY, which significantly enhances link budget through forward error correction (FEC) and symbol redundancy (S=2/S=8 encoding schemes). This enables reliable communication distances exceeding one kilometer in open environments.

Hardware preparation

It is recommended to use the TI official development boards. For more hardware information, see BLE-CC2340.

Bluetooth LE Long-Range Demo

Software preparation

Get the SDK

Install the TuyaOS development environment and download the latest version of TuyaOS SDK (CC2340). For detailed steps, refer to Environment Setup.

Bluetooth LE Long-Range Demo

Build and flash

  1. Build the development framework. For detailed steps, refer to Build development framework.
  2. Flash the firmware. For detailed steps, refer to the BLE-CC2340 firmware flashing.

Device handshake

  1. Connect the development board to the computer via the serial port.

  2. Download the host software (refer to the user guide). Select the correct serial port and set the baud rate 115200.

  3. Choose System > Handshake and click Send Cmd to implement a handshake between the host software and the device.

  4. Next, you can use the host software to explore more functionalities. For more information, see the Bluetooth LE Basics Demo.

Long range

Interface description

Bluetooth LE devices typically operate in two states: advertising and connecting. The tuyaos_demo_ble_cc2340 supports two types, including standard advertising and long-range advertising.

The standard advertising uses the following interfaces:

tal_ble_advertising_start
tal_ble_advertising_data_set
tal_ble_advertising_stop
tal_ble_advertising_data_update

The long-range advertising uses the following interfaces:

tal_ble_ext_advertising_create
tal_ble_ext_advertising_config
tal_ble_ext_advertising_start
tal_ble_ext_advertising_stop
tal_ble_ext_advertising_delete

Long-range advertising must first be configured as extended advertising.

Application scenarios

Long-range advertising and standard advertising can be enabled simultaneously or used independently. The following four scenarios are described:

  • Enable both long-range advertising and standard advertising
    • This is the default implementation method of the SDK.
    • Long-range advertising is suitable for long-distance scenarios. When used with a gateway that supports Long-range capabilities, it can achieve a communication distance of kilometers.
    • Standard advertising is designed to be compatible with scenarios where mobile phones control devices, because most mobile phones on the market currently do not support the scanning capability of long-range advertising.
  • Enable long-range advertising only
    • Applies to scenarios where a gateway is used to achieve long-distance communications.
    • Applies to scenarios where a mobile phone is not required.
    • Implementation method: Comment out the two tal_ble_advertising_start interfaces in tuya_sdk_callback.c.
  • Enable standard advertising only
    • Applies to scenarios that do not require long-distance communications.
    • Support both mobile phones and gateways.
    • Applies to scenarios that are very sensitive to power consumption.
    • Implementation method: Disable the macro TUYA_BLE_FEATURE_LONG_RANGE.
  • Disable both long-range advertising and standard advertising
    • Applies to scenarios requiring extremely low power consumption (less than 1 μA).
    • As a Bluetooth device, it needs to be connected and controlled by a mobile phone or gateway. This scenario is rarely used.