TuyaOSBluetooth FrameworkProduct DevelopmentBluetooth Beacon Mesh Strip Lights (AK801)

Bluetooth Beacon Mesh Strip Lights (AK801)

Last Updated on : 2023-06-01 05:49:10download

This topic describes the features provided by the Bluetooth Beacon Mesh Strip Lights Development Kit (AK801).

Version Description
0.0.7 (applies to TuyaOS v3.6.3) Implement the features of strip lights.

Features

  • Device pairing and reset.
    • The LED indicator is steady on after the device is powered on. To reset the device, the user can either repeat the on/off cycle five times or press and hold the button for five seconds. If no operation is performed within three minutes, the device restores to the previous network state.
    • If the device is reset with a Bluetooth beacon mesh remote control, network recovery is not possible.
    • The pairing state is indicated by red light at full brightness, blinking at a frequency of 500 ms for 3 minutes.
  • Lighting scenes.
  • PWM dimming and color adjustment.
  • Custom scenes.
  • The music sync feature implemented with the scene DP data.
  • Schedule lights locally.
    • The beacon mesh local scheduling defines that the system checks for tasks to execute every 10 seconds, with an error of less than one minute.
    • The local schedule data will be cleared when the power is disconnected.
    • Local scheduling only works for the control of light switches.
  • Support one button.
    • Support press-and-hold as well as press. Software debouncing is about 10 ms. Press and hold the button for five seconds to enter pairing mode.
    • If no operation is performed within three minutes, the device restores to the previous network state, but the local schedule data will not be cleared.
  • Local music sync (rock-and-roll mode)
  • Compatible with Bluetooth beacon mesh remote controls.
  • Product testing with a host.

Leaving the pid empty is suitable for OEM production. If you set the pid to a specific value, the application cannot be used for products with different pid values.

static beacon_dev_s beacon_dev = {
    .mac = {0xdc,0x23,0x4e,0xf9,0xcf,0x2b},
    .authkey = "lJsGiQumUiuCn4Mu",
    .pid = "        ",
    .version = 0x10,
    .flag = 0x00,
    .kind = 0x1013,
    .state = STATE_NOT_PAIRED
};

The source code is compact due to limited space.

  • To use a field-programmable gate array (FPGA) for debugging, set BOARD_FPGA to 1.
  • To print logs for debugging, set APPLOG to 1. uart_putc is used for transmission. With APPLOG enabled, other features such as local music will be unavailable due to limited resources.

Architecture

Bluetooth Beacon Mesh Strip Lights (AK801)

Application logic

Bluetooth Beacon Mesh Strip Lights (AK801)

Things to note

  • AK801 has 2 KB RAM. Stacks, heaps, and global variables are stored in RAM.
    • The stack is set to 380 bytes by default.
    • You can check the .htm file for stack usage.
    • You can check the .map file for RAM usage.
  • If you have any problems with TuyaOS development, you can post your questions in the Tuya Developer Forum.