top of page

Connecting a Solar PV Inverter (SunSpec) to an IoT backend platform with the nodeG5 edge MQTT Gateway
 
Cloud monitoring Solar PV generation via Modbus RTU

solar_froniusrprimo.jpg
FATBOX%20G3%20IIOT%20GATEWAY%20ROUTER_ed
  • In this tutorial, we will set up a Fronius Primo PV Inverter as a Modbus RTU slave and interface to our nodeG5 gateway Modbus master.

  • The gateway is able to support up to 32 Modbus devices, including meters and remote I/O terminal. The standard industrial Modbus/RTU protocol runs on Serial RS-485 interface, providing a robust & reliable interface.

  • We will also look at connecting the nodeG5 IOT Gateway to a designated Cloud Service. Supported clients are AWS IoT, Azure IoT Hub and Ubidots.

  • Users have the option of backhaul via either wired Ethernet, WIFI or cellular (4G/3G) for remote sites/redundancy.

HARDWARE WIRING

Hardware Wiring

Fronius_Modbus_Wiring.png

Fronius Primo PV Inverter

Connect to nodeG5 CAN bus  D+ D-

​Above shows the Serial RS-485 connection usually implemented using shielded twisted pair cable.

Note maximum cable length depends on baudrate and cable quality, e.g. using 24AWG shielded twisted pair, about 100Kbit/sec at 1000m.

Screen Shot 2020-03-10 at 2.56.39 pm.png

Image courtesy of eng-tip.com

Inverter Modbus Configuration

From your Fronius Modbus Settings in web console or via front panel for the Inverter, set the Modbus serial parameters as below.

Fronius Config.png

All slave devices connected on the RS-485 network must each have a unique address ranging from 1 to 247. Also, the baudrate and parity for all slave devices and master must be the same.

CONNECT METER TO GATEWAY

Connect Inverter to Gateway

Our gateway uses a configuration file to map the required Modbus registers to be read during each polling cycle. This flexibility allows wide compatibility with most Modbus RTU devices from different manufacturers.

To modify this configuration file, we will be referencing the Modbus register table from the product user manual (see sample below):

Fronius_Modbus_Mapping.png

The gateway is able to apply a customer multiplier (x0.01 in this case) and offset (0 in this case) to match the requirements of their cloud service.

{

    "MODBUS":[

        {

            "Key":"PV_CURRENT",

            "IOTMODE":"1",

            "MODBUSTYPE":"RTU",

            "RTUPORT":"A",

            "NODEID":"1",

            "MODBUSFC":"3",

            "REGADDR":"40071",

            "NUMREGS":"1",

            "DATATYPE":"UINT16HL",

            "SCALEMUL":"0.01",

            "SCALEADD":"0"

        },

        {

            "Key":"PV_V_PHASE",

            "IOTMODE":"1",

            "MODBUSTYPE":"RTU",

            "RTUPORT":"A",

            "NODEID":"1",

            "MODBUSFC":"3",

            "REGADDR":"40076",

            "NUMREGS":"1",

            "DATATYPE":"UINT16HL",

            "SCALEMUL":"0.01",

            "SCALEADD":"0"

        },

        {

            "Key":"PV_FREQ",

            "IOTMODE":"1",

            "MODBUSTYPE":"RTU",

            "RTUPORT":"A",

            "NODEID":"1",

            "MODBUSFC":"3",

            "REGADDR":"40085",

            "NUMREGS":"1",

            "DATATYPE":"UINT16HL",

            "SCALEMUL":"0.01",

            "SCALEADD":"0"

        },

        {

            "Key":"PV_POWER",

            "IOTMODE":"1",

            "MODBUSTYPE":"RTU",

            "RTUPORT":"A",

            "NODEID":"1",

            "MODBUSFC":"3",

            "REGADDR":"40087",

            "NUMREGS":"1",

            "DATATYPE":"SINT16HL",

            "SCALEMUL":"1",

            "SCALEADD":"0"

        }

    ]

}

We will now configure the gateway's serial port to operate as required for the attached Modbus devices. Go to the Port Settings tab and enter the following settings.

Screen Shot 2020-03-05 at 3.41.40 pm.png

Then, go to the IOT Hardware menu to set the Hardware interface to "Modbus master" and register the polling configuration as required by the user (Note that all other interfaces like CAN bus and Zigbee can also run concurrently).

Schneider hardware settings

After these settings are updated, REBOOT the gateway. The user can then check the Modbus sensor data collected (JSON Data) or delete for testing.

Once you have configured your device configuration file, we can update to your nodeG5 gateway securely over the air. The gateway HTTPS connected webconsole must be accessible, either via local network (LAN or WLAN) and over cellular network with assigned public IP address (If you do not have an Internet connection, you can follow the alternative steps here). 

Log into your web console and go to the <IOT Hardware> tab, click on 'UPDATE FIRMWARE' in the Firmware Update section

ota iotasset upload.png

In the new window, click on 'CHOOSE FILE' and select from your local folder the updated iotasset.txt file then click on 'UPLOAD FIRMWARE FILE'After the upload is successful you will need to close the page and log in again for security purpose.

CONNECTING TO A CLOUD STACK

Connect to a Cloud Service

Now that the connectivity between the Fronius PV Inverter Meter and the nodeG5 gateway has been set, we will then look at getting the data onto a designated cloud service. We support an open customer software and 3rd party API (e.g. REST API for HTTP, HTTPS and MQTT) integration to connect to a chosen cloud data or dashboard service (or to use for on board data processing).

 Direct deployment on Azure, AWS IoT or Ubidots can also be done as these IoT clients have been integrated on the nodeG5 Gateway. For this project, we are going to showcase using AWS IoT
(note that an AWS
account is required to continue this tutorial).

1. Create a new AWS IoT Thing

First log into your AWS IoT Management Console and create a Thing:

AWS IoT > Manage > Thing > Create

Next go to:

Secure > Certificates

Then download the 'Certificate' & 'Private Key File'.

Ensure the Certificate is "Active", otherwise activate it under ACTIONS in 

Things > Your Certificate > Security

AWS Certificate Download.png
2. Update your G3 IoT Gateway
Create a new local folder and name it "AWS". 

Save the downloaded certificate files into this folder and rename them as the following:

"certificate.pem.crt"

"private.pem.key"
 

Next zip the folder (ensure that you zip the entire folder and not just the files inside).

Then log into your FATBOX G3 web console and go to the <Management> tab.

Patch the zipped folder to the gateway using the UPDATE FIRMWARE button.

3. Create a Security Policy for your Thing

In your AWS IoT Management Console go to:

Secure > Policies > Create

Create AWS Policy.png
At <Things>, select your new Thing then click on

Security > Certificates > Policies

Under <Actions>, choose to Attach a Policy:

Attach AWS Policy.png
4. Configure your nodeG5 edge MQTT Gateway to send data to your AWS Account

Now, you are ready to configure your gateway to send AWS IoT endpoint to feed data to your AWS applications. In the nodeG5 web configuration menu, go to the <IoT Client> tab and configure your AWS client settings according as per your AWS end point and Thing settings. Then REBOOT your gateway.

solar_AWS_web_iotclient.png
Next go back to go your AWS IoT console and subscribe to the Topic to "Test" that data is being received.

AWS_IoT_SOLAR_MQTT_Broker.png
Congratulations! You have succesfully sent your Modbus or CAN bus data to your AWS IoT endpoint and ready to, for example, push the data to a S3 bucket using a Rule in 'Act > Rules'.

The nodeG5 AWS IoT client side is built using AWS IoT Device SDK for Python and users are free to install, modify our device client codes for enhanced edge capabilities or other required functionalities.

See Also:: Our guides below for connecting to other supported IoT platforms includes Azure IoT and Ubidots. Here is a sample dashboard from Ubidots. 
solar_ubidots_dash.png

Guides to connect other Cloud Platforms

Connecting to Microsoft Azure IoT Hub

Connect to Ubidots IOT Platform

Have a question for us?

The FATBOX G3 Modbus to Cloud Solution was recently featured in

bottom of page