TuyaOSBluetooth FrameworkProduct DevelopmentBluetooth Beacon Mesh Strip Lights (PHY6252)

Bluetooth Beacon Mesh Strip Lights (PHY6252)

Last Updated on : 2023-09-19 10:38:16download

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

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

Description

  • 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.
    • The device can store four types of scene data for control by a remote.
    • 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.

  • PWM dimming and color adjustment.
  • Custom scenes.
    • The app panel sends the custom scene data to the device.
    • The device does not get notified of color deletion.
    • When all colors are deleted, the device automatically switches to the colored light.
    • A custom scene has no preset color.
    • Only colored lights are supported currently.
  • The music sync feature is implemented with the scene DP data.
  • 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.
  • 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.
  • JSON configuration of no-code solutions.
  • Control by infrared remote (not applicable to cool white light and warm to cool white light).
  • 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_INFRA_RED_LOG_ENABLE 0
    #define APP_JSON_LOG_ENABLE 0
    #define APP_KEY_LOG_ENABLE 0
    #define APP_LED_REMINDER_LOG_ENABLE 0
    #define APP_LED_LOG_ENABLE 0
    #define APP_LOCAL_MUSIC_LOG_ENABLE 0
    #define APP_LOCAL_TIMER_LOG_ENABLE 0
    #define APP_SCENE_LOG_ENABLE 0
    
    beacon_dev_s beacon_dev_data = {
        .mac = {0xdc,0x23,0x4f,0x46,0x9a,0xe4},
        .authkey = "4W8Xv35ouxBjGHzv",
        .pid = "gjhptpwy",
        .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 "{Jsonver:1.0.0,category:1015,cmod:rgbcw,module:phy6252_24pin,wfcfg:spcl,pairt:14,remdmode:1,rstnum:3,rstaddnum:2,rstcor:c,rstbr:50,rsttemp:20,brightmin:10,brightmax:100,colormin:10,colormax:100,defcolor:c,defbright:10,deftemp:10,ismusic:1,micpin:11,micvlpin_pin:2,micvlpin_lv:1,adclimit:3200,sensimax:400,sensimin:200,micproc:400,keyfunc:1,key_pin:1,key_lv:0,sfunc:1,ktime:3,lfunc:11,dmod:0,pwmhz:1000,r_pin:3,r_lv:1,g_pin:4,g_lv:1,b_pin:5,b_lv:1,c_pin:6,c_lv:1,w_pin:7,w_lv:1,irfunc:1,ir:8,crc:16,}"
    #endif
    

Architecture

Bluetooth Beacon Mesh Strip Lights (PHY6252)

Application logic

Bluetooth Beacon Mesh Strip Lights (PHY6252)

Local mic testing

Bluetooth Beacon Mesh Strip Lights (PHY6252)

Data point (DP) 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.