This guide demonstrates how to get your MultiConnect® Conduit™ connected to scriptr.io, and visualize your mDot™ Box data on online dashboards. It is aimed to get the MultiConnect® Conduit™ IoT Starter Kit for LoRa® Technology users started with scriptr.io in just a few minutes, and jump start their development process.
In this article, you will learn how to configure the MultiConnect® Conduit™ to forward incoming data to scriptr.io using a Node-RED app. If you prefer a visual guide, check out the video tutorial on our YouTube channel: https://youtu.be/DWdibpfoPcA
Pre-requisites
Hardware
- MultiConnect® Conduit™ IoT Starter Kit for LoRa® Technology: from which we’re going to be using the following in this post:
- MultiConnect® Conduit™: we’re using the MTCDT-LEU1-247A Firmware 1.6.4, other AEP versions should work as well.
- MultiConnect® mCard™: along with the MultiConnect® Conduit™, you will also need the MTAC-LORA-H-915 if you’re in the US, or MTAC-LORA-H-868 if you’re in Europe.
- MultiConnect® mDot™ Box: although the device generating the data doesn’t matter (as long as it knows how to talk LoRa to the MultiConnect® Conduit™), in this guide, we will use the mDot™ Box as it’s very easy to use.
Software
- A scriptr.io account pre-loaded with the MultiTech apps: you can register for free using the following URL: https://www.scriptr.io/register?promocode=mtstarterkit.
- A DeviceHQ account: sign-up to DeviceHQ so you can install the scriptr.io Node-RED app on the Conduit™. When you sign up, make sure to register your device by going to Tasks > Register Device in the Devices page. It will prompt you to enter your device’s Serial number and UUID which you should find on the bottom of the device.
Recipe: Step by Step
-
Registering for a free scriptr.io account with the mtstarterkit promo code
Navigate to https://www.scriptr.io/register?promocode=mtstarterkit and follow the registration instructions to register to scriptr.io using the mtstarterkit promotion code. This will automatically install the MultiTech Asset Tracking app on your account.
-
Setting Up Your MultiConnect® Conduit™
The following assumes that the LoRa MultiConnect® mCard™ is already installed on the conduit. If not, please check this guide from MultiTech.
2.1. Setting Up the Ethernet Network
- Connect your conduit to the network using an ethernet cable.
- The conduit will be accessible on a default IP address (192.168.2.1). You might need to manually change your IP to something on the same network (192.168.2.2/255.255.255.0) in order to proceed, in case your network is on a different subnet.
- Access the admin interface using that IP and go to Setup -> Network Interfaces where you will be able to configure the network on the conduit to fit your existing network requirements:
- The ethernet port we’re trying to configure is eth0, click the edit button on the right.
- Configure appropriately (easiest might be to set it to DHCP if your network allows that).
- Access the admin interface using the new IPs (either manually provided or from the DHCP) and confirm that you can still access the MultiConnect® Conduit™ under the new address:
2.2. Setting Up the LoRa Network
Setting up LoRa on the conduit is all done from the admin interface, under LoRaWAN:
- Under the LoRaWAN section on the left panel, go to Network Settings
- Set the LoRa Mode to “Network Server”
- Select the appropriate Channel Plan based on your hardware and current location (US915 in this example)
- Set the Frequency Sub-Band to 1
- Click Submit to save your changes
- From the left-side menu, navigate to Key Management
- Set the Network ID to Name
- Set the Name to MultiTech
- Set the Network Key to Passphrase
- Set the Passphrase to MultiTech
- Click Submit to save your changes
- You will be prompted to restart the LoRa services, click restart, then click the Save and Restart red menu item from the left menu and wait for the Conduit™ to finish rebooting
For more information on getting the mDot™ Box connected to the Conduit, refer to this article by MultiTech.
-
Sending Data from the MultiConnect® Conduit™ to Scriptr.io
In this step, we will explain how you can start forwarding the data to a scriptr.io MQTT endpoint by installing and configuring a Node-RED client app on your MultiConnect® Conduit™.
3.1. Installing the scriptr.io client on your MultiConnect® Conduit™
To forward data to scriptr.io, you need to install the scriptr.io Node-Red client app on your MultiConnect® Conduit™ from the DeviceHQ store by following the below steps. Note, however, that if you don’t have a DeviceHQ account, please follow the instructions found here.
- Sign-in to your Device HQ account
- Click Store
- Click Public Apps and search for scriptr.io
- Select scriptr.io_simple_client from the resulting list
- Click Add to My Apps
- Confirm the action and accept the GPL license agreement
- Click Devices and select your device
- Click Tasks
- From the list, pick Install App
- From the Name drop-down, select scriptr.io_simple_client
- Click Schedule App Install
- Wait for the confirmation dialog to appear (“Confirm app install”) then click OK to confirm the installation. The installation will occur on the next check-in, i.e. the next time the Conduit™ checks in with DeviceHQ. If you don’t want to wait, you can manually check-in by clicking the Check-In To DeviceHQ button under Administration > Remote Management. Note that you will need to have the Remote Server option enabled for the Conduit™ to connect to DeviceHQ:
3.2. Configuring the scriptr.io client
In this step, you will configure the Node-RED app to know to which scriptr.io account to forward the data to. In other words, you need to specify the scriptr.io authentication token to be used by scriptr.io to identify the device and the account it belongs to.
- Double-click the config node to edit it. In the editor that opens, set the value of the
auth_token
variable to the myDevice token which you can retrieve from your scriptr.io Workspace as described next:- Go to your scriptr.io Workspace
- Click your user icon on the top-right corner, then click Device Directory
- Click the copy button corresponding to the myDevice device to copy its token to your clipboard
- Paste this value in the config node’s editor in Node-RED as the value of the
auth_token
variable
- Click the Done button to close the “Edit function node” editor
- Once done, click the Deploy button for your changes to take effect
After the Node-RED app is installed on your MultiConnect® Conduit™, it will start conveying data to the scriptr.io application previously set in your Node-RED configuration. You can view the data flowing in real-time by opening the dashboard of the asset tracking application, which is described in the following step.
-
Running your IoT Application in Scriptr.io
The asset tracking application is a simple proof of concept that displays your device on a map, and visualizes the data from your mDot™ Box device in scriptr.io. In addition to providing you with an easy way to visualize your data, this app is meant to help you jump start your development and build a more advanced, production-ready application.
To run the application:
- Navigate to the
assettracking/index.html
file - Double-click to open in the editor
- Click View to start the application
The default credentials are demo/demo.
- Navigate to the
-
Connecting your mDot™ Box and Viewing the Data
Now that everything is ready, you just need to turn on the mDot™ Box and choose LoRa Demo. In the LoRa Demo section, you can either choose to trigger a message to be sent once, or set it to regularly send data every 10s, 1m, 5m, 10m, 15m or 30m. Whichever option you choose, you will start seeing the data on the dashboard as soon as you press the button.
Note that the LoRa Demo mode doesn’t send GPS location, so the device will be shown in a default location on the map, New York, until you turn on the Survey GPS mode. Once you do that, the device location will be updated on the map, so you’ll need to navigate to the device’s current location to see it.
If you would like to change the default location, go back to the Node-RED App that you configured in step 3.8, open the
config
node, and change the values of thelat
andlon
variables to the desired values. -
Going Forward
Scriptr.io allows you to reduce the time to market of your IoT applications by accelerating your development pace, thanks to a plethora of API and visual development tools, such as our dashboard builder, our decision table editor, and the multitude of tools at your disposal in the Workspace. In addition to our long list of demo applications / modules / connectors which you can find under our GitHub account, we have built a few demo apps specifically for the MultiConnect® Conduit™ to help you get started.
The asset tracking app code can be found in your Workspace under the
app
andassettracking
folders, so you can modify it as you see fit. The app is documented, and you can find its Readme file under theapp
folder.Furthermore, if you want your Conduit™ to go through a DMP (Microsoft Azure, AWS, IBM Bluemix, TTN, etc.) before it reaches your IoT application on scriptr.io, connect to scriptr.io using MQTT, or use a device other than the mDot™ Box, then we recommend checking our previous blog post on connecting the MultiConnect® Conduit™.
For a deeper dive in scriptr.io, you can check out our one-page documentation as well as our how-to guides.
Finally, if you have any questions or feedback, we’d love to hear from you at support@scriptr.io.