Last Updated on : 2024-11-20 02:14:53download
This development tutorial will walk you through how to use the Tuya Bluetooth module and the SDK to develop a Bluetooth product and connect it to the Tuya Developer Platform. You will learn about the terminology, development procedure, development tools, and technical support.
Tuya provides a series of Bluetooth Low Energy (LE) network modules with various specifications and methods of soldering to address different needs of IoT product development. For more information, see Bluetooth LE Module.
Series | Module name | Description |
---|---|---|
BP series | BPLCB, BP3L, and BPU | Phyplus based module with standard Bluetooth protocol |
BT series | BT2L-A, BT3L, BT5S, BT7L, BT8P, BTU, and more | Telink based module with standard Bluetooth protocol |
BN series | TYBN1 | Nordic based module with standard Bluetooth protocol |
BR series | BR3L | Realtek based module with standard Bluetooth protocol |
TYBT series | TYBT1, TYBT2, TYBT3, TYBT4, TYBT8, and more | Telink based module with Tuya-specific Bluetooth protocol |
BK series | YLB1 | Beken based module with standard Bluetooth protocol |
… | … | … |
Naming rules
The generic naming rule for modules: (TY) + wireless protocol + chip platform + series + performance. The names of certain modules only use some fields.
For example, BTU: B (Bluetooth LE) + T (Telink) + U (U series or U shape). TYBN1: TY (Tuya) + B (Bluetooth LE) + N (Nordic) + 1 (1 series).
The Bluetooth LE module datasheet can help you in hardware design. The datasheet provides information about electrical specifications, pin definition, and multiplexing, which can guide you to implement the required features by pin configuration. Take care of the mapping between the module’s pins and the IC’s pins when you check the official documentation of the chip platform.
Tuya Bluetooth SDK is built on top of the TuyaOS and designed for developing smart Bluetooth products. The SDK includes a host of features and functions to help you develop easily, including device pairing, upstream and downstream communication, production test, authorization, and OTA updates. You do not need to take care of feature implementation for different Bluetooth chip platforms. Just working on the standard APIs, you can connect your products to the Tuya Developer Platform and make them IoT-enabled.
Series | Applicability | Description |
---|---|---|
Bluetooth SDK | Third-party chip | Tuya provides you with a library based on your chip platform, compiler, and compilation options. You can integrate this library into the SDK of your chip platform to make hardware adaptations. This way, you can develop the application code. |
Bluetooth chip SDK | Tuya standard chip | The SDK has been adapted for specific chip platforms. Developing with Tuya’s network module integrated with corresponding chips, you can directly work on the application code without any adaptation operation. |
To make your development much simpler, we have made adaptations to popular Bluetooth chip platforms and provided chip platform-specific network modules. Therefore, Tuya Bluetooth chip SDK is also known as Tuya Bluetooth module SDK. With a specific SDK and Tuya’s network modules, you can focus on writing application code instead of spending time on the required infrastructure. Tuya Bluetooth chip SDK is compatible with the following platforms:
Manufacturer | Chipset platform |
---|---|
Nordic Semiconductor | nRF52832 |
Cypress | PSoC 63 |
BEKEN | BK3431Q |
BEKEN | BK3632 |
FREQCHIP | FR8018H |
Phyplus | PHY6222 |
Telink | TLSR8253 |
… | … |
For more information about the standard chip and third-party chip, see Hardware Support.
Layer | Description |
---|---|
Application | Applications built on top of the Tuya Bluetooth SDK. |
Message or Callback | The SDK sends data or events to the mobile app using messages or registered callbacks. |
Main Process Function | Serving as the main engine of the SDK. This function is called by Application . If your chip runs an operating system (OS), the SDK will automatically create a task by using the OS API from the port layer to run a Main Process Function. If your chip does not run an OS, this function is called in a loop. |
Tuya Bluetooth LE SDK API | The SDK provides APIs for managing Bluetooth communication. If your chip runs an OS, API calls are made based on asynchronous message-based communication, and the result of an operation is returned to the device application through a message or a callback. If your chip does not run an OS, the return value of an API call is the result of an operation. |
SDK Config | The configurable SDK allows you to tailor functionality by editing the macro in the config file. For example, you can configure a general pairing mode for various network protocols, and the considerations can be Bluetooth LE devices, Elliptic Curve Diffie-Hellman (ECDH) encryption scheme, OS, and more. |
Tuya Bluetooth LE SDK | Tuya’s Bluetooth communication protocol is included in the SDK to provide the required interfaces for Bluetooth-based applications. |
Port | The abstract hardware interfaces that you need to port to your chip platform. |
Platform | The chip platform. The chip and protocol stack is maintained by the chip producer. |
To develop with Tuya Bluetooth SDK, take the following steps:
This section describes the terminology that is used in SDK development.
Term | Explanation |
---|---|
Product ID (PID) | The PID is a unique identifier assigned to each product created on the Tuya Developer Platform. It is associated with all information related to a product, including the defined features, app panel, and delivery information. |
Universally unique identifier (UUID) | A UUID is a 16-digit unique number to identify each device, which is also the credential to authorize access to the cloud. |
Device ID | The device ID is also known as virtual ID. It is a UUID-based device credential generated in the cloud when a device is paired and activated. |
AuthKey | A 32-digit key assigned to each device connected to the Tuya Developer Platform. A UUID corresponds to an AuthKey. |
MAC address | A MAC address is a unique 6-byte (48-bit) address that uniquely identifies a network interface card (NIC). It has two halves: the first 24 bits consist of an Organizationally Unique Identifier (OUI) assigned to a vendor by the IEEE, and the last 24 bits are defined by the manufacturer. You can provide a block of MAC addresses you purchased from IEEE for MAC address generation. |
Data point (DP) | Each feature defined for a product on the Tuya Developer Platform is described as a DP. |
Firmware key | A firmware key is a unique identifier given to the firmware uploaded to the Tuya Developer Platform. The firmware key for Bluetooth firmware is 8 bytes by default. |
License | A license is also known as a token or credential. It is used to authorize a device to connect to the cloud. Licenses can be delivered in the form of a list of plaintext or a production credential of ciphertext. A list consists of UUID, AuthKey, and MAC address. A production credential has a strong binding to the firmware key, firmware name, and firmware version. |
Chip manufacturer | The chipmaker, usually used to describe the official documentation of a chip platform. |
Bind Bluetooth device | Bind a Bluetooth device with an app account through the Tuya-specific Bluetooth protocol after an exchange of keys and authentication. |
Unbind Bluetooth device | Unbind a Bluetooth device from an app account. The device will be in the unbound and not connected state. Information about the keys and binding status will be removed from the device. |
Bluetooth connection | Indicate a Bluetooth device is in the connection state in the link layer. |
Bluetooth advertising | Indicate a Bluetooth device is in the advertising state in the link layer. |
For more information about terminology, see Glossary.
Built on top of Tuya’s proven IoT solutions and Arduino specifications, Tuya Sandwich development kit is designed to help you quickly get started with IoT prototyping. With this development kit, IoT prototyping is more like building blocks by adding the required boards to implement features.
Tuya Sandwich development kit provides development boards for different purposes, including microcontroller, communication, function, and power source. For more information, see Tuya Sandwich Development Kit. Bluetooth LE SoC microcontroller board (BT3L) and Bluetooth LE SoC microcontroller board (BTU) are available to choose from.
This tutorial uses the Bluetooth LE SoC microcontroller board (BTU), temperature and humidity sensor board, and power source board to prototype an IoT product.
You can find various open source IoT projects built with the Tuya Bluetooth module and SDK from Tuya’s Project Hub and get inspired. The following table lists the projects published in the Project Hub.
Demo | Module | Chipset platform | Get SDK |
---|---|---|---|
Smart Neck Massager [Tutorial] [GitHub Repository] | BTU | TLSR825x | GitHub repository |
Smart Kettle [Tutorial] [GitHub Repository] | BTU | TLSR825x | GitHub repository |
Smart Curtain Robot [Tutorial] [GitHub Repository] | BTU | TLSR825x | GitHub repository |
Smart Taste-Elevating Spoon [Tutorial] [GitHub Repository] | BT3L | TLSR825x | GitHub repository |
Note that Tuya Bluetooth SDK has been updated. tuya_ble_sdk_Demo_Project_tlsr8253 in the above table is the legacy version. For more information, see Bluetooth LE SDK Guide and Bluetooth LE SDK Demo. You can create a new Bluetooth product and select a Bluetooth LE module on the Tuya Developer Platform to download the latest SDK.
Find Tuya Community on GitHub and explore some useful sensor drivers and generic feature components for efficient development.
Development resources and support:
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback