Low-Power Wi-Fi Development Overview
Last Updated on：2020-03-28 02:46:50
There are many security sensors in the market. Their product features are generally battery-powered, low power consumption, small size, and weak interaction. Wi-Fi low-power solutions are specifically designed for this category. The communication schematic diagram is as follows. Users only need to use the Tuya Wi-Fi low-power docking protocol to quickly complete the docking of the MCU, so that the device can be networked. Tuya provides complete modules, App, and cloud services during the process.
Compared with the Wi-F universal module solution, the Wi-Fi low-power module software is trimmed and optimized. In addition, after the data transmission is completed, the MCU needs to power off the module.
The development process mainly includes: product creation-hardware debugging-software development-functional debugging.
Log in to the IoT Workbench and create a product. Select the product category according to the actual needs, and select Wi-Fi for the networking method. After the product is created, you can select the functions, panels, modules, and firmware according to the actual needs of the product and then download it to the MCU development kit.
Some product categories have extended options for power consumption. For normal power supply products, we can choose standard power consumption. Battery-powered products can choose low power consumption.
Note: Power consumption selection will be related to the recommendation of subsequent modules and firmware.
When creating a product selection module, the platform will recommend some common module models. The recommended module models for low-power Wi-Fi communication solutions are as follows:
E2S / E3S Firmware key: keyvw8xqm89v5vr4
XR1 / XR2 / XR3 Firmware key: keycnw55p5k7vueh
After selecting the module and firmware, you can purchase module samples online.
The hardware engineer can enter the drawing board stage, and the related materials for hardware development can be viewed in the document center:
Data manual link: Wi-Fi module data manual
Note: Wi-Fi low-power modules consume less power than Wi-Fi universal modules, but the peak current will reach more than 400mA (continuing us level), and there must be a margin when designing the power supply!
After getting the module, users do n’t need to worry about writing code first. It is recommended to use the module debugging assistant (MCU simulation mode) provided by Tuya to connect with the Wi-Fi module first. When verifying the module, users can be familiar with The protocol interaction process will greatly improve the efficiency of development and debugging later.
Tuya module debugging assistant-MCU simulation mode. The assistant will simulate the MCU to automatically reply the module's correct protocol data. After the module is networked with a mobile phone, the DP data can be reported and issued. The following briefly introduces the main steps of the assistant and module distribution network operation. Before using it, you need to know the instructions of Tuya Module Debugging Assistant in advance. Users who use the assistant for the first time can read in advance: Module Debugging Assistant Instruction
step1. According to the minimum system schematic diagram, set up the module peripheral circuit, and simple test can directly fly the wire.
step2. Open the Tuya module debugging assistant in the development kit and import the debugging file. Protocol selection Wi-Fi Low power protocol, MCU simulation mode.
step3. Connect the serial port of the module to the computer through the USB to TTL tool. The assistant selects the corresponding serial port and baud rate. Open the serial port and click Start. You will see that the module and the host computer automatically perform the initialization process protocol interaction.
Note: Wi-Fi low-power module sends 01 command word upon power-on. After receiving the correct response, it will interact with subsequent initialization protocols. If no data is sent after power-on, please check whether the peripheral circuit of the module is correct.
step4. Click Reset Module, the module enters the network distribution mode. The module supports two modes of network configuration: EZ and AP mode (the difference between EZ mode and AP mode). The reset button will switch the network configuration mode. According to the status prompt, the App performs the corresponding network configuration operation. For the network configuration operation, you can read the instruction of the App. Attach a demo video of the network distribution in two modes: Wi-Fi module network distribution demonstration video.
In the process of hardware debugging, the user saw that the module and the MCU have a series of serial protocol protocol interaction data. For the understanding of these data, please refer to the protocol document in the development kit.
The agreement is mainly divided into two parts: the basic agreement and the functional agreement. The basic protocol has nothing to do with the product. It is a common protocol of the module, including module initialization instructions and some extended function instructions. The function protocol part is mainly based on the command word of the report of the basic protocol, and has explained the DP data content format in detail. The complete content of the basic protocol, the document center is kept updated in real time, you can click the link to view: Tuya-cloud-low-power-universal-serial-access-protocol
There are two ways for MCU to interface with Tuya module: transplant the MCU SDK or connect the protocol by yourself.
When MCU resources are limited or the MCU SDK is not suitable for porting, customers can choose to connect the serial port protocol by themselves.
Porting MCU SDK
If the MCU resources are sufficient, it is generally recommended that users directly port the MCU SDK for efficient and convenient development. The MCU SDK in the development kit is a C-based protocol application code provided by Tuya, which can be directly added to the MCU project. The MCU SDK requires MCU hardware resources: 4K bytes of Flash; RAM is related to the length of the DP point data, about 100 bytes (if OTA function is required, it must be greater than 260 bytes); the number of function nesting levels is 9 levels. If users with insufficient resources can connect the protocol by themselves, the functions in the SDK package can still be used as a reference.
MCU SDK Porting Tutorial: Overview of migrating Tuya's MCU SDK
When distributing the network: Compared with the general solution, the low power consumption, if the module is not connected to the cloud within 3 minutes of the distribution network, the module will automatically enter the power consumption mode. The module will actively issue 55 aa 00 03 00 01 01
After porting the MCU SDK code development, you can use the Tuya module debugging assistant-module simulation mode to verify the correctness of the MCU code. The usage method is similar to the MCU simulation mode. In the simulation module mode, the assistant will automatically send the initialization data stream to verify that the MCU response is correct and give corresponding prompts for the incorrect data. After the initial interaction is passed, you can manually click to test other extended functions.
Note: Tuya module debugging assistant module simulation mode, without networking function, only used to verify the correctness of MCU serial protocol transmission and reception. After the test is completed, the MCU can be connected to the actual module and network.
Debugging common tool links:
Background log query entry: IoT Workbench-Operation Center. You can query related device background log data based on the device ID.
Tuya Online Support Portal: Tuya provides online support services. If the problem documents cannot be answered, you can Ask questions directly online, and the professional and technical team will answer your questions.
FAQ collection for open platform: develop common problems, understand them in advance, and avoid stepping into the pit.
How helpful was this page?