Bluetooth Door Lock

Last Updated on : 2025-08-06 03:08:27download

Overview

This topic describes how to develop Bluetooth door locks based on the TuyaOS Bluetooth Device Development Kit. By following this guide, you can quickly get started and complete door lock product development.

Related documentation

Base documentation

Technical documentation

Chip datasheet

Data point (DP) protocol reference

Lock (accessory) SDK documentation

  • Hardware design: .\hardware\
  • Usage instructions:
    • Markdown format: .\software\TuyaOS\apps\tuyaos_ble_lock_xxxxxx_demo\README.md
    • HTML format: .\software\TuyaOS\apps\tuyaos_ble_lock_xxxxxx_demo\doc\index.html

Technical support

Select solutions

Bluetooth development framework + proprietary door lock development framework

  • Use case: You already have a mature and stable proprietary lock framework and only require Bluetooth connectivity to the Tuya platform.
  • Recommendation: Thoroughly review Bluetooth Software and call the relevant APIs. Alternatively, download the lock development kit and refer to its API implementation methods.
  • Note: The current version (v3.12.1 and earlier) of the Bluetooth Development Framework does not include components for dynamic and offline lock passwords. If required, please contact Tuya FAE. Future versions will migrate these components from the Lock Development Kit to the standard Bluetooth Development Framework.

Bluetooth development framework + lock development kit

  • Use case: You are integrating with Tuya’s framework for the first time or are familiar with Tuya’s legacy lock SDK. You have no need to care about Bluetooth API calls—only adapt peripheral driver integration and customize application logic such as audio/visual feedback.

  • Recommendation: Read the kit’s built-in documentation in either README.md or index.html format.

Bluetooth development framework + lock accessory development kit

  • Use case: Develop Tuya Bluetooth lock accessories, such as Bluetooth keys and keypads.

  • Recommendation: Read the kit’s built-in documentation in either README.md or index.html format.

Tuya Bluetooth module + proprietary door lock development framework

  • Use case: You already have a mature and stable proprietary lock framework and chip platform, and want to integrate with Tuya via the Bluetooth module’s UART commands.

  • Recommendation: Refer to Bluetooth Serial Communication Protocol.

Get development kit

Get Bluetooth Device Development Kit

Open Visual Studio Code, navigate to the Resource Center of the Tuya Wind IDE plugin, filter the latest Bluetooth Device Development Kit for the desired platform, and click Create to download it to your local device.

Bluetooth Door Lock

Get lock (accessory) development kit

After the Bluetooth Device Development Kit is created, you can download it from the Product Dev Kit tab of the Dev Framework page.

Bluetooth Door Lock

Build and develop

Select the desired development kit in the apps directory, right-click it, and then select Build Project. After the first compilation, the firmware and Keil5 project files are generated in the .log folder. You can then choose Visual Studio Code or Keil5 for development based on your personal preference.

Bluetooth Door Lock
  • Build Project: Build and generate firmware.
  • Config Project: Use the Kconfig tool to configure the project. After the configuration is completed, the app_config.h file will be automatically synchronized.
  • Quick Start: View the development kit documentation. The source files for the HTML-formatted developer documentation are located in the apps/tuyaos_demo_xxxx/doc folder.

FAQs

Low power

  • Bluetooth development framework: By default, the system does not automatically enter sleep mode. After tal_cpu_allow_sleep() is invoked, the Bluetooth MCU enters sleep mode and can be woken up by any external interrupt, software timer interrupt, or Bluetooth event. If tal_cpu_force_wakeup() is invoked after waking up, the chip will no longer automatically enter sleep mode. To ensure proper sleep or wakeup behavior, peripherals such as UART and I2C must be disabled or enabled accordingly to avoid malfunctions.

    For testing, refer to the Bluetooth Basics Demo and use the Logic host software to send sleep testing commands. Compare and verify sleep mode power consumption against the corresponding chip datasheet for accuracy.

  • Lock development kit: After you enable low power management (configSUPPORT_SLEEP_MODE), the lock development kit automatically handles sleep mode entry and exit. Enable relevant logs during the debugging phase for sleep mode monitoring.