Prototype a Smart Light with Zigbee Module SDK

Last Updated onInvalid date

Overview

With a smart light app, users can take full control and change the brightness and colors of lights and create personalized lighting atmospheres.

Based on the Tuya IoT Platform, you can quickly prototype a smart light with the Tuya Sandwich development board.

Materials

Hardware (4)
  • Tuya Sandwich (PWN) lighting function board

    Count:1

    more

  • Tuya Sandwich Zigbee SoC master control board (ZS3L)

    Count:1

    You can download different types of Zigbee SoC no-code firmware from the Tuya IoT Platform and use them with applicable function boards. You can also develop firmware based on the SDK.more

  • Tuya Sandwich DC power board

    Count:1

    Power other components of the Tuya Sandwich Evaluation Kit.more

  • 5V micro USB adapter or 12V adapter

    Count:1

    Power the power board.more

Steps

  • Step 1: Create product and download SDK

    1. Log in to the Tuya IoT Platform.

    2. See Create Products to create a Zigbee light with a custom solution.

      Create light
    3. Select functions for the light. In this demo, the selected functions are shown in the following figure.

      Functions
    4. Select a device panel. For more information, see Design App UI.

    5. In the step of Hardware Development, select the Self-developed Module SDK, and complete the relevant information.

      Hardware development
    6. In the Download Documents area, you can download the SDK.

      Download SDK
  • Step 2: Compile code

    After you extract the SDK, you can find the demo and documentation in the apps folder. You can refer to the light_cw_demo for the EFR32MG21A020F768 chip in the light directory and modify the code to implement lighting functionality.

    1. Modify firmwareInfo in the package.json file, including pid, model_id, and manufacture_name. The specific description is as follows:

      • pid is generated when you create a product in Step 1.

        PID
      • The values for model_id and manufacture_name can be found in the Zigbee Protocol Specification. In this demo, fill TS0502A in model_id field and TZ3000 in manufacture_name field.

      • The following figure shows the modified firmwareInfo in the package.json file.

        Firmware
    2. Modify I/O parameters in the code according to circuit parameters. The following figure shows the modified values.

      I/O parameters
    3. When you have finished modifying package.json, you can compile the IAR project. The system will automatically apply the modified values to the application code and generate the firmware for production and updates in the exe folder under the build folder.

      Firmware

  • Step 3: Program and authorize

    • Test stage

      With the Simplicity Commander provided by Silicon Labs, you can program the production firmware generated in Step 2 to the development board for testing. The authorization is only valid for seven days. The following section describes how to have the firmware authorized permanently.

      Flash Flash
    • Production stage

      Go to Tuya Service & Support and submit a technical ticket for assistance. Tuya’s technical staff will help you upload the firmware and apply for an authorization code for programming and authorizing.

      Submit question

    After you get the authorization code, you can proceed with programming and authorizing. For more information, see the Firmware Programming and Authorization. An authorized module can be connected to the Tuya IoT Platform.

    Programming

  • Step 4: Pair light

    Zigbee devices are connected to the network through a Zigbee gateway.

    1. Connect the Zigbee gateway to the cloud with the Tuya Smart app.

    2. Enable the device to be pending for pairing according to the pairing setting specified in the code. In this demo, you can press and hold the button on the Zigbee SoC master control board (ZS3L) until the indicator flickers fast.

    3. Open the Tuya Smart app, select the added gateway, and tap Add subdevice.

      Add sub-device
    4. Follow the prompts to operate. When the device is connected to the cloud, you can control the light with the Tuya Smart app.

      Control panel
  • Step 5: (Optional) Voice assistant integration

    Tuya supports controlling devices through popular smart speakers, such as Amazon Echo. The following steps only describe the general procedure. For more information, see the Third-Party Integration Service.

    1. Go to Tuya Value Added Service and click Smart Voice to find more.

      Smart voice
    2. Choose a smart voice service and follow the instructions on the page for a subscription.

    3. After your device is certified, you will see the voice assistant logo in Product Configuration > Voice Platform on the Tuya IoT Platform.

      The logo of the available voice assistant is also displayed on the Tuya Smart app.

      Voice assistant logo Voice assistant logo
    4. You can bind the device to the voice assistant platform and enable device control with voices.

      For more information, see Quick Guide of Using Amazon Echo to Control Smart Devices.

Summary

You have prototyped a smart light successfully. Based on the Tuya IoT Platform, you can quickly and easily build a smart prototype from scratch with Tuya Sandwich Evaluation Kit.