Power Line Communication (PLC)

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.

Benefits

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.

Common modules

This general solution uses the PLC module S130N-ISI.

Development process

Step 1: Create product

  1. Create a product. For more information, see Create Products.
  2. Choose PLC for protocol. After you create a product, you can configure the function, panel, module, and firmware based on your requirements. Then, download the MCU SDK accordingly.
  3. After you select the module and firmware, you can purchase modules online and proceed with the PCB layout.

Step 2: Verify network connection

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.

USB to TTL converter
tx rx
tx rx
Tuya's Module Debugging Assistant
-Simulate the MCU
Tuya's 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.

  1. Set up the peripheral circuit according to the schematic for a minimum system.

  2. Open the Module Debugging Assistant and import the debugging file. Choose PLC Protocol and MCU Simulation.

  3. 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.

  4. 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.

Step 3: Develop software

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.

  • The basic protocol is product-neutral and shared by the modules. It consists of commands for module initialization and extended functions.
  • The function protocol works to report and send commands based on the basic protocol and specifies the DP data format.

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:

    • 4 KB flash memory.
    • About 100 bytes of RAM are required, depending on the data length of the DPs. If you enable OTA updates, it must be greater than 260 bytes.

Step 4: Debug functionality

You can pair the module with the app and test DP data communication. You can check the device logs as shown below: