Last Updated on : 2024-06-25 09:35:27download
Bluetooth Device Development Kit is built on top of TuyaOS for Bluetooth Low Energy (LE) device development. This kit includes a host of features and standard APIs to help you develop easily, including device pairing, upstream and downstream communication, production testing, authorization, and OTA updates.
You do not need to take care of feature implementation for different chip platforms. Just working on the standard APIs, you can connect your products to the Tuya Developer Platform and make them IoT-enabled.
Bluetooth Device Development Kit requires 20 KB flash and 10 KB RAM.
The memory footprint of a development kit depends on the chip platform for use. Check the section Build Software > Calculate flash and RAM usage in the file TuyaOS_BLE_Platform_xxxx.md
to get the flash and RAM usage for your chip platform.
Capability | Description |
---|---|
Initialization | Understanding the initialization process can help you get through Bluetooth software development. Initialization is a process where after a device enters the main function after power on, it calls a range of APIs to initialize the hardware environment, TuyaOS software, and applications. During the application initialization, take care of the sequence of API calls. Business logic is generally after the Bluetooth stacks. The dependencies for initialization vary depending on the modules. |
Reset | A reset can restore a device to the settings that the device had before it was paired. Device reset can be triggered by hardware operation or mobile app operation. In terms of device status after a reset, there are two types of reset: normal reset (device unbound) and factory reset (device unbound with data erased). |
Authorization | Only authorized Bluetooth devices can connect to the Tuya Developer Platform. Authorization is the process of writing the device identification information for authentication and pairing to the non-volatile memory (typically the flash memory) on the device. You can perform authorization by editing the code or using a host. The former is for debugging purposes, and the latter is for mass production. |
Production testing | Testing in the production process helps you identify any Bluetooth hardware issues for better yield. There are PCBA testing and end product testing. In PCBA testing, communication with Bluetooth devices is established through the serial port. In end product testing, communication is over Bluetooth to test the device’s radio and peripheral functionality. |
Capability | Description |
---|---|
Connectivity capability | There are three types of sub-devices by connectivity capabilities.
|
Roaming | There are two types of sub-devices by roaming capability.
|
Connection strategy | There are two types of connection strategies for common Bluetooth sub-devices that support connection to the Tuya-enabled Bluetooth gateway.
|
Capability | Description |
---|---|
Pairing modes | The central device can initiate a pairing request to an advertising peripheral device. After successful pairing, the peripheral device is bound to the central device. They communicate with each other (including the exchange of data point data) over a secure channel in compliance with Bluetooth specifications. There are two methods to pair a Bluetooth device.
|
Removing device | Removing a device is one of the methods to reset a device. There are two types of removing by connection status.
|
Security level | There are two types of sub-devices by security level.
|
Capability | Description |
---|---|
DP data communication | There are three types of DP communication based on the direction of data flow.
|
Linkage model | Linkage is a type of automation based on the DP model. There are two types of linkage.
|
Tap-to-Run | Difference between the scene and automation: A scene only consists of actions, without a condition. Triggering a scene is actually to execute the preset action. Automation contains both conditions and actions. When a condition is met, an action is executed. |
Capability | Description |
---|---|
Time service | A Bluetooth device can request the network time in a specified format through the Smart Life app or Bluetooth gateway. |
Weather service | A Bluetooth device can request weather data in terms of location, weather variables, and forecast days through the Smart Life app or Bluetooth gateway. This feature is free for now, but may become paid in the future. |
Bulk data transfer | Most products cache DP data when going offline and send all the cached data out when Bluetooth is connected. For large-size data, it takes a long time to send DP data one by one. Bulk data transfer is used to address this issue by sending the cached data in bulk to the mobile app. The transfer rate can reach 15 KB/s, depending on Bluetooth and mobile phone performance. |
File download | Bluetooth devices such as smart locks, watches, bracelets, and printers need to download files from the cloud, such as voice files, watch faces, and files for printing. In some cases, the user performs add, delete, and read operations on these files. The file download speed is about 5 KB/s to 10 KB/s, depending on Bluetooth and mobile phone performance. |
Device sharing | Bluetooth devices that support sharing can be shared with multiple users for binding and use, such as the body fat scale and thermo-hygrometer. |
Raw data transmission | The pass-through channel allows you to transmit business data in a custom format. |
Capability | Description |
---|---|
iBeacon | iBeacon is a Bluetooth Low Energy based protocol developed by Apple. An iBeacon-enabled device can broadcast its identifier to nearby devices. When the mobile phone receives the iBeacon signals, the mobile app with the iBeacon service registered will be invoked to perform specific actions. iBeacon supports proximity sensing and geofencing, which can be applied to SOS, alarming, and positioning. Tuya’s Bluetooth capabilities and business logic in tandem with the Smart Life app can implement the complete iBeacon features, which apply to the following use cases.
|
HID service | The human interface device (HID) profile defines how devices with Bluetooth enabled can use the HID Specification initially to discover Bluetooth HID devices and automatically connects to the saved device. With the HID service, the mobile phone instead of the mobile app initiates a connection request when a paired Bluetooth device is in range. This enables a fast and seamless connection to Bluetooth devices that have been paired with the mobile app. Typical use cases:
|
Tuya Bluetooth Low Energy Beacon | Tuya Bluetooth Low Energy beacon enables DP data upload via Bluetooth broadcast. It is fully compatible with Tuya-defined Bluetooth advertising protocol without compromising Bluetooth sub-device capabilities such as reconnection and removal. Bluetooth sub-devices with the roaming feature also use Bluetooth beacon to upload data. |
Protocol coexistence | As an application layer protocol, the Tuya-defined Bluetooth profile is compliant with Bluetooth profile specifications and compatible with other Bluetooth profiles. A Bluetooth sub-device can run both the Tuya-defined Bluetooth profile and other application profiles. Tuya-defined Bluetooth profile defines advertising format and content. To support protocols across multiple platforms, consider the following.
|
Capability | Description |
---|---|
Alexa voice assistant | The device captures the audio encoded with a specific format (Opus and mSBC are supported currently) and then sends the audio to the mobile app in real time through Tuya-defined Bluetooth transfer protocol. The mobile app forwards the audio to Alexa Voice Service (AVS). AVS returns the speech recognition result that the mobile app forwards to the device for display. |
Connection to non-smart accessories | Non-smart accessories are not capable of wireless communication. You can leverage Tuya-enabled Bluetooth smart devices to enable these accessories to connect to the cloud and use technologies such as OTA. For example, a battery pack can work with different types of power tools. This capability differs from common Bluetooth solutions in that the accessory and the main device can have a different product ID. |
Capability | Description |
---|---|
GPIO | GPIO driver, with debugging routines. With a host, you can set a GPIO to output high or low and check the current state of a GPIO. |
UART | UART driver, with debugging routines. With a host, you can set the baud rate for a UART and control a UART to send custom data. |
PWM | PWM driver, with debugging routines. With a host, you can set the frequency and duty cycle of a PWM and restore a PWM to the initial state. |
ADC | ADC driver, with debugging routines. With a host, you can read the value or voltage of an ADC channel and change the resolution of an ADC. |
SPI | SPI driver, with debugging routines. With a host, you can control the SDI and SDO of an SPI module to receive and send custom data and change the transfer rate of an SPI module. |
I2C | I2C driver, with debugging routines. With a host, you can control an I2C module to turn on an OLED screen and display custom data. |
RTC | RTC driver, with debugging routines. With a host, you can set or get the RTC of a device and start or stop the RTC module. |
Watchdog | Watchdog driver, with debugging routines. With a host, you can start or stop the watchdog, enable or disable automatic feeding, and test manual feeding. |
Capability | Description |
---|---|
Standard power | Bluetooth advertising interval ranges from 20 ms to 200 ms. In continuous advertising mode, the average power consumption is about 60 μA to 1 mA. Longer advertising intervals consume less energy, but can result in longer discovery and connect times between the mobile app and the Bluetooth gateway. You need to trade off between discovery latency and power usage. |
Low power | Bluetooth advertising interval ranges from 500 ms to 1,200 ms. In continuous advertising mode, the average power consumption is about 15 μA to 50 μA. Longer advertising intervals consume less energy, but can result in longer discovery and connect times between the mobile app and the Bluetooth gateway. You need to trade off between discovery latency and power usage. |
Ultra-low power | Bluetooth advertising interval ranges from 20 ms to 200 ms. In continuous adverting triggered by externals at an interval of less than 10s, the average power consumption is about 0.4 μA to 15 μA. This mode is used for report-only devices, such as the remote control and PIR. Longer advertising intervals consume less energy, but can result in longer discovery and connect times between the mobile app and the Bluetooth gateway. You need to trade off between discovery latency and power usage. |
Capability | Description |
---|---|
Update Bluetooth firmware via OTA | Send an OTA update to a Bluetooth device through the Smart Life app or the gateway. Resumable transfer, data integrity check, and exception processing are supported. |
Update MCU firmware via OTA | The Bluetooth device (Bluetooth module or end product) receives a firmware update from the Smart Life app or the gateway and then forwards the received file to the MCU through UART or other digital interfaces. |
Update extended firmware via OTA | Up to 10 update channels are available for updating extended firmware, which can be set to your needs. |
Capability | Description |
---|---|
Security system | Tuya’s proprietary algorithms secure devices regarding connection authentication, request authorization, and command sending, with the following measures.
|
If you have any problems with TuyaOS development, you can post your questions in the Tuya Developer Forum.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback