Develop Switch Module with Speed Control

Last Updated on : 2024-06-21 04:11:09download

To develop a product on the Tuya Developer Platform, you need to define product functions, select and customize device panels, develop embedded firmware, and then perform a production test.

Step 1: Define product functions

The product function is broken down into three types, standard functions, custom functions, and advanced functions.

A product function is the abstraction of a feature that is provided by a smart device. You can use product functions to describe the features and parameters of smart devices. Based on the product functions, the Tuya Developer Platform generates things data models in the cloud to connect to and control the smart devices. This makes product functions and data interactions easy to understand.

Data point (DP) data type

The platform allows you to define functions with six data types, including Boolean, value, enum, fault, string, and raw. For more information, see Data Types.

Description of DPs

DP IDs 1 to 3: on/off

Data type Value range
Boolean
  • 0: off
  • 1: on

DP IDs 9 to 11: countdown

Users specify a time delay with a timer. After the timer is done, the device will be automatically turned on or off based on its current ON/OFF state. If the current switch state is ON, it will be turned off when the set time is up. If the current switch state is OFF, it will be turned on when the set time is up. If the switch is interrupted by manual on/off control when the timer is running, the timer will be canceled.

Data type Value range
Value 0 to 86400, in seconds.

DP ID 44: fan switch

Data type Value range
Boolean
  • 0: off
  • 1: on

DP ID 45: fan speed level

Data type Value range
Enum The enumeration values are level_1, level_2, level_3, level_4, and level_5.

DP ID 46: fan countdown

Users specify a time delay with a timer. After the timer is done, the device will be automatically turned on or off based on its current ON/OFF state. If the current switch state is ON, it will be turned off when the set time is up. If the current switch state is OFF, it will be turned on when the set time is up. If the switch is interrupted by manual on/off control when the timer is running, the timer will be canceled.

Data type Value range
Value 0 to 86400, in seconds.

Custom functions

You can add custom functions that are not supported by standard functions. For more information, see Custom Function.

Advanced functions

Advanced functions support cloud timing and jumping page. For more information, see Advanced Function.

  • Cloud timing: allows you to implement the schedule feature without embedded development.
  • Jumping page: enables navigating to another web page, such as an online store and user guide.

Step 2: Configure a panel

After the function definition step, you can configure a favorite app control panel for the product. A panel is a GUI-based program that runs on top of a mobile app to control smart products. For more information about panel configurations and development tutorials, see Design App UI and Panel Development.

Step 3: Design hardware

Hardware development is broken down into two parts, hardware design and embedded development. Some electrical products are available for no-code development. Thus, for these products, you can develop firmware simply by editing the parameters without coding. You can also choose the MCU SDK or TuyaOS-based SDK for custom development.

Hardware design reference

Generic hardware design

No. Design type
1 Power Design
2 Compliance Design for Electrical Product

SoC solution

No. Protocol type Number of switch gangs Power supply type Recommended module
1 Wi-Fi and Bluetooth LE combo 3 + 1-gang smart switch module with speed control With neutral WB3S

To get the materials of open source hardware, contact Tuya’s account manager.

Step 4: Perform embedded development

Embedded development is broken down into SoC-based no-code development, MCU SDK development, and TuyaOS-based SDK development. In this step, you must implement device integration and business programming.

No-code development solution

In this solution, you can set parameters in a configuration file to generate firmware without coding. For more information, see the instructions on the Tuya Developer Platform.

MCU SDK

MCU low-code development enables products with built-in microcontrollers to connect to the cloud and become connected. Tuya provides one-stop IoT development services including the three essentials for typical IoT products, namely network modules, mobile apps, and cloud services. With Tuya’s MCU SDK, all-in-one mobile apps, and control panels, you can focus on application development simply, connect your product to the Tuya Developer Platform easily, and benefit from the cloud services quickly.

For more information, see MCU Low-Code Development.

Smart switches can be developed based on multiple protocols, including Zigbee, Wi-Fi and Bluetooth combo, and Bluetooth mesh. For more information, see:

TuyaOS

Built on top of the RTOS, Linux, and Non-OS, TuyaOS is a distributed and platform-agnostic IoT operating system.

With a standard kernel at the core, TuyaOS is designed to tackle the heterogeneity of platforms, systems, and protocols in order to enable quick and reliable integration, interconnection, and interoperability.

The tiered and plug-and-play architecture design allows you to quickly tailor a solution based on your hardware resources and thus reduce the cost of development with high cost performance. The efficient remote procedure call (RPC) mechanism and proprietary data point (DP) protocols make communication across protocols possible and easy.

Specifically, the following types of devices can be connected based on this solution:

Step 5: Configure product

Product configuration helps you set and manage different features in one place, including firmware updates, multilingual support, device notification, device pairing, scene linkage, quick toggle, knowledge base, and product manual. Based on these settings, global cloud services are employed to promote the personalized user experience. You can update these settings and make them effective immediately without the need to deliver the devices again.

Take care of the multilingual support, device pairing, and scene linkage, which require product- and market-specific configuration and management.

Develop Switch Module with Speed Control

Develop Switch Module with Speed Control

For more information, see:

Step 6: Flash firmware and authorize chip

Flash the device with the firmware and Tuya’s license to connect the device to the cloud. Tuya provides different solutions to achieve this purpose. You can select one that best fits your needs.

Step 7: Test the product

Before your product can be released on the Tuya Developer Platform, you can choose Tuya’s Cloud Test app or use your own test plan and submit a product test report.

Cloud Test App

To help you quickly identify issues for troubleshooting, the Cloud Test app enables integrated testing on hardware functionalities and data interaction in terms of various test modes.

For more information, see Cloud Test App.

Step 8: Release the product

After you submit the test result, you can release your product on the Tuya Developer Platform.

Next steps

Pass certification

To roll out your product in target markets, you need to get your product certified for each market’s regulations. With proven technologies and certification services, Tuya provides a variety of portfolios to meet your product certification needs. For more information, see Product Certificate.