RAK Developer Kit 3 (Tracker Kit) Guide
Overview
This guide is about learning how to setup a complete LoRaWAN application from device, gateway up to network server. It composes of the following sections:
- Setting Up the Gateway
- Setting Up the Network Server
- Setting Up the Device
- Setting Up IoT Dashboard Using Datacake
Setting Up the Gateway
Configuring the RAK7246 WisGate Developer D0
This section will guide you on how to set up and configure your gateway.
đź“ť NOTE: If you are new to LoRaWAN, here are a few good references about LoRaWAN and gateways: |
Here are the steps in configuring the RAK7246 WisGate Developer D0:
By default, the gateway will work in Wi-Fi AP Mode, which means that you can find an SSID named "Rakwireless_XXXX" on your PC Wi-Fi network list.
📝 NOTE: “XXXX” is the last 2 bytes of your RAK7246 WiFi MAC address. Connect to this Wi-Fi SSID using the password provided below. Also, the default IP address of the gateway provided below will be needed in connecting via SSH. |
- Wi-Fi Password: rakwireless
-
Default IP Address: 192.168.230.1
Log into the gateway.
-
- Windows OS SSH (Secure Shell) is typically used to log in to a remote machine and execute commands. There are a lot of free and good SSH Clients out there, namely Putty, BitVise SSH Client, MobaXterm and many more. Feel free to choose one that fits your needs, but in this guide, Putty is used.
- Windows OS SSH (Secure Shell) is typically used to log in to a remote machine and execute commands. There are a lot of free and good SSH Clients out there, namely Putty, BitVise SSH Client, MobaXterm and many more. Feel free to choose one that fits your needs, but in this guide, Putty is used.
- Mac OS Open the Terminal of Mac OS. Launch the Terminal application found in the
/Applications/Utilities/
directory, but you can also launch it from Spotlight. Press Command + Spacebar and type “Terminal”, then return.
If you have connected to the gateway through Wi-Fi AP Mode, the IP Address is 192.168.230.1. It will then prompt you to enter the username and password. Enter the default credentials:
-
- Username: pi
- Password: raspberry
From the previous step, get the Gateway ID by typing sudo gateway-config
to your chosen SSH Client terminal editor. It can be found on top of the terminal console, as shown in the red box in Figure 5. You may copy it on a txt file or any notepad software. It will be used in setting up the gateway in TTN V3. See Figure 5 for reference. You will use it also as Gateway EUI in the latter part of this guide. In this example, the Gateway ID is B827EBFFFE81.
đź“ť NOTE: In this guide, you will be using TTN (The Things Network) as the LNS (LoRaWAN Network Server). There are many other LNS available that you can use, as well. The configuration steps will be different depending on your chosen LNS, but the general LoRaWAN principle is the same. |
Like for RAK WisGate Edge Gateways, it has built-in LNS that you can use.
You can now connect your gateway through Wi-Fi to access TTN. It can easily be done with the wireless capabilities of the Raspberry Pi Zero W by choosing "5 Configure WIFI". By default, the RAK7246 WisGate Developer D0 Gateway works in Wi-Fi AP Mode. For the gateway to connect to the router, it must work in Wi-Fi Client Mode.
There are 5 options to choose from in the Wi-Fi configuration menu:
- Enable AP Mode/Disable Client Mode - the gateway will work in Wi-Fi Access Point Mode after rebooting, while the Wi-Fi Client Mode will be disabled (this is the default mode).
- Enable Client Mode/Disable AP Mode - the gateway will work in Wi-Fi Client mode after rebooting, while Wi-FI AP Mode will be disabled.
- Modify SSID and pwd for AP Mode - used to modify the SSID and password of the Wi-Fi AP. Only works if the Wi-Fi AP Mode is enabled.
- Add New SSID for Client - this is used if you want to connect to a new Wi-Fi network. Only works in Wi-Fi Client mode.
- Change Wi-Fi Country - this is used to modify the Resident Country to match Wi-Fi standards.
đź“ť NOTE: To enable Wi-Fi Client Mode, you have to disable first the Wi-Fi AP Mode. |
Once Wi-Fi AP Mode has been disabled by choosing "2 Enable Client Mode/Disable AP Mode", you can now then connect to a new Wi-Fi Network by choosing "4 Add New SSID for Client".
- Start by selecting your country of residence.
- Enter the SSID of the network you want to connect:
⚠️ WARNING: Ensure to input the correct Wi-Fi SSID and password, or you will not be able to connect to the RAK7246 again via SSH in Wi-Fi AP Mode. If stuck in this situation, follow the Optional Configurations procedure listed in the Accessing the Internet, which is applicable for all Raspberry Pi-based gateways to work again in Wi-Fi AP mode. |
- Enter the SSID of the network you want to connect.
- Lastly, reboot the gateway using the command sudo reboot in the command line and it will connect to the router successfully.
sudo reboot
After rebooting the RAK7246 WisGate Developer D0, you should check if it is connected successfully to your Wi-Fi network. You may use your local network modem/router admin console to check if RAK7246 is successfully connected.
In this example, the admin console can be access via http://192.168.0.1
. It is also common to have it on http://192.168.1.1
on some routers. Take note on the IP address alloted to the RAK7246 by your Wi-Fi network.
You can also use Advanced IP Scanner for Windows OS, or Angry IP Scanner for Mac OS, and locate the IP address of RAK7246 WisGate Developer D0 in your Wi-Fi device.
As seen in Figure 12, it is 192.168.0.28
, where the company is Raspberry Pi Foundation. You can use that IP address to configure other related parameters of RAK7246 WisGate Developer D0
by logging in to the SSH Client Software, as stated in the previous step, now with the IP address of RAK7246 WisGate Developer D0
from your Wi-Fi network.
đź“ť NOTE:
|
To link your gateway to TTN, you need to setup first the RAK Gateway LoRa by choosing "2 Setup RAK Gateway LoRa concentrator".
Then, you need to select Server is TTN as the LoRaWAN server and select the right frequency that will match your gateway and region. The supported frequency plan of TTN can be found on their website.
For this example, you will be using EU868 Frequency Plan. Choose “4 EU_863_870”.
After choosing the correct frequency, the success message will appear, as shown in Figure 16.
You need to check if the right SERVER_ADDRESS is used to connect to TTN V3. To do this, you need to choose “4 Edit packet-forwarder config” from the Configuration Options.
You will be editing a JSON file to configure the server_address to eu1.cloud.thethings.network. To save the changes you made, if there is any, press CTRL + X
to exit the editor and select yes to confirm the changes.
đź“ť NOTE: There are three server clusters available for TTN V3. In this guide, we will use eu1.cloud.thethings.network . You need to select the closes one in your country or location for optimized performance.
The available TTN V3 clusters are:
|
Restart the Packet-forwarder by choosing “3 Restart Packet-forwarder” from the configuration options.
Setting Up the Network Server
Connect RAK7246 WisGate Developer D0 to TTNv3
This section shows how to connect RAK7246 WisGate Developer D0 to TTNv3.
Create a TTN account if you don't have one yet.
Make sure you are in the right TTN cluster, and then log in to TTN. Use your The Things ID credentials to log in.
After you have logged in, you need to register your gateway to TTNv3. To register, choose Go to gateways. If you have already registered your gateways before, head on to Gateways > + Add gateway.
Fill in the needed information:
Owner – Automatically filled by The Things Stack, based on your account or created Organization. (e.g. rak-discovery)
Gateway ID – This will be the unique ID of your gateway in the Network. ID must contain only lowercase letters, numbers, and dashes (-). (e.g. rak-d0-ph-las-pinas)
Gateway EUI - A 64 bit extended unique identifier for your gateway. This is where the Gateway you get on step 4 of Configuring the RAK7246 WisGate Developer D0 above. (e.g. B827EBFFFE81)
Gateway name – A name for your gateway. (e.g. RAK D0 Pilar Las Pinas PH)
Gateway description (optional) - Optional gateway description; can also be used to save notes about the gateway.
Gateway Server address - The address of the Gateway Server to connect to (i.e. eu1.cloud.thethings.network).
Frequency plan - The frequency plan used by the gateway.
đź“ť NOTE:
|
To register your gateway, scroll down and click Create gateway.
Gateway is now registered to TTN V3. Click Live data to check if the gateway already working.
Creating a LoRaWAN Application in TTN
This section will guide you on how to set up using The Things Stack Community Edition.
Go to the TTN website.
Fill in all your details to create a new account. Click on Create account.
Validate the link from your email account so you can now start onboarding Lora devices.
Go to CONSOLE, then choose Europe 1.
After choosing Europe 1, click on Create an application.
Add the WisBlock Kit 3 by clicking the Create application.
Click End devices, then Add end device.
Choose Manually to register the end device. Fill in the required details and click Register end device.
In the End devices tab, click General settings, then fill in the End device name and End device description. After that, press Save changes.
Then, click on Payload formatters > Uplink > Formatter type and choose Javascript.
Delete the default code of the Formatter parameter field. Copy and paste the code below, and click Save changes.
function Decoder(bytes, port)
{
var longitude_int, latitude_int;
var decoded = {};
if (port === 2)
{
if(bytes[0]==9) // check if the header byte is 9.
{
latitude_int = (bytes[1] << 24) | (bytes[2] << 16) | (bytes[3] << 8) | (bytes[4]);
decoded.latitude = latitude_int / 100000;
longitude_int = (bytes[6] << 24) | (bytes[7] << 16) | (bytes[8] << 8) | (bytes[9]);
decoded.longitude = longitude_int / 100000;
return decoded;
}
}
}
After doing all the steps, set up first your Lora device so that it can send data to your The Things Stack account.
Setting Up the Device
This section will guide you on how to set up your device.
Download the Arduino IDE, then install it on your PC or laptop.
⚠️ WARNING: If you are using Windows 10: Do NOT install the Arduino IDE from the Microsoft App Store. Install the original Arduino IDE from the Arduino official website. The Arduino app from the Microsoft App Store has problems using third-party Board Support Packages. |
Open the Arduino IDE, then install the RAKwireless BSP support for the Arduino Board Manager.
Click on File > Preferences. In the Preferences window, look for Additional Boards Manager URLs, then click the icon on the right side.
Copy https://raw.githubusercontent.com/RAKwireless/RAKwireless-Arduino-BSP-Index/main/package_rakwireless_index.json
and paste it into the new window, then click OK > OK.
Go to Tools > Board: "Arduino Uno" > Boards Manager. Type RAK in the search bar, and the RAKwireless Core modules will be shown in the window.
Choose RAKwireless nRF Boards, then click Install. After installing the RAK4631 Arduino BSP (Board Support Package), click Close.
After the installation of the RAKwireless nRF Boards core module, copy the code in the GitHub repo, and paste it to the Arduino IDE. Save this file as "GPS_Tracker.ino".
Install all the libraries needed by the WisBlock Kit 3, as shown in Figure 62. Just click the links in the sketch, then install them one by one.
After all the libraries are installed, go to Tools > Board: “Arduino Uno” > RAKwireless nRF Modules > WisBlock RAK4631.
Compile the "GPS_Tracker.ino" by pressing the check button in the Arduino IDE. Wait after the code compiled is successful, and the Done compiling status appears.
After a successful compilation, assemble the hardware of WisBlock Kit 3. All parts are shown in Figure 69. All details about WisBlock Kit 3 can be found on the GitHub Repo.
- Connect the RAK4631 in CPU SLOT of the RAK5005-O.
- Next, attach the RAK1910 to the SLOT A port.
Finally, place the RAK1904 to the SLOT D. Screw all the edges so that connection is firm and tight to avoid loose connection.
Attached also are the LORA and BLE antennas to the RAK4631 LPWAN CPU.
⚠️ WARNING: Make sure to attach the antennas first before powering on the WisBlock Kit 3 to avoid damaging the GPS Tracker kit. |
Go back to your The Things Stack account. Go to Applications > WisBlock Kit3 GPS Tracker > End devices > wisblock-kit3-gpstracker > Overview.
Copy the AppEUI, DevEUI, and AppKey then paste them to any text editor. Use Toggle, Copy, and Visibility buttons to copy the correct format.
Open again your Arduino IDE. Change the keys of the sketch/code the keys from The Things Stack end device copied to the text editor from line 78 to line 80. Connect your complete assembled WisBlock Kit 3 to your PC or laptop to the USB.
Upload your sketch/code GPS_Tracker.ino to the WisBlock RAK4631 after updating the keys by pressing the Upload button. Double check if the Arduino IDE Board and Port is using WisBlock RAK4631 to have a successful code uploading.
Check again your The Things Stack account and go to Applications > WisBlock Kit3 GPS Tracker > Live Data. Wait for the uplink data messages that are updated every 10 seconds.
Setting Up IoT Dashboard Using Datacake
This section will guide you on how to integrate your application using Datacake.
Go to datacake.co. Click Dashboard, then select Sign Up.
Fill in all the requirements, then click Create Account.
Under the Devices tab, click the Add Device button.
A window will pop up. Select the following listed below, then click Next.
- Device: LoraWAN
- Datacake Product: New Product
- Product Name: WisBlock Kit3 GPS Tracker
On the same window, under the Network Server tab, choose The Things Stack V3, then click Next.
Go back to your The Things Stack account. Copy the End device ID and DevEUI from your The Things Stack account. Then, add the DEVEUI and NAME from the The Things Stack device and click Next.
Finally, choose a free account of the Add 1 device. Wait until the wisblock-kit3-gps-tracker device appears.
Under the Members tab, click API Users, then Add API User.
Fill in all necessary information, then click Save.
After filling in, copy the Datacake API Token.
Then go back to the The Things Stack account, and head on to Integrations > Webhook > Add webhook.
Choose Datacake, then fill in all the data requirements.
Paste the Datacake API Token and press Create datacake webhook.
Go back to your Datacake account. Under the Devices tab, click wisblock-kit3-gpstracker > Configuration > Fields, then Add Field.
An Add Field window will pop up. Choose the following details, then click Add Field.
-
- Type: Geolocation
- Name: Location
Delete the default Payload Decoder. Copy-paste the code below and click Save.
function Decoder(bytes, port) {
var datacakeFields = [];
var latitude = (bytes[1] << 24 | bytes[2] << 16 | bytes[3] << 8 | bytes[4]) / 100000;
var longitude = (bytes[6] << 24 | bytes[7] << 16 | bytes[8] << 8 | bytes[9]) / 100000;
datacakeFields.push({
field: "LOCATION",
value: "(" + latitude + "," + longitude + ")"
});
return datacakeFields;
}
After adding the Location field, click Devices and select Debug. You will now see the field and value parameters.
Still under the Devices tab, click Dashboard, then Add Widget.
A window will pop up, and you can now select a widget. For this example, choose Map.
After selecting Map widget, you can now start editing its data fields.
You can also add another data field by clicking Add Field.
Add a Location field. Once done, click Save.
After doing all these steps, you can now see the Map widget in the Datacake dashboard.
Now, you have already completed setting up the WisBlock Kit 3 GPS Tracker Project using Datacake Dashboard.
Updated