PLC modems and heterogeneous PLC/RF modems for data acquisition systems

PLC (Power Line Communication) technology is a telecommunications technology based on power grids for high-speed information exchange. Experiments on data transmission over the power grid were conducted for a long time. Still, the low transmission speed and weak noise immunity were the most significant bottlenecks of this technology. The appearance of more powerful DSP processors(digital signal processors), ASICs, SoCs made it possible to use more complex methods of signal modulation, which made it possible to significantly advance in PLC technology and give more opportunities to use modern solutions in the electric power industry and IoT.

The maximum distance between the elements and the scalability of the network depends on the choice of the communication interface. Modern Internet of Things (IoT) devices can transmit information over wired communication lines, using radio waves and infrared radiation at a distance of 10 cm – 10 km. Interfaces using power transmission lines (PLC) are best suited for communication of the electric meter with the system server. But since the meter can now be part of the energy system and part of the smart home grid, it should support as many interfaces as possible used in smart home applications and modern smart devices, for example, smartphones.

Today, PLC modems are successfully used as part of the automated system of control and metering of energy resources (ASCME) to provide communication with remote metering devices for relevant services and monitoring systems. However, often when using such equipment, the issues of ensuring sufficient noise immunity of devices, increasing the data transfer rate, minimizing failures of finished equipment and the occurrence of data transmission errors, as well as determining the causes of failures remain unresolved. In addition, there is a need to support data encryption to protect the transmitted information and automatic remote updating of the embedded software.

PLC модемы и гетерогенные PLC/RF модемы для систем сбора данных

Selecting the type of modulation

When transmitting data using PLC technology, the transmitted data is pre-modulated as with any other communication technology. The signal is demodulated at the receiver. Devices that provide data transmission over electrical networks using PLC technology are called PLC modems. The main types of modulation that are used in PLC modems are frequency shift keying (FSK – Frequency Shift Keying), frequency shift keying (S-FSK – Spread Frequency Shift Keying), various types of phase-shift keying – binary (BPSK – Binary Phase Shift Keying), Quadrature Phase Shift Keying (QPSK), Octal (8-PSK – 8 Phase Shift Keying) and Orthogonal Frequency Division Multiplexing (OFDM).

When organizing a communication channel using PLC technology, it is necessary to consider those power grids are the worst option for a signal transmission medium, with numerous sources of interference from consumer devices connected to the power grid. To this can be added long unshielded wires and poor quality electrical wiring, often based on aluminum wire, in which the signal attenuation occurs faster due to the higher electrical resistance than copper. As a result, the choice of modulation type often depends on the speed and reliability of communication over electrical networks.

It should be noted that high data transfer rates and good noise immunity entail an increase in the complexity of the hardware and software part of the PLC modem since additional computing resources are needed to perform the necessary algorithms and comply with the increased requirements for the device’s power supply. Therefore, the choice of a PLC modem compromises the characteristics of the communication channel and the cost of the final solution. Let’s evaluate the main types of signal modulations used in narrowband PLC technology from this point of view. The advantages of FSK, S-FSK, and BPSK include ease of implementation and an acceptable level of noise immunity with the instability of the communication channel, and the disadvantages are low data transfer rates. More difficult to implement are QPSK and 8-PSK modulations. Still, the latter’s use provides a higher level of noise immunity and three times higher transmission rate than the FSK version.

However, using only one frequency for signal transmission with BPSK modulation or two – with FSK, S-FSK is ineffective in terms of the frequency range allocated for the PLC technology. Another, even more severe, drawback is that when the interference frequency coincides with the transmission frequency, the receiver cannot correctly demodulate the signal. That is, data exchange is impossible. Orthogonal frequency division multiplexing (OFDM) modulation has no such drawbacks.

The OFDM algorithm is based on dividing the frequency range allocated for data exchange into several sections with a certain width, each of which is used for independent data transmission. During transmission, the input data stream is divided in proportion to the number of independent channels, and the transmission rate in each channel is lower than the input stream rate. Upon reception, the data on each channel is demodulated, and the original information stream is recovered. Moreover, in each elementary channel of the frequency range, modulations such as BPSK, QPSK, 8-PSK, and their varieties can be used. Thus, as the type of modulations in each elementary channel changes, the transmitter adapts to the parameters of the signal transmission medium, that is, the data transmission rate decreases in the presence of interference or increases in the absence of interference or a reduction in the level. In addition, it is possible to disable data transmission in some channels if there is, for example, impulse noise in the corresponding frequency ranges. This is especially important since, in practice, it cannot be ruled out that the interference is concentrated in the 40 … 60 kHz frequency band in the morning hours and the evening – in the 80 … 90 kHz band. Thus, the OFDM algorithm provides the ability to adapt to the parameters of the signal transmission medium, which ensures its high noise immunity and reliability. In addition, the transmission rate is significantly higher compared to FSK, S-FSK, and PSK types discussed. However, the choice of OFDM modulation for organizing communication channels should be justified, since relative to other types of modulation used in narrowband PLC technology, systems based on OFDM modulation are the most complex, and PLC equipment has a high cost.

