Navigation

The Vesta Gateway runs a Node-RED application (“flow”) that connects to available Nordic Thingy:52 devices and sends that data to Amazon Web Services (AWS). This document will show you how to connect to and configure the Dev Kit, and how to modify it for your own purposes.

The Gateway will start Node-RED when it boots. There are two ways to begin interacting with the Node-RED application:

Connect the Gateway to Ethernet. Then, using a computer connected to the same network, open a web browser page to the Gateway’s unit serial number with the suffix .local (e.g. http://b014012917-00065.local).

Run through the process to connect the Gateway to your local Wi-Fi network (see Setup Wi-Fi with the Wi-Fi configuration app). At the end of this process will be a page with a link to the Node-RED application. Click the link once the Gateway has finished rebooting.

The Node-RED application will start the Dev Kit “flow” automatically. This flow will connect to any nearby Nordic Thingy devices (with the default name “Thingy”), and read sensor data from them. To power on a Thingy, remove the rubber enclosure from around the device and flip its power switch. The power should be on when the switch is closer to the corner of the device. If the battery is dead, plug the Thingy in via USB. When it is on, LEDs will blink slowly.

Figure 1.2 A Nordic Thingy, showing the power switch in the On position (on the side of the Thingy, front left corner), and the LEDs lit up blue-green.

The flow starts with a noble-connect node. This scans for Bluetooth Low Energy (BLE) devices, attempts to connect to them, and scans them for specific characteristic UUIDs.

From there it splits into two different processes. The top one formats the data and sends it to AWS if the switch on the dashboard is turned on. The bottom one formats the data and sends it to the graphs on the dashboard.

More detail about these processes can be found in the comment nodes in the flow itself. Highlight one of the comment nodes and open the Info tab in the sidebar to see its contents.

Figure 1.6 A comment node, highlighted to show its contents.

Note

If you are running multiple Gateways with this Node-RED flow on them you may experience difficulty connecting to each Thingy. To ensure that the correct Gateway is connecting to the correct Thingy, you can try configuring the noble-connect node with the UUID of the Thingy (this should be a 32-character hexadecimal value). You could also disable the Dev Kit flow on other Gateways by deleting the nodes in the flow and clicking Deploy.

If you run into errors or see unexpected messages, it may become useful to check the Node-RED log file. Connect to the Gateway and check the contents of /var/log/node-red/node-red.log. You can list the entire file with the command cat/var/log/node-red/node-red.log, or “follow” the log with the command tail-f/var/log/node-red/node-red.log.

API Gateway gives us two HTTP endpoints (POST /datapoint & GET /datapoints). Those endpoints point at two Lambda functions (getFunction & postFunction) that read and write device data from a simple DynamoDB table with a partition key of deviceId.

Node-RED makes an HTTP POST call to the API Gateway once per second for devices it is connected to, which updates the DynamoDB table with the time that device was last seen and the value of the X coordinate of the device’s accelerometer.

The populateBucket Lambda function is triggered every 5 minutes by a CloudWatch event. It looks for new devices in the DynamoDB table and updates a JSON file in S3 to include a time-series chart for every device in the DynamoDB table.

The freeboard site hits the GET /datapoints endpoint once every 5 seconds and builds a table of all known devices and a time-series chart of accelerometer data. The configuration of this dashboard comes from the JSON file that populateBucket updates.

Figure 1.8 Diagram of AWS infrastructure used to ingest and display sensor data

If you would like to stand up your own copy of the Devkit Dashboard, you can follow the links below to stand up an AWS CloudFormation stack capable of processing the data from your Rigado Gateway.

Region Name

Region Code

CloudFormation

US West (N. California)

us-west-1

US West (Oregon)

us-west-2

US East (N. Virginia)

us-east-1

Follow any of the links above depending on your preferred AWS region and then follow the on-screen prompts to create a replica of our AWS infrastructure in your account. You should be able to use the defaults for everything.

Note

Standard AWS charges will be applied to your AWS account.

CloudFormation will take ~5-10 minutes to create the stack.

Once the stack is available, you can view the “Outputs” section of the stack in the AWS console and get the two pieces of information you will need:

ApiURL – Needed to point your Rigado Devkit at your new AWS infrastructure.

DasboardUrl – Needed to view your own version of the DevKit Dashboard.

Figure 1.9 Outputs from the stack creation.

In Node-RED, Double-click on the “Rigado Demo Kit Lambda” Node and change the URL to the value of “ApiURL” from your stack.

Figure 1.10 URL to change in Node-Red.

It will take a few minutes for the data to propagate to the dashboard.