TuyaOSBluetooth FrameworkProduct DevelopmentBluetooth Beacon Mesh Lighting (PHY6252)

Bluetooth Beacon Mesh Lighting (PHY6252)

Last Updated on : 2023-05-19 09:10:43download

This topic describes the features provided by the Bluetooth Beacon Mesh Lighting Product Development Kit (PHY6252).

Release

Version Description
0.0.1 (applies to TuyaOS v3.6.4) Implement the basic features for a lighting product.

Features

  • Device pairing and reset.

    • JSON configuration of the number of resets, pairing modes, and pairing status.
    • If the device is reset with a Bluetooth beacon mesh remote control, network recovery is not possible.
  • Lighting scenes.

    • Scene sync.
    • For a white and colored light (RGBCW):
      • Cool white light and warm to cool white light do not support colored light.
      • Colored light does not support white light.
      • Cool white light and cool white and colored light do not support warm white light.
      • When only cool white changes in a white light scene with warm white involved:
        • If the color temperature is 0%, the cool white light should come off. To present the lighting effect, the cool white light is set to its minimum brightness.

        • If the color temperature is not 0%, when the light acts as a warm to cool white light, the warm white value is calculated and used as the cool white value. The cool white is calculated in the usual way.

          If cool white and warm white alternate, the cool white fades out to minimum brightness and then fades into full brightness. If a scene has warm white light only, brightness cannot be adjusted.

  • Supported LED drivers: PWM, BP5758D, KP18058, and SM2235EGH.

  • Music sync.

  • Countdown timer.

  • Power-on behavior.

  • Segmented lighting adjustment.

  • Gamma configuration.

  • Power scale.

  • On/off gradient.

  • Power loss detection.

  • Local schedule.

    • Up to five local schedules can be set.
    • Local scheduling only works for paired devices.
    • A 4 MHz clock is used to track the current time, with microsecond accuracy.
    • The system polls every 20 seconds for tasks to run. The deviation of task execution is about one minute.
    • Local scheduling only allows for on/off control. If the light is already in the expected status, the schedule will not run.
    • The daily clock drift is about two seconds. It is recommended to reset the local timer every few months.
    • The local schedule data will be cleared when the power is disconnected.
  • Compatible with Bluetooth beacon mesh remote controls.

  • JSON configuration of no-code solutions.

  • Product testing with a host.

  • OTA firmware update.

Configurations

  1. Open Visual Studio Code.

  2. In Tuya Wind IDE, right-click on your project and choose Config Project. You can modify the following configurations to try the demo. After modification, generate macro definitions in app_config.h.

    #define TEST_DEBUG 0
    #define APP_LOG_ENABLE 0
    #define APP_JSON_LOG_ENABLE 0
    #define APP_LED_REMINDER_LOG_ENABLE 0
    #define APP_LED_LOG_ENABLE 0
    #define APP_LOCAL_TIMER_LOG_ENABLE 0
    #define APP_SCENE_LOG_ENABLE 0
    #define APP_SEGMENT_DIMMING_LOG_ENABLE 0
    #define APP_LIGHT_POWER_CHECK_LOG_ENABLE 0
    #define APP_DRIVER_BP5758_LOG_ENABLE 0
    #define APP_DRIVER_KP18058_LOG_ENABLE 0
    #define APP_DRIVER_SM2235_LOG_ENABLE 0
    #define APP_DRIVER_I2C_LOG_ENABLE 0
    #define APP_DRIVER_PWM_LOG_ENABLE 0
    
    beacon_dev_s beacon_dev_data = {
        .mac = {0xdc,0x23,0x4f,0x4f,0x82,0xd2},
        .authkey = "R1XQxgMID5ujN58m",
        .pid = "3jnrwpet",
        .version = 0x01,
        .flag = 0x00,
        .kind = 0x1015,
        .state = STATE_NOT_PAIRED
    };// If you set `TEST_DEBUG` to 1 and use the public PID (gjhptpwy) to try out the demo, you might fail to control the device because this PID has been occupied by another developer. Therefore, we recommend you use your own PID and AuthKey.
    
  3. When flashing firmware, if you do not need the file download configuration, you can set JSON_CONFIG_DEFAULT to 1 in app_json_config.h and modify DEFAULT_CONFIG as needed.

    #define JSON_CONFIG_DEFAULT        0 ///< default json config
    
    #if JSON_CONFIG_DEFAULT
    #define DEFAULT_CONFIG "{rstnum:3,rstcor:c,Jsonver:1.0.0,brightmin:10,r_lv:1,c_lv:1,wfcfg:spcl_auto,colormin:10,pmemory:1,pairt:60,segmentdim:1,ctrl_pin:2,cmod:rgbcw,g_lv:1,acdetect_pin:1,cwtype:0,onofftime:800,rstbr:50,remdmode:0,colormax:100,g_pin:7,w_lv:1,c_pin:3,notdisturb:1,module:phy6252_24pin,b_pin:5,b_lv:1,ctrl_lv:1,colorpfun:1,cwmaxp:100,dmod:0,acdetect_lv:0,colormaxp:100,onoffmode:0,brightmax:100,w_pin:4,pwmhz:1000,r_pin:6,rsttemp:100,category:1015,defcolor:g,defbright:100,crc:101,}"
    #endif
    

Architecture

Bluetooth Beacon Mesh Lighting (PHY6252)

Application logic

Bluetooth Beacon Mesh Lighting (PHY6252)

Data point reference

You can create a product on the Tuya IoT Development Platform to check out the details of DPs.

Things to note

If you have any problems with TuyaOS development, you can post your questions in the Tuya Developer Forum.