Below you will find a quick start guide for the ST LoRa Dev Kit, but you can also stream our webcast on getting started here. (This may require logging in to the ST site.)
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.
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 an ST LoRa Dev Kit (select the ST Dev Kit in the dropdown). This offer will also give you 3 months of free access to our software platform.
You will need the following:
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.
Next, we need to provision the dev kit in order for the network to accept it’s 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.
|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 Dev Kit.|
|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.|
Attach the sensor shield to the top of the base board by stacking the two boards and aligning the pins and pressing firmly. Plug your USB cable into the port on the base board that has the ST Link label and connect the other end to your computer’s USB port.
Download your binary 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.
Go to File Explorer for a PC or Locations for a Mac. The board will appear as a drive.
Drag and drop the .bin file onto the drive to upload it to the board. The board’s LED will flash rapidly during the upload process.
For our example here we will use Tera Term which will allow you to see your board’s output. Launch it and select your board’s port.
Select Setup > Terminal and change the settings on dialog box to the following:
Select Setup > Serial Port and change the settings on dialog box to the following:
Press the black Reset button on your board, and when prompted in the terminal window, enter your keys: the DevEUI, AppEUI and AppKey that were printed on a card inside your package.
Once your board has the correct information it will attempt to join the MachineQ network. When it is successful, it will start sending sensor data. We’ll look at this interaction between the device and MachineQ platform next.
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.
This page displays a lot of useful information about the device.
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:
Next, you’ll see the device sending confirmed data upstream, followed by the acknowledgement of the received packet.
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.
If you’d like to dive deeper into the development process, you can download the source code for the sample project here.
Open the KEIL IDE, and then select Project > Open Project and navigate to your downloaded and unzipped project file.
Follow the file tree marked in 1 in the graphic below.
Build the project which will allow all the necessary files to be generated and included in your project (marked in 2).
Note: The keys you entered on your terminal screen are in a file named
commissioning.h marked in 3 (which you can find using KEIL’s search feature). This file is only visible after you’ve built the project.
Finally, inspect ‘main.c’, which appears in the file tree on the left under Projects/End Node. You’ll see the commissioning procedure you went through on the terminal, followed by the LoRa join procedure. Next are all the sensor readings followed by a LoRa Send command to get the data to the cloud.
If those packets were sent up as ‘ConfirmedData’, the board will wait for an ACK response from the network server.