Spark Dev Kit Tutorial

To begin, you’ll need to create an account here on the MachineQ store, which will allow you to purchase a Starter Kit as well as log in to MQcentral.

created

Once you’ve logged into the store, you’ll find a special offer for a $199 starter kit that includes both a MachineQ gateway and a Spark Dev Kit (select the Spark Dev Kit in the dropdown). This offer will also give you 12 months of free access to our software platform.

Prerequisites

You will need the following:

  • MachineQ account
  • Computer with an available USB port
  • MachineQ Gateway
  • DevEUI, AppEUI, and AppKey (printed on a card inside your package)
  • Arduino IDE

Activating Your Gateway

First, the gateway needs to be connected to the network. You can activate your gateway quickly and easily with the MachineQ app.

The MachineQ app is available for iOS and Android. Search the App or Play Store for MachineQ. Download the app, install it and log in.

Scan the QR code on your gateway with the app, and follow the instructions on the screen.

Provisioning Your Dev Kit

Next, we need to provision the dev kit in order for the network to accept its Join Request once we have it programmed.

Log in to MQcentral.

Click the Devices side tab to navigate to the Devices page. Click Add a Device in the top right corner and enter the information in the fields as noted below and click Save.

created

Field Required Type Info
Name required <String> The device’s name. This will help you easily recognize your board.
DevEUI required 16 char hexidecimal Enter the DevEUI provided in your kit.
Service Profile required dropdown value Select COMCAST Testing CP.
Device Profile required dropdown value Select MQ-DevKits.
Decoder Type optional dropdown value Select CayenneLPP.
Output Profile optional endpoint Leave this field empty for now.
Activation Type required OTAA/ABP Keep the default value OTAA.
Application Key required for OTAA 32 char hexidecimal Enter the AppKey provided in your kit.
Application EUI required for OTAA 16 char hexidecimal Enter the AppEUI provided in your kit.
AppSKey required for ABP 32 char hexidecimal Leave empty.
NetworkSkey required for ABP 32 char hexidecimal Leave empty.
DevAddr Assign required in OTAA dropdown value Select Dynamic.
DevAddr required (except in OTAA where DevAddr Assign = dynamic) 8 char hexidecimal Leave empty.
Private Data required checkbox Leave the checkbox cleared so you can see your device’s information in MQcentral.
Sensor Tags optional checkbox Leave blank.

Assembling your Dev Kit

Using one of the ribbon cables provided, plug the temperature sensor into port A2/A3 (labeled on the back of the board).

Plug the board into your computer’s USB Type A port and be sure the green LED blinks to ensure it is receiving power.

Set Up the Arduino IDE

Open the Arduino IDE Application and specify the board type that you will be using. Go to the top menu bar and select Tools -> Board -> Arduino Leonardo.

Select the proper Port that you are using for your board by going to Tools -> Port xxx… (Arduino Leonardo). If you do not see a port with “Arduino Leonardo” in the name, please ensure the board connector is properly seated in the USB port.

Load the Sketch file

Download your sketch file here. This will allow you to program the board with its unique DevEUI, AppEUI, and AppKey and then send sensor data to the MachineQ platform. When you unzip the received file, make sure both the .ino and .h files are in the same folder.

Load the Sketch in the Arduino IDE by clicking File -> Open then navigate to and choose the received sketch file (*.ino).

Scroll down in the code to find the DevEUI, AppEUI and AppKey and replace the values with those you received with your dev kit.

Compile the code and upload it to the board by clicking the arrow icon in the top left.

Introduction to MQcentral

Understanding the health and communications between devices and the network is a critical part of a successful IoT deployment. To this end, MachineQ has developed a device and gateway management and debugging tool called MQcentral.

Going back to MQcentral, click the Devices tab to see all the traffic between the dev kit and the MQ platform. You should see the dev kit we just provisioned. Click the far right arrow in the Device Activity row to access the Device Details page.

created

This page displays a lot of useful information about the device.

created

  • At the top, you’ll see general device information.
  • Next, there’s device health information, including RSSI, SNR, and the packet error rate shown as averages on the left and graphed on the right.
  • At the bottom, you’ll see two tabs
    • the first displays the uplink and downlink messages (log stream) for the device
    • the second displays a time-series graph of sensor data

Shown below are screenshots detailing an example exchange between the device and platform (as seen by the platform) using log stream. This view is available by clicking the expansion arrows on the left side of each message listed in log stream.

First, there’s the device’s Join Request followed by the Join Accept message sent by the network server:

created

created

Next, you’ll see the device sending confirmed data upstream, followed by the acknowledgement of the received packet.

created

created

Output Profiles

Output Profiles are found under the Integrations tab on the left. They allow you to pump data out to any cloud application you choose using MQTT or REST profiles.

All you need to do is provide the proper Host and credentials.

Additionally, MachineQ has implemented native connectors directly to Azure and AWS to make connecting to these services much easier.

Complete instructions on implementing these profiles can be found here.

created

Going Further

To experiment with the other sensors in your dev kit, visit the SEEED Studio Wiki to download additional code which is found on each sensor’s page. Use the CayenneLPP format so that the MQcentral Dashboard can decode the payload.