MCU Access Guide

Last Updated on2020-05-14 06:59:47

This article mainly explains the development process of Tuya MCU Solutions, which is suitable for embedded development engineers and individual developers to get started quickly and understand the access to Tuya platform.

Solution Overview

MCU Solutions is the most common way to connect to Tuya IoT Platform, mainly used for intelligentization of products with MCU master. Compared with Tuya SoC Solutions for Lighting products, Small and Large Home Appliances are usually more complex in function, and they all have MCUs to simply be connected to the Tuya Modules. Developers can only focus the development of the product's own functions, the Network part can use the public version solution including Tuya MCU SDK, public version of App and public version panel. This will greatly reduce development time and costs.

Select Solutions

Before we start, we should understand skills and different types of Tuya MCU Solutions to choose the most suitable one. The services provided by Tuya cover Hardware access, Cloud services, and App software development.

The MCU Solutions is shown below:

企业微信截图_15819102405108.png

Embedded engineers should focus on Hardware Access in solution selection. We will only briefly introduce Cloud and App solutions here.

  • App Solutions: Common App Solutions includes public version App or OEM App.

    Public version App can download directly. According to demand, Tuya provides 2 versions of Apps: Tuya Smart (Tuya Logo) and Smart Life (Neutral Logo), which can be downloaded directly from major application stores.

    If customers wants to own their own App, Tuya also provide OEM App service. You can experience it simply online.For details: OEM App Build Instruction.

  • Cloud services Solutions: It only cost once connecting to Tuya Cloud by using Tuya Module, customers don't need to bear the cost of maintenance operations. For Cloud docking demand,Tuya also provide Cloud-to-Cloud docking service,for details you can check: Solutions Introduction

  • Hardware Access Solutions:

    We should mainly focus on different communication method and modules. At present, Tuya support types include: Wi-Fi, BLE, Zigbee, NB-IoT, GPRS, etc. Before docking, first select the module communication method according to actual needs. For the selection of specific module models, the IoT Platform will recommend common modules after the product is created.

IoT Platform Operation

After choosing solution, we need to create a product on the Tuya IoT Platform and download the MCU Development Kit. IoT Platform is a one-stop development platform for IoT provided by Tuya. From product creation to finished product mass production, all steps can be completed online.

There are 4 steps for IoT Platform operation:

step1: Create new product

企业微信截图_20200304113851.png

Pay attention to the choice of development scheme, all of MCU Solutions are Custom scheme .Net Pairing Mode will determine the protocol and module recommendation.

step2: Function Definition

企业微信截图_20200304114027.png

You can check details here: Standard Functions.

We abstract the functions of the product into DataPoints(DP, Function Points).Tuya IoT Platform Provides different standard DPs in different products. Developers can choose their own DPs according to there own requirement.

If standard DPs can not satisfy your requirement, you can also create your own custom DPs. For detail,you can check here:Custom Functions.

step3: App UI Design

企业微信截图_20200304114103.png

The control interface often called the Panel here. Tuya freely provides almost 100 different kinds of public version panel for customers to choose.

You can check details here: App UI Design.

If you have custom requirement, we also provide OEM App service.

step4: Hardware Debugging

企业微信截图_20200303175120.png According to choice of product and communication protocol, IoT Platform will recommend common module. You can also buy it online. Users can change module according to their actual situation.

You can check details here: Hardware Debugging.

Modules' datasheets can check here: Module.

The following figure shows the materials contained in an MCU development package:

企业微信截图_20200303161209.png

1.MCU SDK: Provide library file for connecting MCU to Module, convenient for developers to quickly connect MCU to Tuya Cloud.

2.JSON Debug file: For Tuya Cloud Serial Port Helper.

3.Serial Port Communication Protocol: Protocol automatically generated according to the product function selected by the users.

4.README.txt: Develop resource pack instruction.

5.Tuya Cloud Serial Port Helper: Serial communication tools provide by Tuya.

Develop Debugging

After platform operation, we have bought the module sample and downloaded the MCU development package. For different communication protocols, we provide corresponding development instructions in Developer Community.

Wi-Fi: Wi-Fi Module MCU Development Overview.

Zigbee: Zigbee Module MCU Development Overview

BLE: BLE Module MCU Development Overview

NB-IoT:NB-IoT Module MCU Devlopment Overview

You can find develop guide in the link above, so we just mainly introduce tools and resource used during development below.

Hardware Debugging

After getting Module, we can build Module minimum system and connect it to Tuya host software to check the communication protocol and experience steps of configuring the network.

You can find HDK in the links below:

Hardware resources: Module.

Helper resources: Module Debugging Assistant Instruction.

PCB resources: 常用模组封装库.

Software Debugging

If it's enough MCU hardware resources for development, we recommend you just migrate MCU SDK and finish the part of serial communication function to save your time.

The SDK package has the following requirements on MCU hardware resources:

  • Flash memory: 4 KB
  • RAM: tens of bytes (depending on the DP data length), or 260 KB or higher if the OTA upgrade function is required
  • The number of nested functions is 9.

You can find common resource in link below:

Overview of migrating Tuya MCU SDK:Overview of migrating Tuya's MCU SDK

Function joint tuning

During function joint tuning, we often need to check background data to determine the problem in IoT Platform - device

The introduction of the device background can refer to:

Operations Guide.

Tuya provides online support services. If the problem cannot be solved, you can directly ask questions online. The professional and technical team will answer your questions.

The introduction of the support center can refer to:

Tutorial for Tuya Support Center.