Protocol stacks

In the course of the development of automated systems for metering and distribution of electricity and methods for automatic control of technological processes, in which data exchange channels using PLC technology are successfully used, the problem of incompatibility of PLC equipment arose. As a result, the scalability of existing systems was limited, and integrating new equipment into them was difficult and sometimes impossible. In such conditions, creating a global network in the power systems and the organization of information flows from the final electricity metering devices to the energy supplier is an almost insoluble task. It turned out to be possible to overcome the difficulties that have arisen with the help of standards regulating the use of data transmission technologies over electric grids. Today there are several similar standards. Electrical and electronic companies, which form various alliances, make an outstanding contribution to the development and standardization of PLC technologies. The most famous associations focused on developing standards for automated control and management systems for energy resources are Open Meter, PRIME, ECHONET, and G3-PLC.

The Open Meter Alliance (Open Public Extended Network Metering) includes European companies – suppliers of energy resources and manufacturers of electricity meters, electronic components – ELSTER, ENEL, EDF, ENDESA, and STMicroelectronics. The Open Meter specification supports a series of current PLC standards, in particular, IEC 61334 – the S-FSK modulation standard, IEC 62056 – the DLMS/COSEM specification version of the universal protocol for exchanging data with meters, EN 13757 – the protocol for transferring data from metering devices for various resources, such as gas, heat, electricity.

DLMS stands for Distribution Line Message Specification and is an application layer specification that does not depend on lower layers and, as a result, on communication channels. This specification was developed to standardize messages carried over distribution lines. In this notation, this standard is published under the number IEC 61334-4-41. Subsequently, the concept of DLMS has changed, and the abbreviation DLMS began to stand for Device Language Message Specification. The purpose of the changes was to provide a unified environment for structural modeling and data exchange with metering devices. In its current form, the standard regulates remote reading of readings from metering devices, remote control, and additional services for measuring any energy resource (electricity, water, gas, heat).

COSEM stands for Companion Specification for Energy Metering. The interface model uses an object-oriented approach.

The DLMS/COSEM stack is a set of standards developed and maintained by the DLMS User Association. First published in 1999, it was adopted in 2002 by the International Electrotechnical Commission (IEC) and the European Committee for Standardization (CEN) as the IEC 62056 series of standards, and in 2019 adopted by the American National Standards Institute (ANSI). The DLMS/COSEM stack has become widespread: it is used in more than one hundred million metering devices worldwide and is used by many global companies, for example, EDF, Iberdrola, EDP, etc.

DLMS/COSEM is a stack-oriented protocol based on the OSI model’s concepts that regulate the exchange of data between metering devices and data collection systems, which is based on a client-server architecture. The fundamental specifications in this standard are DLMS and COSEM.

The DLMS/COSEM stack supports various wired and wireless communication standards, including cellular, PLC, Zigbee, WMBUS, and PRIME-PLC. Due to the independence of the application layer from the data transmission medium, its flexibility allows companies that provide resources (for example, electricity, water, heat, etc.) for the utility sector and end-users to have the same application that provides communication one or more communication technologies.

As part of the PRIME (PoweRline Intelligent Metering Evolution) Alliance of Microchip (Atmel), STM, Siemens, GE, Texas Instruments, NXP, Renesas, etc., the main direction of the alliance is the development of standards and specifications for narrow-band PLC systems with a bandwidth of up to 128 Kbit/s in the CENELEC A range. Currently, the PRIME specifications regulate the use of OFDM modulation with the number of elementary channels equal to 96 and the possible modulation of subcarriers in each elementary channel using the DBPSK, DQPSK, or D8PSK algorithm. The modulation type of subcarriers is selected following the signal-to-interference ratio in the communication channel. In addition, to improve noise immunity, forward error correction (FEC) of transmitted data based on convolutional codes can be additionally included.

