Last Updated on : 2025-04-15 02:25:46download
This topic describes how to interface an MCU with Tuya’s Power Line Communication (PLC) module by using the MCU SDK.
Tuya provides complete solutions with network modules, a mobile app, and cloud services covered. You can connect your product to the cloud simply by interfacing the MCU with Tuya’s PLC module through the serial protocol.
The PLC module features an ad hoc network and low power and requires a gateway to connect to the internet.
This general solution uses the PLC module S130N-ISI.
Before starting coding, you can use Tuya’s Module Debugging Assistant in MCU simulation mode to get familiar with the communication between the MCU and the PLC module.
In MCU simulation mode, the debugging assistant simulates the MCU and returns the valid data to the module. After you pair the module with the app, you can test the data point (DP) data communication.
The following steps describe how to pair the module and use the Module Debugging Assistant.
Set up the peripheral circuit according to the schematic for a minimum system.
Open the Module Debugging Assistant and import the debugging file. Choose PLC Protocol and MCU Simulation.
Connect the module to your computer by using a USB to TTL converter. Set the Serial Port and Baud Rate. Click Open and then Start Debugging to start the data communication.
If the module does not send data upon powering on, check whether the peripheral circuit of the module works as expected.
Click Configure Module to enter pairing mode. Pair the module with the mobile app as instructed by the guide.
To set up a PLC sub-device, you should have a PLC gateway paired with the Tuya Smart app or the Smart Life app.
Refer to the protocol documentation in the development document to understand how data is exchanged between the MCU and the module on the Module Debugging Assistant.
The protocol consists of the basic protocol and the function protocol.
Tuya provides two options to implement the communication between your MCU and Tuya’s module.
Method 1: Integrate with protocol yourself
If your MCU does not have sufficient resources or porting the SDK is not feasible, you can interface with the serial protocol yourself. For more information, see PLC Serial Communication Protocol.
Method 2: Port the MCU SDK
If your MCU has sufficient resources, we recommend that you port the MCU SDK for efficiency purposes. The MCU SDK is written in C language. You can directly import it to your project. The requirements for MCU resources:
You can pair the module with the app and test DP data communication. You can check the device logs as shown below:
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback