Choose IoT components

Step 2: Select IoT components

Choose the components that you require, the s/w and h/w list that you made will help you choose the components.

To use the components in shunya you need to do 2 things

  1. Provide user settings in a JSON configuration file
  2. Write code using Shunya API's

1. Connect PLC's/Industrial Meters

Modbus

Before you start

  1. Get the connection details of the device that you will be connecting with modbus, Details like
    • Connection Type: TCP/RTU
    • Device IP address (only for TCP)
    • Device Port (only for TCP)
    • Device Baudrate (Only for RTU)
  2. Get Modbus address that you want to read and write.

For example: Let's say you want to read Voltage from an Electric Meter connected via Modbus, you need to know the Modbus address where the Voltage parameter is stored

Usually you will find the modbus addresses in the Electric Meter datasheet.

Sample JSON configuration:

"boiler1plc": {
"type": "tcp",
"ipaddr": "192.168.0.101",
"port": "5059",
},

Sample Modbus code:

/*Include this header file into your program */
#include <si/shunyaInterfaces.h>
/* Main Function */
int main(void) {
/* Initialize the Library */
importSiCore();
importSiIiot();
modbusObj boilerplc = newModbus("boiler1plc");
/* Connect to the PLC */
modbusConnect(&boilerplc);
/* Read boiler temperature from the plc */
int temperature = modbusRead(&boilerplc, 3000);
/* Write data to the PLC*/
modbusWrite(&boilerplc, 3001, 45);
/* Disconnect from the PLC */
modbusDisconnect(&boilerplc);
return 0;
}

Modbus configuration

ConfigDescription
Protocol TypeModbus is available in 2 variants RTU and TCP. Select the mode that you want to communicate
IP addressModbus server IP address (only for Modbus TCP type)
PortModbus server Port (only for Modbus TCP type)
DeviceModbus server Device node (only for Modbus RTU type)
Baud RateModbus server Baud rate (only for Modbus RTU type)

The configurations need to be set manually by the user before using the API's

For example:

A sample JSON snippet should contain

"modbus": {
"type": "",
"ipaddr": "",
"port": "",
"device": "",
"baudrate": 9600
}

Take a blank json file and keep pasting the sample snippets and modify them with your configuration.

OPCUA (coming soon)

Sample JSON configuration:

"boiler1plc": {
"type": "tcp",
"ipaddr": "192.168.0.101",
"port": "5059",
},

Sample Modbus code:

/*Include this header file into your program */
#include <si/shunyaInterfaces.h>
/* Main Function */
int main(void) {
/* Initialize the Library */
importSiCore();
importSiIiot();
modbusObj boilerplc = newModbus("boiler1plc");
/* Connect to the PLC */
modbusConnect(&boilerplc);
/* Read boiler temperature from the plc */
int temperature = modbusRead(&boilerplc, 3000);
/* Write data to the PLC*/
modbusWrite(&boilerplc, 3001, 45);
/* Disconnect from the PLC */
modbusDisconnect(&boilerplc);
return 0;
}

Modbus configuration

ConfigDescription
Protocol TypeModbus is available in 2 variants RTU and TCP. Select the mode that you want to communicate
IP addressModbus server IP address (only for Modbus TCP type)
PortModbus server Port (only for Modbus TCP type)
DeviceModbus server Device node (only for Modbus RTU type)
Baud RateModbus server Baud rate (only for Modbus RTU type)

The configurations need to be set manually by the user before using the API's

For example:

A sample JSON snippet should contain

"modbus": {
"type": "",
"ipaddr": "",
"port": "",
"device": "",
"baudrate": 9600
}

Take a blank json file and keep pasting the sample snippets and modify them with your configuration.

IEC 104 (coming soon)

Sample JSON configuration:

Sample code:

/*Include this header file into your program */
#include <si/shunyaInterfaces.h>
/* Main Function */
int main(void) {
/* Initialize the Library */
importSiCore();
importSiIiot();
return 0;
}

JSON configuration

For example:

A sample JSON snippet should contain

Take a blank json file and keep pasting the sample snippets and modify them with your configuration.

2. Send/Receive data from Cloud services

AWS (coming soon)

Sample JSON configuration:

Sample code:

/*Include this header file into your program */
#include <si/shunyaInterfaces.h>
/* Main Function */
int main(void) {
/* Initialize the Library */
importSiCore();
importSiIiot();
return 0;
}

JSON configuration

For example:

A sample JSON snippet should contain

Take a blank json file and keep pasting the sample snippets and modify them with your configuration.

GCP (coming soon)

Sample JSON configuration:

Sample code:

/*Include this header file into your program */
#include <si/shunyaInterfaces.h>
/* Main Function */
int main(void) {
/* Initialize the Library */
importSiCore();
importSiIiot();
return 0;
}

JSON configuration

For example:

A sample JSON snippet should contain

Take a blank json file and keep pasting the sample snippets and modify them with your configuration.

Azure (coming soon)

Sample JSON configuration:

Sample code:

/*Include this header file into your program */
#include <si/shunyaInterfaces.h>
/* Main Function */
int main(void) {
/* Initialize the Library */
importSiCore();
importSiIiot();
return 0;
}

JSON configuration

For example:

A sample JSON snippet should contain

Take a blank json file and keep pasting the sample snippets and modify them with your configuration.

3. Send/Receive data via IoT Protocols

MQTT (coming soon)

Sample JSON configuration:

Sample code:

/*Include this header file into your program */
#include <si/shunyaInterfaces.h>
/* Main Function */
int main(void) {
/* Initialize the Library */
importSiCore();
importSiIiot();
return 0;
}

JSON configuration

For example:

A sample JSON snippet should contain

Take a blank json file and keep pasting the sample snippets and modify them with your configuration.

AMQP (coming soon)

Sample JSON configuration:

Sample code:

/*Include this header file into your program */
#include <si/shunyaInterfaces.h>
/* Main Function */
int main(void) {
/* Initialize the Library */
importSiCore();
importSiIiot();
return 0;
}

JSON configuration

For example:

A sample JSON snippet should contain

Take a blank json file and keep pasting the sample snippets and modify them with your configuration.

4. Send Alerts

SMS (coming soon)

Sample JSON configuration:

Sample code:

/*Include this header file into your program */
#include <si/shunyaInterfaces.h>
/* Main Function */
int main(void) {
/* Initialize the Library */
importSiCore();
importSiIiot();
return 0;
}

JSON configuration

For example:

A sample JSON snippet should contain

Take a blank json file and keep pasting the sample snippets and modify them with your configuration.

Whatsapp (coming soon)

Sample JSON configuration:

Sample code:

/*Include this header file into your program */
#include <si/shunyaInterfaces.h>
/* Main Function */
int main(void) {
/* Initialize the Library */
importSiCore();
importSiIiot();
return 0;
}

JSON configuration

For example:

A sample JSON snippet should contain

Take a blank json file and keep pasting the sample snippets and modify them with your configuration.

5. Store data in Time series databases

InfluxDB (coming soon)

Sample JSON configuration:

Sample code:

/*Include this header file into your program */
#include <si/shunyaInterfaces.h>
/* Main Function */
int main(void) {
/* Initialize the Library */
importSiCore();
importSiIiot();
return 0;
}

JSON configuration

For example:

A sample JSON snippet should contain

Take a blank json file and keep pasting the sample snippets and modify them with your configuration.

Configure Shunya Interfaces

Shunya enables you to configure the API's that you have used via JSON configuration file.

You can configure by running command.

$ sudo gedit /etc/shunya/interfaces/config.json

And then paste the example config snippet provided with the API's along with your settings.