The purpose of the ECHONET merger created based on the leading Japanese electronics companies Hitachi, Panasonic, Sharp, Mitsubishi, Toshiba, NEC, etc., is the development of home networking technologies designed for remote control of household appliances, security systems, etc.

The G3-PLC specification promoted by the European company ERDF, like PRIME, regulates OFDM modulation in narrowband PLC communication systems and data exchange in the CENELEC A range. The main difference from the PRIME standard is a more complex coding mechanism and the existing convolutional coding—Reed-Solomon (Reed-Solomon – RS). In addition, to provide higher noise immunity, the baud rate of the G3-PLC standard is less important than the PRIME standard.

Let’s consider an example of implementing data transfer using PLC technology using ST7580.

For example, we need X-NUCLEO-PLM01A – 2 pcs., NUCLEO-F401RE and NUCLEO-L053R8, 12V power supply. In this example, the NUCLEO-F401RE is the master debug board, and the NUCLEO-L053R8 debug board is the PLC slave.

The sample application contains a simple point-to-point communication between two nodes equipped with an STM32 Nucleo board and an X-NUCLEO-PLM01A1 expansion board. To create a demo (using a PC to monitor the activity on the power line), the developer must use the STM32 Nucleo LEDs and buttons. He can assign each node the role of master or slave by pressing the USER button on the STM32 Nucleo during boot:

  • USER button pressed = master board
  • USER button released = slave board

These options only allow you to have one precompiled binary for both roles. After assigning roles in an infinite loop, the mainboard sends a TRIGGER frame to the power line (X-NUCLEO-PLM01A1 green LED toggle), which the slave will receive and recognize (X-NUCLEO-PLM01A1 red LED toggle). The slave will send back an ACK frame as an acknowledgment (X-NUCLEOPLM01A1 green LED turns on). The host acknowledges the ACK frame (X-NUCLEO-PLM01A1 red LED toggle). If the two nodes are connected via USB cables, they print power line status messages to the serial debug port (letter sent, message received, etc.). It is also possible to monitor the activity of the modem power line through serial sniffers connected to the cards: baud rate 115200, 8 bits, and no flow control. Both master and slave will send debug messages notifying them of their activity.


int main(void)
{
    /* MCU Configuration----------------------------------------------------------*/
    
    /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
    HAL_Init();
    
    /* Configure the system clock */
    SystemClock_Config();
    
    /* Initialize ST7580 interface */
    GPIO_PLM_Configuration();
    
    UART_PLM_Configuration();
    /* Initialize ST7580 PLM */
    
    BSP_PLM_Init();
    
    /* Initialize Buttons */
    BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO);
    
    /* Debug USART config */
    USART_PRINT_MSG_Configuration();
    
    /* Initialize P2P Application */
    P2P_Init();
    while(1)
    {
        /* Data Communication */
        P2P_Process();
    }	
}
/* Includes ------------------------------------------------------------------*/
#include "string.h"
#include "cube_hal.h"
#include "st7580_appli.h"
#include "stm32_plm01a1.h"

/** @addtogroup USER
* @{
*/

/** @defgroup ST7580_APPLI
* @brief User file to configure ST7580 PLC modem.
* @{
*/

/* Private typedef -----------------------------------------------------------*/

/* Private define ------------------------------------------------------------*/
#define TRIG_BUF_SIZE   21
#define ACK_BUF_SIZE   	17
/* Private macro -------------------------------------------------------------*/

/* Private variables ---------------------------------------------------------*/
SM_State_t SM_State;
char MsgOut[100];

/* Private function prototypes -----------------------------------------------*/
void AppliMasterBoard(void);
void AppliSlaveBoard(void);

/* Private functions ---------------------------------------------------------*/

/** @defgroup ST7580_APPLI_Private_Functions
* @{
*/

/**
* @brief  This function initializes the point-to-point communication
* @param  None
* @retval None
*/
void P2P_Init(void)
{

    /* Modem MIBs configuration */
    BSP_PLM_Mib_Write(MIB_MODEM_CONF, modem_config, sizeof(modem_config));
    HAL_Delay(500);

    /* Phy MIBs configuration */
    BSP_PLM_Mib_Write(MIB_PHY_CONF, phy_config, sizeof(phy_config));
    HAL_Delay(500);


    /* Check User Button state */
    if (BSP_PB_GetState(BUTTON_KEY) == GPIO_PIN_SET)
    {
        /* User Button released */
        SM_State = SM_STATE_SLAVE;
    }
    else
    {
        /* User Button pressed */
        SM_State = SM_STATE_MASTER;
    }

    return;
}

