Last Updated on : 2020-09-28 12:29:05download
This topic describes the development process of a MCU connection solution, as a quick start guide for developers. This topic introduces the development process, starts with type selection, and provides the links of all documents required during development. For development tutorials of specific communication protocols, see the development overviews of corresponding solutions.
As one of the most frequently-used solutions to connect to the Tuya IoT Console, MCU connection solution is mainly used to enable products with MCU to be smart. Tuya provides hardware modules, apps, and cloud services. You only need to focus on product function research and development, and develop the smart products efficiently and quickly with Tuya MCU SDK, public version app and panel.
Communication schematic diagram of MCU connection solutions is as follows.
An app solution often uses a public version app or OEM app. You can download and use the free public version apps from application stores, including Tuya Smart app and Smart Life app (with neutral logo). If you want an app of your own brand, Tuya also provides OEM app service. You can create an OEM app online. For more information, see OEM App Auto Building.
Tuya provides global customers with a safe, stable, and fast Tuya cloud service. By connecting to Tuya Cloud through Tuya modules, you can be free from research and development. To connect the cloud, you can use Tuya Cloud OpenAPI to develop a native app quickly. For more information about the cloud development platform, see Solutions Introduction.
When you select a hardware solution, the main focus is the communication type and the module. A module in which the general firmware is burned is called general module. At present, Tuya general modules support numerous communication types, including Wi-Fi, BLE, Zigbee, NB-IoT, and GPRS. Before connection, select the communication type of the module according to actual requirements. Specific module types are recommended in the IoT Console after you create a product.
After you select a solution, you need to create a product in Tuya IoT Console, and download MCU development documents. Tuya IoT Console is an online one-stop development platform, covering all the steps from product creation to mass production. There are four main steps.
1. Create a product
For more information about product creation, see Create Products. When you create a product, you can choose from plug and play solution and custom solution. For MCU connection, the products use custom solutions. The communication type determines the protocol and module recommendation.
2. Function definition
For more information about function selection, see Standard Functions. A data point (DP) is an abstract representation of product functions. Tuya provides all products with standard DPs. You can select DPs according to your actual requirements. If standard DPs fail to meet your requirements, you can customize them. For more information about custom functions, see Custom Functions.
3. Select a panel
In an app, the control interface of a device is called a panel. Tuya provides nearly 100 types of free public version panels for you. The public version panels can be customized. For more information about app panel configuration, see Design App UI. If you want to customize the panel, Tuya provides custom panel development service.
4. Download development documents
IoT Console recommends modules to you according to your product and communication solution. You can place an order online, or select another module according to actual requirements. For the module datasheet, see TYWE1S Module Datasheet.
You can download MCU development documents including:
MCU SDK: MCU code based on C language. It is generated automatically according to product functions defined in the IoT Console. The communication and protocol parsing architecture has been completed, and can be added to existing MCU projects directly. Therefore, MCU program development can be completed quickly.
Serial port communication protocol: The serial port communication protocol of Tuya modules, which is generated automatically according to selected functions.
Tuya serial port debugging assistant: It integrates serial port debugging tools for communication protocols of Tuya modules. It is used in development debugging of MCU general connection solutions.
DP debugging file: It includes product ID (PID), DP, and other information. It is used with the assistant.
After the product is created, you can purchase module samples, download the software development kit (SDK) in the IoT Console, and enter development debugging. Documentation Center provides development guides for different protocols. Click to view tutorials according to the protocols in the downloaded SDK.
NB-IoT: NB Development Guide
The protocol development guides already provide detailed descriptions. Now, we will introduce main processes and documents for development debugging.
After you receive the module sample, you can build a minimum system. With a Tuya host, you can configure the network, operate, and get to know data interaction process of the protocol. Hardware debugging documents:
Hardware document: Hardware Design Reference Wi-Fi
Assistant document: Module Debugging Assistant Instruction
During software development, if MCU resources are adequate, it is recommended to migrate MCU SDK. After the underlying driver of the serial port works properly, the protocol connection does not need development. Therefore, software development cycle is shortened substantially. Different SDKs have different requirements for MCU hardware resources. For example, according to Wi-Fi MCU SDK, Flash sector size must be 4 KB. RAM size is related with DP data length, and RAM is about 100 bytes. If OTA function is configured, RAM must be greater than 260 bytes. Function nesting level is 9 levels. In case of insufficient resources, you can implement connection protocols by yourself, and refer to functions in the SDK. Software debugging documents:
Migration tutorial: Overview of migrating Tuya's MCU SDK
During joint debugging of functions, enter IoT Console > Operation to view background data and make decisions. For more information, see Operation Center > Operations Guide.
Tuya provides online support service. If documentation fails to solve your question, raise your question online. Our professional technical team will be ready to help you.
For more information about support center, see Tutorial for Tuya Support Center.