Libelium
Libelium
INDEX
1. Introduction........................................................................................................................... 4
1.1. Programming Cloud Service basis................................................................................................... 4
1.2. Licenses............................................................................................................................................... 5
1.3. Purchasing licenses........................................................................................................................... 6
1.4. Accessing to the Programming Cloud Service................................................................................ 6
-2- v7.5
2.12.6. Sigfox..................................................................................................................................49
2.12.7. LoRaWAN............................................................................................................................49
2.13. Check configuration....................................................................................................................... 50
2.14. Compile and Download Binary.................................................................................................... 50
2.15. Upload a program to Plug & Sense!............................................................................................ 51
2.15.1. Smart Devices App installation.........................................................................................51
2.15.2. Binary update.....................................................................................................................51
2.16. Limitations...................................................................................................................................... 54
2.16.1. Sensor probe repetition....................................................................................................54
2.16.2. Memory issues...................................................................................................................54
7. Documentation changelog................................................................................................. 69
-3- v7.5
Introduction
1. Introduction
1.1. Programming Cloud Service basis
This guide explains the Programming Cloud Service features and how to use them. This tool permits to create
new binary programs for any Plug & Sense! v15 device. The generated programs follow a basic structure which is
continuously repeated performing infinite cycles based on 3 steps:
Therefore, this guide explains how the user can select different parameter options so as to modify the 3 main
code blocks: reading, sending and sleeping.
Regarding the sensor options, the user can select the proper Plug & Sense! model and choose the available sensor
probes for each socket.
In reference to communications, it is possible to choose any of the radio modules available for the Plug & Sense!
devices. Depending on the network requirements, the user should use one type or another.
Finally, the user can select the sleeping time in number of days, hours, minutes and seconds. You must keep in
mind that longer sleep periods permit to save energy increasing the life of the device. Depending on the battery
charging methods applied or radio used, the user should adapt this time to fit their needs.
-4- v7.5
Introduction
1.2. Licenses
There are different PCS license versions:
•• PCS Basic
•• PCS PRO
•• PCS Elite
The main differences among licenses are explained in the table below:
A license is needed to use the PCS, so please be sure to purchase and activate your license and devices as explained
in the Services Cloud Manager Guide.
-5- v7.5
Introduction
Besides, it is possible to access to the PCS form for a specific device registered in the SCM. The user must go to
“My Devices” menu where all available devices will be shown. In this menu, it is possible to edit your devices. Also,
if the PCS icon for a specific device is pressed, the browser will go to the PCS form for that device. So the device’s
serial ID will be filled in the corresponding form section.
-6- v7.5
Introduction
Finally, the user will access to the Programming Cloud Service configuration form which is explained in detail in
the next section. The PCS form appearance is as follows:
-7- v7.5
Programming Cloud Service configuration
2.2. Serial ID
The “serial ID” is the unique identifier of the Plug & Sense! device. This serial ID can be found in the bottom-side
sticker where the number is specified. It is a 16-digit identifier defined in hexadecimal digits. The PCS form allows
the user to search for a specific serial ID among all registered devices. The user must keep in mind that the
generated program will only work for the serial number specified in this field.
-8- v7.5
Programming Cloud Service configuration
There are specific cases when the sensor probes need special configuration parameters. The next chapters explain
each special case.
-9- v7.5
Programming Cloud Service configuration
Once the compiled binary has been uploaded into a node, a message will be prompted on the serial monitor
asking to type ‘C’ and press ‘Enter’ to enter the calibration menu and therefore begin the calibration process. If no
key is pressed, then the code will continue after a few seconds. Bear in mind that only sensor probes placed on
socket E can be calibrated. A complete description of the calibration process of each sensor can be found on the
Smart Water Xtreme technical guide.
Note: Remember that the calibration process can be only be performed on socket E, because it is the only socket
with RS-485 signals (needed for calibration). The calibration process stores the calibration values on the sensor’s
memory, so afterwards it can be connected to any socket. That means that if your node has, for example, 2
sensors probes, you will create 2 binaries with the PCS for calibration (each sensor, always in socket E), and then a
final 3rd binary with the final sensor distribution (each calibrated sensor can be connected to any available socket,
for example, A and C).
-10- v7.5
Programming Cloud Service configuration
-11- v7.5
Programming Cloud Service configuration
The output relay (only available in socket F) supports 2 possible configuration modes:
•• Relay activated for specified ‘Timeout’: When the relay is triggered by one of the sensor events, the device
waits for the specified timeout before deactivating the relay. For instance: the water level in a tank rises up to
the liquid level sensor, the interruption occurs and the relay is activated for the number of seconds defined
in the form.
•• Relay activated until sensors are deactivated: When the relay is triggered by one of the sensor events, the
device waits for all sensor events to be deactivated before deactivating the relay. For instance: the PIR sensor
stops detecting motion around the device.
•• Disabled: The sensor is not enabled for treating any generated event. Warning: if other sensors were enabled
for waking-up the node, this disabled-sensor will be still powered on, so it will trigger the event although this
sensor was not enabled for waking-up the node.
•• Wake-up the node: If this option is selected for any of the sockets, it remains all sensors active within the
sleep mode. So, it is possible to generate events and wake-up the node. When the platform wakes-up, a new
sensor reading and sending is done.
•• Wake-up the node + trigger relay: (Only available if the relay in socket ‘F’ was previously enabled by the
user). This possibility is displayed as a new option for sensor event behavior in the drop-down menu. This
means the sensor event wakes up the platform, sends sensor data and triggers the relay following the relay
option selected.
-12- v7.5
Programming Cloud Service configuration
-13- v7.5
Programming Cloud Service configuration
Note: This feature is only supported by PRO and Elite license versions.
If the user purchased a Plug & Sense! device which includes an Industrial Protocol module, this means that
this optional field should be managed. Besides, the PCS Basic license does not support the Industrial protocol
configuration. A PRO or Elite license is needed for this purpose. The available Industrial protocols are:
Each successful reading is inserted into the Frame generated to be sent via the communication module. There is
a particularity about the Modbus readings as it is explained in the “How data frames are generated” section.
-14- v7.5
Programming Cloud Service configuration
-15- v7.5
Programming Cloud Service configuration
-16- v7.5
Programming Cloud Service configuration
The user must define the period of time in the 4 fields related to this section: Days, hours, minutes and seconds.
Sleep periods less than 10 minutes will imply very high use of energy. It is recommended to use sleep period
greater than 10 minutes in order to deploy an energy-efficient system.
-17- v7.5
Programming Cloud Service configuration
The warning messages are different depending on the threshold. So, if the first threshold is exceeded, a string
field is attached to the frame with the next contents: “LOW1”. The same happens with the second threshold
(“LOW2”). And again the same with the third threshold (“LOW3”).
Example: if the thresholds are established to 60%, 40% and 20%. Thus, the system reads a 60% battery level in
the loop ‘n’. And afterwards the loop ‘n+1’ reads 59%, then a “LOW1” warning message is sent as a string field
(SENSOR_STR) within the frame.
-18- v7.5
Programming Cloud Service configuration
•• Region: It permits to select between XBee-PRO 802.15.4 and XBee-PRO 802.15.4 EU. You can see the radio
type in the sticker in the bottom side of the Plug & Sense! device.
•• MAC: Defines the destination MAC address. Where the packet is sent to. If you are using a Meshlium device
to collect the data, the “RF modules” tab in the Manager System permits to read the Meshlium’s XBee radio
MAC address. The MAC addresses always start by 0013A200. The rest of the address must be correctly written
down.
•• Sending attempts: Number of sending attempts in the case there are any RF errors.
•• PANID: Personal Area Network identifier. This is a 2-byte field. It is necessary to define it as 4 hexadecimal
digits (from 0000 to FFFF). It must be the same as the receiver’s.
•• Channel: The frequency channel defined for the network. It must be the same as the receiver’s channel.
•• Link encryption: This parameter enables/disables the XBee AES-128 link encryption layer. If enabled, a 16-
byte encryption key must be defined for the AES-128 encryption process. It must be defined as 16 chars.
The receiver must be configured with the same encryption key. If Meshlium is used as data collector, the “RF
modules” tab in the Manager System permits to configure it. This encryption layer is related to “Device to
Device” encryption level described in the IoT Security Infographic.
When working with this protocol, the user needs to define the same parameters on all nodes in the network (that
includes the Plug & Sense! device(s) and the Meshlium device). Besides, the Meshlium’s XBee radio MAC address
must be inserted on the PCS form.
The Manager System permits to configure the Meshlium’s XBee radio as follows:
-19- v7.5
Programming Cloud Service configuration
The PCS form should be filled with the same configuration that the receiving Meshlium has:
If the user wants to enable the “link encryption” security layer, this feature must be also configured in both PCS form
and Meshlium Manager System. The Meshlium Manager System provides the interface to enable link encryption:
-20- v7.5
Programming Cloud Service configuration
-21- v7.5
Programming Cloud Service configuration
The Manager System permits to configure the Meshlium’s XBee radio as follows:
-22- v7.5
Programming Cloud Service configuration
The PCS form should be filled with the same configuration that the receiving Meshlium has:
If the user wants to enable the “link encryption” security layer, this feature must be also configured in both PCS form
and Meshlium Manager System. The Meshlium Manager System provides the interface to enable link encryption:
-23- v7.5
Programming Cloud Service configuration
-24- v7.5
Programming Cloud Service configuration
•• MAC: Defines the destination MAC address. Where the packet is sent to. If you are using a Meshlium device
to collect the data, the “RF modules” tab in the Manager System permits to read the Meshlium’s XBee radio
MAC address. The MAC addresses always start by 0013A200. The rest of the address must be correctly written
down.
•• Sending attempts: Number of sending attempts in the case there are any RF errors.
•• PANID: Personal Area Network identifier. This is a 2-byte field. It is necessary to define it as 4 hexadecimal
digits (from 0000 to FFFF). It must be the same as the receiver’s.
•• Channel mask: This is a bitmap to select the channels used for RF communications. It goes from 00000000
to 3FFFFFFF.
•• Preamble: The preamble defined for the network must be the same as the receiver’s.
•• Link encryption: This parameter enables/disables the XBee AES-128 link encryption layer. If enabled, a 16-
byte encryption key must be defined for the AES-128 encryption process. It must be defined as 16 chars.
The receiver must be configured with the same encryption key. If Meshlium is used as data collector, the “RF
modules” tab in the Manager System permits to configure it. This encryption layer is related to “Device to
Device” encryption level described in the IoT Security Infographic.
-25- v7.5
Programming Cloud Service configuration
The PCS form should be filled with the same configuration that the receiving Meshlium has:
If the user wants to enable the “link encryption” security layer, this feature must be also configured in both PCS form
and Meshlium Manager System. The Meshlium Manager System provides the interface to enable link encryption:
-26- v7.5
Programming Cloud Service configuration
•• MAC: Defines the destination MAC address. Where the packet is sent to. If you are using a ZigBee receiver
device to collect the data, it should allow to read and display its XBee radio MAC address (or maybe it’s shown
in an external sticker). The MAC addresses always start by 0013A200. The rest of the address must be correctly
written down.
•• Sending attempts: Number of sending attempts in the case there are any RF errors.
•• PANID: Extended Personal Area Network identifier. This is a 8-byte field. It is necessary to define it as 16
hexadecimal digits (from 0000000000000000 to FFFFFFFFFFFFFFFF). It must be the same as the receiver’s.
•• Channel mask: The channels configuration where the ZigBee will scan the network. It must be the same as
the receiver’s configuration. This is a 2-byte field.
Link encryption: This parameter enables/disables the XBee AES-128 link encryption layer. If enabled, a 16-byte
encryption key must be defined for the AES-128 encryption process. It must be defined as 16 chars. The receiver
must be configured with the same encryption key. This encryption layer is related to “Device to Device” encryption
level described in the IoT Security Infographic.
When working with this protocol, the user needs to define the same parameters on all nodes in the network (that
includes the Plug & Sense! device(s) and the ZigBee receiver device). Besides, the XBee ZigBee receiver radio MAC
address must be inserted on the PCS form.
The PCS form should be filled with the same configuration that the receiving ZigBee device has:
-27- v7.5
Programming Cloud Service configuration
2.11.5. 4G
The 4G radio supports different protocols: SMS, TCP, HTTP and HTTPS. It permits to send data to an external
system.
•• Region: It permits to select the radio version between Europe and Brazil, Americas or Australia.
•• APN: Access Point Name of the Mobile Network Operator network.
•• Login: Login of the Mobile Network Operator network.
•• Password: Password of the Mobile Network Operator network.
•• PIN: Defines the SIM card’s PIN number.
•• GPS: It permits to enable/disable the GPS feature. Not available for Australian version.
Figure: 4G configuration
-28- v7.5
Programming Cloud Service configuration
2.11.6. WiFi
The WiFi radio supports different protocols: TCP, HTTP, HTTPS and send a frame to Meshlium. It permits to send
data to an external system.
On the other hand, the PCS form must be configured with the same settings: SSID, security and password.
-29- v7.5
Programming Cloud Service configuration
2.11.7. Sigfox
The Sigfox radio permits to send 12-byte packets to the Sigfox Cloud wherever the coverage and Sigfox standard
is supported. For further information about coverage, please refer to Sigfox website. No special configuration is
needed for this protocol.
The maximum payload is 12 bytes. In order to send data frames, the “tiny frame” format was designed. It permits
to create several tiny frames from an original binary frame.
-30- v7.5
Programming Cloud Service configuration
2.11.8. LoRaWAN
The LoRaWAN radio permits to send variable-size packets to the LoRaWAN cloud system used by the user. For this
purpose, a special LoRaWAN gateway is needed on the user side to be able to connect the Plug & Sense! device
to the network.
The maximum payload is variable and it depends on the network conditions. In the worst case, the payload can
decrease down to 11 bytes in the American version. In order to send data frames, the “tiny frame” format was
designed. It permits to create several tiny frames from an original binary frame.
-31- v7.5
Programming Cloud Service configuration
-32- v7.5
Programming Cloud Service configuration
•• XBee-PRO 802.15.4
•• XBee-PRO 900HP
•• XBee 868LP
•• WiFi
•• 4G
•• LoRaWAN
•• Sigfox
LoRaWAN and Sigfox protocols cannot send data directly to a final cloud service or Meshlium as they send frames
to the customer’s LoRaWAN cloud (the Network Server) and the Sigfox Cloud, respectively.
The XBee radios send data directly to Meshlium as there is another XBee radio inside Meshlium that allows
reception. The XBee ZigBee 3 radio module is an exception since Meshlium does not support the ZigBee protocol.
Regarding the WiFi radio, it can connect to the Meshlium’s WiFi Access Point (AP) and proceed with the HTTP
request. However, it is also possible to send data to Meshlium via Ethernet or 4G interface, or directly to a final
cloud service if a WiFi AP different from the Meshlium’s is used. The user only needs an external WiFi AP with
Internet connectivity and the public Meshlium’s IP address and port.
Regarding the 4G radio, it always uses the mobile network operator infrastructure, so they may use the Meshlium’s
Ethernet or 4G interfaces in order to send sensor data to Meshlium.
Note: The “Use Encryption Key” and “HTTPS” features are only supported by PRO and Elite license versions.
-33- v7.5
Programming Cloud Service configuration
The “Use Encryption Key” parameter enables/disables the AES-256 application encryption layer. This encryption
layer is related to “Device to Gateway” and “Device to Cloud” encryption level described in the IoT Security
Infographic. So there are 3 possible values for this parameter: Disabled, Device to Cloud and Device to Gateway.
The PCS form allows the user to configure these types of communication radios to send data to different
destinations. Let’s see all cases step by step.
The Meshlium Manager System provides the interface to enable payload encryption:
When Meshlium is selected as destination, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or “type
8” frames, depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled, Plug &
Sense! will send “type 96” frames.
-34- v7.5
Programming Cloud Service configuration
If the user wants to enable the payload encryption security layer, this feature must be also configured in both PCS
form and the Libelium Cloud Brdige. The Bridge provides the interface to enable payload encryption:
When the Bridge is selected as destination, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or
“type 8” frames, depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled,
Plug & Sense! will send “type 100” frames.
Please refer to the “Waspmote Data Frame Programming Guide” to see the different types of frames and their
behaviour.
-35- v7.5
Programming Cloud Service configuration
The Meshlium Manager System provides the interface to enable payload encryption:
When Meshlium is selected as destination, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or “type
8” frames, depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled, Plug &
Sense! will send “type 96” frames.
-36- v7.5
Programming Cloud Service configuration
If the user wants to enable the payload encryption security layer, this feature must be also configured in both PCS
form and the Libelium Cloud Bridge. The Bridge provides the interface to enable payload encryption:
When the Bridge is selected as destination, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or
“type 8” frames, depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled,
Plug & Sense! will send “type 100” frames.
Please refer to the “Waspmote Data Frame Programming Guide” to see the different types of frames and their
behaviour.
-37- v7.5
Programming Cloud Service configuration
The Meshlium Manager System provides the interface to enable payload encryption:
When Meshlium is selected as destination, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or “type
8” frames, depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled, Plug &
Sense! will send “type 96” frames.
-38- v7.5
Programming Cloud Service configuration
If the user wants to enable the payload encryption security layer, this feature must be also configured in both PCS
form and the Libelium Cloud Bridge. The Bridge provides the interface to enable payload encryption:
When the Bridge is selected as destination, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or
“type 8” frames, depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled,
Plug & Sense! will send “type 100” frames.
Please refer to the “Waspmote Data Frame Programming Guide” to see the different types of frames and their
behaviour.
-39- v7.5
Programming Cloud Service configuration
2.12.4. 4G
Besides the required configuration for the module to connect to the acces point properly. The PCS allows the user
to select the “protocol and destination” of the frame. When using the 4G communication module, the PCS allows
the user among different options.
If the “Use encryption Key” box is enabled the P&S! will encrypt using AES256 the content of the frame before
doing the previous AES128 encryption. This results in a frame type 100 inside of a frame type 103.
•• Send to Meshlium GW
When this option is selected, the P&S! will send type 6 frames, type 7 frames or type 8 frames, depending on the
sensor board within the P&S!. If the “Use encryption Key” box is enabled the P&S! will send type 96 frames.
When using the 4G radio, the user must keep in mind that the Meshlium’s public IP address and port must be
known in order to send data to Meshlium. The Meshlium device can be reached over Ethernet and 4G interfaces.
The user is responsible for providing the correct IP address and port to the PCS form. These settings must be
public so the 4G radio can reach them through an Internet connection.
Also, the Meshlium certificate must be specified in the PCS form. In order to know how to download the Meshlium
certificate please refer to the section “How to download the Meshlium certificate for HTTPS connections”.
-40- v7.5
Programming Cloud Service configuration
If the user wants to enable the payload encryption security layer, this feature must be also configured in both PCS
form and the Libelium Cloud Bridge. The Bridge provides the interface to enable payload encryption:
•• SMS
When this option is selected, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or “type 8” frames,
depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled, Plug & Sense! will
send “type 100” frames.
-41- v7.5
Programming Cloud Service configuration
The data is sent to the defined phone number as a text message via SMS. The SMS body consists on the frame as
hexadecimal digits.
•• HTTTP
When this option is selected as destination, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or
“type 8” frames, depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled,
Plug & Sense! will send “type 100” frames.
The data is sent to a specific server as an HTTP GET request. There are several parameters to fill. The request
will be sent as http://<host>:<port><path>?frame=<data>. Where <data> is the sensor data frame created by the
device. It follows the structure defined in the Data Frame Guide. The rest of the parameters must be defined by
the user:
-42- v7.5
Programming Cloud Service configuration
•• HTTTPS
When this option is selected, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or “type 8” frames,
depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled, Plug & Sense! will
send “type 100” frames.
The data is sent to a specific server as an HTTP GET request. There are several parameters to fill. The request will
be sent as https://<host>:<port><path>?frame=<data>. Where <data> is the sensor data frame created by the
device. It follows the structure defined in the Data Frame Guide. The rest of the parameters must be defined by
the user:
•• TCP
When this option is selected, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or “type 8” frames,
depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled, Plug & Sense! will
send “type 100” frames.
In the case of the TCP connection, the frame is sent to the host in raw format (hexadecimal digits) with no headers.
The rest of the parameters must be defined by the user:
Please refer to the “Waspmote Data Frame Programming Guide” to see the different types of frames and their
behaviour.
-43- v7.5
Programming Cloud Service configuration
2.12.5. WiFi
Besides the required configuration for the module to connect to the acces point properly. The PCS allows the user
to select the “protocol and destination” of the frame. When using the WiFi communication module, the PCS allows
the user among different options.
If the “Use encryption Key” box is enabled the P&S! will encrypt using AES256 the content of the frame before
doing the previous AES128 encryption. This results in a frame type 100 inside of a frame type 103.
•• Send to Meshlium GW
When this option is selected, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or “type 8” frames,
depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled, Plug & Sense! will
send “type 96” frames.
The “Select protocol and destination” form must be configured with the same settings defined in the Meshlium
Manager System and the Meshlium certificate. In order to know how to download the Meshlium certificate please
refer to the section “How to download the Meshlium certificate for HTTPS connections”.
If the user wants to enable the payload encryption security layer, this feature must be also configured in both PCS
form and the Libelium Cloud Bridge. The Bridge provides the interface to enable payload encryption:
-44- v7.5
Programming Cloud Service configuration
-45- v7.5
Programming Cloud Service configuration
•• HTTP
When this option is selected, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or “type 8” frames,
depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled, Plug & Sense! will
send “type 100” frames.
The data is sent to a specific server as an HTTP GET request. There are several parameters to fill. The request
will be sent as http://<host>:<port><path>?frame=<data>. Where <data> is the sensor data frame created by the
device. It follows the structure defined in the Data Frame Guide. The rest of the parameters must be defined by
the user:
-46- v7.5
Programming Cloud Service configuration
•• HTTPS
When this option is selected, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or “type 8” frames,
depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled, Plug & Sense! will
send “type 100” frames.
The data is sent to a specific server as an HTTP GET request. There are several parameters to fill. The request will
be sent as https://<host>:<port><path>?frame=<data>. Where <data> is the sensor data frame created by the
device. It follows the structure defined in the Data Frame Guide. The rest of the parameters must be defined by
the user:
-47- v7.5
Programming Cloud Service configuration
•• TCP
When this option is selected, the Plug & Sense! unit will send “type 6” frames, “type 7” frames or “type 8” frames,
depending on the sensor board inside Plug & Sense!. If the “Use encryption Key” box is enabled, Plug & Sense! will
send “type 100” frames.
In the case of the TCP connection, the frame is sent to the host in raw format (hexadecimal digits) with no headers.
The rest of the parameters must be defined by the user:
Please refer to the “Waspmote Data Frame Programming Guide” to see the different types of frames and their
behaviour.
-48- v7.5
Programming Cloud Service configuration
2.12.6. Sigfox
Sigfox protocol cannot send data directly to a Cloud or Meshlium as they send sensor frames to the Sigfox Cloud.
Regarding the PCS, the “Select protocol and destination” section will be disabled since the destination of the
packets must be set in the Sigfox backend.
2.12.7. LoRaWAN
LoRaWAN protocol cannot send data directly to a Cloud or Meshlium as they send sensor frames to the customer’s
LoRaWAN network server.
Regarding the PCS, the “Select protocol and destination” section will be disabled since the destination of the
packets must be set in the LoRaWAN network server.
-49- v7.5
Programming Cloud Service configuration
Besides, information about the data frames will be also provided including the different sensor fields to be added
during the program execution. For more information refer to the Data Frame Guide.
-50- v7.5
Programming Cloud Service configuration
https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html
Once installed JDK, users can download the application using the appropriate link depending on the operative
system:
•• Ubuntu: http://downloads.libelium.com/smart_device_app/SmartDeviceApp_linux64.zip
•• Windows: http://downloads.libelium.com/smart_device_app/SmartDeviceApp_windows32.zip
•• Mac: http://downloads.libelium.com/smart_device_app/SmartDeviceApp_macosx64.zip
Then customers only have to extract the content of the SmartDeviceApp zip file downloaded in a place with the
right permissions, and finally execute the file called “SmartDeviceApp” that will initialize the application. Please,
note that the extension of this file will depend on the operating system the user is using at the moment (.sh for
Linux and OSX, and .bat for Windows).
-51- v7.5
Programming Cloud Service configuration
Besides, the Plug & Sense! device must be connected to the USB port and switched on (press the On/Off button
to turn it on).
Figure: Connect the Plug & Sense! device via USB port
Finally, in the “USB settings” section it is possible to refresh the available USB ports where the Plug & Sense! port
identifier should be found. The user must press the “Install” button in order to upgrade the binary file.
-52- v7.5
Programming Cloud Service configuration
After few seconds, a small window should appear indicating that the program was uploaded successfully:
On the other hand, the user might experience some issue. In that case, the following message will be displayed
in the Smart Devices App. The most common errors are due to a bad USB port selection or a device powered-off
state. So keep in mind the previous steps in order to use the Smart Devices App properly.
-53- v7.5
Programming Cloud Service configuration
2.16. Limitations
2.16.1. Sensor probe repetition
The PCS does not allow the user to repeat the same sensor probe in more than one socket. For instance, regarding
the Smart Security model, the form does not permit to select a “luxes” sensor in both ‘A’ and ‘C’ sockets at the same
time. This limitation applies to the following Plug and Sense! models and sensors:
•• Smart Cities PRO: BME280, luxes, ultrasound and all gases sensors.
•• Smart Environment PRO: All gases sensors.
•• Smart Security: PIR, hall effect, liquid level, liquid presence, BME280, luxes and ultrasound sensors.
•• Smart Water: ORP sensor.
•• Smart Water Ions Single/Double/PRO: All ions and pH sensors.
However, there are some exceptions. The Smart Agriculture and Smart Agriculture PRO models allow the user to
select up to three “soil moisture” sensors in sockets ‘B’, ‘C’ and ‘E’.
This case will happen only for very rare and complex selections. So it is not regular to find this type of restriction.
For instance, besides using a Plug and Sense! model and probes, the user desires to enable the GPS module, an
industrial protocol module and 4G HTTPS protocol at the same time. This combination would require a lot of
memory allocation and will lead to memory issues.
-54- v7.5
How data frames are generated
The Waspmote Frame was designed in order to create sensor data frames with a specific format. This data protocol
is supported by Meshlium (Meshlium can decode these data frames), so this is the format used by the PCS in order
to transmit data. For more information, refer to the Data Frame Guide.
The PCS creates “binary frames” because this type of frame permits to add more sensor data within the same
frame buffer. Each sensor value defines a sensor field which is added to the frame structure. All sensor fields can
be found in the Data Frame Guide.
HEADER PAYLOAD
Frame Num of Serial Waspmote
<=> # Sequence Sensor_1 Sensor_2 ... Sensor_n
Type bytes ID ID
Besides, a special frame format was designed in order to send sensor data via low bit-rate protocols with short
payload size. This frame type is called “tiny frame”. The user must keep in mind that this protocol is not integrated
into Meshlium (in fact, this frame type is mainly designed for constrained radios like Sigfox or LoRaWAN, and
when operating with these protocols the receiver is not Meshlium but a Sigfox or LoRaWAN base station). In this
case, the Programming Cloud Service chops the whole “binary” frame payload into a number of “tiny frames” as
explained in the Data Frame Guide.
HEADER PAYLOAD
Sequence Lenght Sensor_1 Sensor_2 ... Sensor_n
Also, payload encryption feature (AES-256) can only be applied to radios using the binary frame format. If this
feature is enabled, encrypted binary frames will be used. The format of the encrypted frames is explained in detail
in the Data Frame Guide. In case of enabling the payload encryption feature, the user must define whether “Device
to Cloud” or “Device to Gateway” is used. The only difference between both encryption options is the frame type
identifier. Also, Meshlium will manage the frames differently. On one hand, the “Device to Cloud” packet will be
stored in the Meshlium’s database as it is received. On the other hand, the “Device to Gateway” packet will be
decrypted and then stored in the Meshlium’s database as any other unencrypted frame.
HEADER PAYLOAD
Frame Num of Serial Encrypted
<=>
Type bytes ID Payload
-55- v7.5
How data frames are generated
To sum up, depending on the radio protocol a specific frame format is used:
•• Sensor identifier: this is the first byte to identify the sensor. For instance, the temperature sensor.
•• Sensor value: the rest of the sensor data (one or more bytes) are dedicated to define the value of the sensor
data.
Sensor data
Sensor ID Sensor value (one or more fields)
In the Data Frame Guide you can find the explanation for the binary frames payload. There are different sensor
data types depending on the meaning of the data which integrates the sensor value. In the mentioned guide you
will find 3 binary sensor data types:
•• Simple data: sensor ID + one sensor field. For instance, the temperature sensor value.
•• Complex data: sensor ID + several sensor fields. For instance, the GPS (latitude and longitude).
•• String data: sensor ID + string length + string message.
Example:
-56- v7.5
How data frames are generated
Imagine the first register read from the RS-232 module is 0x0192 and the second register is 0x0115. In that case,
the final sensor data inserted within the payload would be:
Sensor data
Sensor ID Sensor field 1 Sensor field 2 Sensor field 3
Byte 0 Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6
0xB7 0x11 0x00 0x92 0x11 0x15 0x01
Figure: Sensor data structure
-57- v7.5
How to get the CA certificate for HTTPS connections
The certificate authority (CA) is an entity that issues digital certificates. A digital certificate certifies the ownership
of a public key by the named subject of the certificate. So, the CA assures you that no one possesses a certificate
for a domain which is not their own. This allows clients to rely upon signatures made about the private key that
corresponds to the certified public key. In this model of trust relationships, a CA is a third-party trusted both by
the client and the server.
To fulfill its purpose, the server certificate contains the server’s ID information (name, address, description, etc.)
and its public key. It also contains a digital signature, signed by the CA, which authenticates this information.
The client must trust the CA in order to accept its signature on a certificate. Furthermore, the trust relationship
between the client and the CA must be established prior to the communication session. Usually, a client software
(for example, Internet browsers as Google Chrome) include a set of trusted CA certificates. This makes sense, as
many users need to trust their client software. Therefore, once a trusted CA’s certificate is stored on the client, it
will accept certificates signed by that CA from the SSL/TLS server it connects to.
Before using secure connections with WiFi or 4G radios, you must make sure the CA certificate is correctly installed
on the radio.
-58- v7.5
How to get the CA certificate for HTTPS connections
-59- v7.5
How to get the CA certificate for HTTPS connections
-60- v7.5
How to get the CA certificate for HTTPS connections
-61- v7.5
How to get the CA certificate for HTTPS connections
Step 8: Now you can open the certificate with a text editor application and copy it into the PCS form.
-62- v7.5
Meshlium GW configuration and settings
Meshlium runs a set of scripts for implementing the data synchronization from its internal database “to the cloud”.
In other words, those scripts send data to web servers where the cloud service providers host their clouds. Those
scripts are called Cloud Connector.
All Cloud Connectors can be found in the “Cloud Connector” tab in the Meshlium Manager System. The user must
select their own Cloud Connector and enter the credentials for initializing the process that will take care of the
database synchronization. For more information, please refer to the “Cloud Connectors” section in the Meshlium
technical guide.
-63- v7.5
Meshlium GW configuration and settings
For HTTPS, the user must keep in mind that the Meshlium’s certificate has to be installed on the Waspmote or
Plug & Sense! radio prior to opening secure connections. The next picture shows how the user can download the
Meshlium’s certificate from Manager System —› System —› Users Manager —› Download Certificate:
-64- v7.5
Meshlium GW configuration and settings
Then, the certificate can be opened and copied from a normal text editor in order to paste the contents of the
certificate into the PCS form. So when the PCS user selects some protocol which sends data to Meshlium via
HTTPS, it is mandatory to insert the corresponding Meshlium’s certificate as it is shown in the next image.
-65- v7.5
Meshlium GW configuration and settings
-66- v7.5
Meshlium GW configuration and settings
However, Meshlium Manager System v4.1.0 and greater versions allow the user to enable the HTTP service in
order to be able to recieve HTTP non-secure requests. The user must go to Manager System —› System —› Security
—› HTTP Service:
-67- v7.5
Sending to the Libelium Cloud Bridge
In all cases, the recommended option is “Send to Libelium Cloud Bridge”. Depending on the radio module, data
(a) will need to go through the Meshlium gateway, (b) will be sent to the Sigfox or LoRaWAN server and forwarded
from there, or (c) will be sent directly to the Libelium Cloud Bridge service.
The Libelium Cloud Bridge features all the security and encryption layers that can be configured in the PCS.
The information needed in the Programming Cloud Service to generate the specific binary of each sensor node
is shared from the Services Cloud Manager and the Libelium Cloud Bridge service. All the services available in
the Libelium Cloud have access to the user information (active license type) and to the sensor nodes properties
(unique device ID and MAC address).
Cloud services may implement dashboards and data analytics applications that need to be fed with data from the
sensor nodes. The Libelium Cloud Bridge service will easily connect the sensor nodes with the cloud services (AWS
IoT, Microsoft Azure, IBM Bluemix, Alibaba Cloud, etc) as shown in the next diagram.
-68- v7.5
Documentation changelog
7. Documentation changelog
From v7.4 to v7.5
•• Modified the PCS Basic License conditions (added 3 security features, 6 nodes instead of 5)
•• Added indications to send frames to Meshlium via HTTP or HTTPS for WiFi/4G communication modules. By
default, Meshlium Manager System only permits secure connections (HTTPS) from version equal or greater
than v4.0.9.
-69- v7.5