/**
* @brief  ST7580 P2P Process State machine
* @retval None.
*/
void P2P_Process()
{
    switch(SM_State)
    {
    case SM_STATE_MASTER:
        AppliMasterBoard();
        break;

    case SM_STATE_SLAVE:
        AppliSlaveBoard();
        break;
    }
    return;
}

/**
* @brief  This function handles the point-to-point Master Board Communication
* @retval None
*/
void AppliMasterBoard()
{
    uint8_t ret;
    uint8_t cRxLen;
    ST7580Frame* RxFrame;
    uint8_t lastIDRcv = 0;
    int it = 0;

    uint8_t aTrsBuffer[TRIG_BUF_SIZE] = {'T', 'R', 'I', 'G', 'G', 'E', 'R', ' ', \
                                         'M', 'E', 'S', 'S', 'A', 'G', 'E', ' ', \
                                         'I', 'D', ':', ' ', '@'
                                        };
    uint8_t aRcvBuffer[ACK_BUF_SIZE];

    sprintf(MsgOut, "P2P Communication Test - Master Board Side\n\r\n\r");
    HAL_UART_Transmit(&pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500);

    while(1)
    {
        /* Initialize Trigger Msg */
        aTrsBuffer[TRIG_BUF_SIZE - 1]++;
        if (aTrsBuffer[TRIG_BUF_SIZE - 1] > 'Z')
        {
            aTrsBuffer[TRIG_BUF_SIZE - 1] = 'A';
        }

        sprintf(MsgOut, "Iteration %d\n\r", ++it);
        HAL_UART_Transmit(&pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500);

        /* Send Trigger Msg send */
        ret = BSP_PLM_Send_Data(DATA_OPT, aTrsBuffer, TRIG_BUF_SIZE, NULL);

        /* Check TRIGGER Msg send result */
        if(ret)
        {
            /* Transmission Error */
            sprintf( MsgOut, "Trigger Transmission Err\n\r");
            HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
            continue;
        }

        sprintf( MsgOut, "Trigger Msg Sent, ID: %c\n\r", aTrsBuffer[TRIG_BUF_SIZE - 1]);
        HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
        sprintf( MsgOut, "PAYLOAD: ");
        HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
        HAL_UART_Transmit( &pUartMsgHandle, aTrsBuffer, TRIG_BUF_SIZE, 500 );
        sprintf( MsgOut, "\n\r");
        HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );

        /* Wait ACK Msg sent back from slave */
        RxFrame = NULL;
        for (int j = 0; ((j < 10) && (RxFrame == NULL)); j++) { RxFrame = BSP_PLM_Receive_Frame(); if (RxFrame != NULL) { /* Check if a duplicated indication frame with STX = 03 is received */ if ((RxFrame->stx == ST7580_STX_03) && (lastIDRcv == RxFrame->data[3 + ACK_BUF_SIZE]))
                {
                    RxFrame = NULL;
                }
                else
                {
                    lastIDRcv = RxFrame->data[3 + ACK_BUF_SIZE];
                    break;
                }
            }
            HAL_Delay(200);
        }
        /* Check received ACK Msg */
        if (RxFrame == NULL)
        {
            /* No ACK Msg received until timeout */
            sprintf( MsgOut, "ACK Timeout - No ACK Received\n\r");
            HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
            continue;
        }

        cRxLen = (RxFrame->length - 4);

        sprintf( MsgOut, "ACK Msg Received\n\r");
        HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );

        if (cRxLen != ACK_BUF_SIZE)
        {
            /* ACK len mismatch */
            sprintf( MsgOut, "Wrong ACK Length\n\r");
            HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
            continue;
        }

        /* Copy payload from RX frame */
        memcpy(aRcvBuffer, &(RxFrame->data[4]), cRxLen);

        /* Check ID to verify if the right ACK has been received */
        if (aRcvBuffer[ACK_BUF_SIZE - 1] == aTrsBuffer[TRIG_BUF_SIZE - 1])
        {
            sprintf( MsgOut, "ACK Msg Received, ID: %c\n\r", aRcvBuffer[ACK_BUF_SIZE - 1]);
            HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
        }
        else
        {
            sprintf( MsgOut, "WRONG ACK Msg Received, ID: %c\n\r", aRcvBuffer[ACK_BUF_SIZE - 1]);
            HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
        }
        sprintf( MsgOut, "PAYLOAD: ");
        HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
        HAL_UART_Transmit( &pUartMsgHandle, aRcvBuffer, ACK_BUF_SIZE, 500 );
        sprintf( MsgOut, "\n\r\n\r");
        HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );

        HAL_Delay(1000);
    }

}

/**
* @brief  This function handles the point-to-point Slave Board Communication
* @retval None
*/
void AppliSlaveBoard()
{
    ST7580Frame* RxFrame;
    uint8_t cRxLen;
    int ret;
    uint8_t lastIDRcv = 0;
    int it = 0;

    uint8_t aTrsBuffer[ACK_BUF_SIZE] = {'A', 'C', 'K', ' ', 'M', 'E', 'S', 'S', \
                                        'A', 'G', 'E', ' ', 'I', 'D', ':', ' ', \
                                        '@'
                                       };
    uint8_t aRcvBuffer[TRIG_BUF_SIZE];

    sprintf( MsgOut, "P2P Communication Test - Slave Board Side\n\r\n\r");
    HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );

    while(1)
    {
        sprintf(MsgOut, "Iteration %d\n\r", ++it);
        HAL_UART_Transmit(&pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500);

        /* Receive Trigger Msg from M board */
        RxFrame = NULL;
        do
        {
            RxFrame = BSP_PLM_Receive_Frame();

            if (RxFrame != NULL)
            {
                /* Check if a duplicated indication frame with STX = 03 is received */
                if ((RxFrame->stx == ST7580_STX_03) && (lastIDRcv == RxFrame->data[3 + TRIG_BUF_SIZE]))
                {
                    RxFrame = NULL;
                }
                else
                {
                    lastIDRcv = RxFrame->data[3 + TRIG_BUF_SIZE];
                    break;
                }
            }
            HAL_Delay(200);
        }
        while(RxFrame == NULL);

        cRxLen = (RxFrame->length - 4);
        memcpy(aRcvBuffer, &(RxFrame->data[4]), cRxLen);

        sprintf( MsgOut, "Trigger Msg Received, ID: %c\n\r", aRcvBuffer[TRIG_BUF_SIZE - 1]);
        HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
        sprintf( MsgOut, "PAYLOAD: ");
        HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
        HAL_UART_Transmit( &pUartMsgHandle, aRcvBuffer, TRIG_BUF_SIZE, 500 );
        sprintf( MsgOut, "\n\r");
        HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );


        /* Send back ACK Msg to Master Board */
        aTrsBuffer[ACK_BUF_SIZE - 1] = aRcvBuffer[TRIG_BUF_SIZE - 1];
        do
        {
            ret = BSP_PLM_Send_Data(DATA_OPT, aTrsBuffer, ACK_BUF_SIZE, NULL);
        }
        while (ret != 0);

        sprintf( MsgOut, "ACK Msg Sent, ID: %c\n\r", aTrsBuffer[ACK_BUF_SIZE - 1]);
        HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
        sprintf( MsgOut, "PAYLOAD: ");
        HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
        HAL_UART_Transmit( &pUartMsgHandle, aTrsBuffer, ACK_BUF_SIZE, 500 );
        sprintf( MsgOut, "\n\r\n\r");
        HAL_UART_Transmit( &pUartMsgHandle, (uint8_t *)MsgOut, strlen(MsgOut), 500 );
    }
}

As you can see from the example, PLC data transfer is not a complex firmware development point of view.

Our technologies, systems expertise, and reference designs enable engineers to improve network resiliency and energy efficiency in next-generation network infrastructure. Battery-powered connected smart meters, distributed energy management, bi-directional charging of electric vehicles, or real-time data can be realized. Our solutions provide efficient power delivery and a smarter grid that meets global standards and future load patterns for long-term reliability and future orientation.

We develop software taking into account the formation of scalable software architecture. Each developed software has a UML model, which gives a detailed understanding of the final solution at the initial stage of the start of work. Next, we will form a work schedule to follow the plan for creating software. ShuraCore uses flexible and well-thought-out development processes, which allows us to do everything on time and efficiently. We achieve accuracy in our work due to: built-up communication processes with clients, measuring the KPI of our specialists, reporting on the status of our work, following the schedule, creating software according to our regulations, an entire cycle of software testing, and using CI/CD in the creation of our specialists.