The purpose of this guide is to outline how to register mokosmart LoRaWAN end devices and gateway in ThingsBoard. This document is applicable to all the end point LoRaWan product of mokosmart.
Add Gateway
Add Gateway on TTN
Step 1: Power on gateway, and connect to gateway WIFI, access to the Web GUI, get the gateway ID on the “FUNCTAION-Server Access” page of Web GUI.
Step 2: Login in TTN account, choose the corresponding cluster, Here select US915 frequency plan as example, so the cluster will be North America 1.
Step 3: Go to gateway console on the home page.
Step 4: Register new gateway:
- Fill in the gateway ID got in step 1:
- Customize your gateway ID in TTN;
- Choose the frequency plan United States 902-928 MHz as your plan;
- Click the “Register gateway” to finish gateway register.
Step 5: Configure gateway’s parameter on the “FUNCTION-Server Access” page of Web GUI.
- Get the gateway server address in gateway General setting page.
- Fill in the server address in MKGW2 Web GUI page, the port will be 1700.
- Select the Frequency as your plan, here choose 915, and channel must be same as the configuration in TTN, we choose FSB2 in Step 4, so here we select channel US915_CH08-15.
Step 6: Check the gateway status:
- Check the status in gateway Web GUI, if it’s green, it means the gateway connect to server successfully, if it’s red, it means the gateway doesn’t connect to the server.
- Check the status on TTN platform.
Create Application on TTN
Step 1: Open your console and click on the “Create an application”.
Step 2: Fill in the required fields about the application. Then click “Create application” button.
Step 3: Go to the “Integrations” -> open the “MQTT” page in the left menu. Then, click on the “Generate new API key” button.
Step 4: Copy and save the password (API key) (after leaving the page it won’t be displayed).
Create Integration in ThingsBoard
- Go to the “Integrations” page of the “Integrations center” section. Click “plus” icon in the upper right corner to add new integration. Select “The Things Stack Community” as the integration type. Then, click “Next”.
- Paste the following script to the Decoder function section. Click “Next”.
- Leave the “Downlink data converter” field empty. Click on “Skip” button.
- Next, fill in the fields with your parameters. After, press “Add” button.
Add Device
Step 1:
- Go to the application console - “End devices” page;
- Click “Register end device”.
Step 2:
- Choose enter end device specifies manually;
- Select frequency plan (the frequency plan should be totally same as your gateway frequency plan);
- Select LoRaWan version as v1.0.3.
Step 3: Enter the JoinEUI, MOKO device default JoinEUI is 70 B3 D5 7E D0 02 6B 87
Step 4: After JoinEUI is confirmed, enter the DevEUI and AppKEY, for MOKO device, you can get the DevEUI on the package label, and the AppKEY for device is 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C by default. Or you can connect to the device via “MKLora” APP and read the DevEUI and AppKEY from the APP.
Step 5: Click Register end device to finish.
Step 6: Check the status of device on TTN.
And you can also check the live data, if there is payload uploaded means the device already connect to the server.
Step 7: Navigate to Payload formatters, get the decoder from the moko github_link, copy the related decoder and paste it. And then save it.
Step 8: Navigate to the “Devices” page of the “Entities” section, here you can see that:
- Devices registered in TTN were registered in ThingsBoard in the “Latest telemetry” section you will the update data from the device.
Add Dashboard
A dashboard in ThingsBoard allows users to visualize and monitor data collected from IoT devices. Let’s create a dashboard and add two widgets to it:
- The first widget will show the device’s battery level.
- The second widget will display the device’s location on a map.
Add Dashboard
-
Navigate to the “Dashboards” page through the main menu on the left of the screen. Click the “+” sign in the upper right corner of the screen, and select “Create new dashboard” from the drop-down menu. In the opened dialog, it is necessary to enter a dashboard title, description is optional. Click “Add”;

Navigate to the “Dashboards” page through the main menu on the left of the screen. Click the “+” sign in the upper right corner of the screen, and select “Create new dashboard” from the drop-down menu. In the opened dialog, it is necessary to enter a dashboard title, description is optional. Click “Add”;
Add Battery level widget
-
Click the “+ Add widget” button at the top of the screen or click the large “Add new widget” icon in the center of the screen (if this is your first widget on this dashboard);
-
Find the “Status indicators” widget bundle and click on it;
-
Select the “Battery level” widget;
-
The “Add widget” window will appear. Specify the “lw006test” device as the datasource and “batt_level” data ket as the variable that you want to monitor. Click “Add”;
-
You have added a widget that displays the battery level.

Click the “+ Add widget” button at the top of the screen or click the large “Add new widget” icon in the center of the screen (if this is your first widget on this dashboard);

Find the “Status indicators” widget bundle and click on it;

Select the “Battery level” widget;

The “Add widget” window will appear. Specify the “lw006test” device as the datasource and “batt_level” data ket as the variable that you want to monitor. Click “Add”;

You have added a widget that displays the battery level.
Add Map widget
-
Click the “+ Add widget” button at the top of the screen to add another one widget;
-
Find the “Maps” widget bundle and click on it;
-
Select the “Google map” widget;
-
The “Add widget” window will appear. Select “Device” as the datasource type. Specify the “lw006test” device as the datasource. Add “latitude” and “longitude” as time series data keys. Click “Add”;
-
To save the dashboard, click “Save” button in the upper right corner;
-
You have added a widget that displays the device's location on a map.

Click the “+ Add widget” button at the top of the screen to add another one widget;

Find the “Maps” widget bundle and click on it;

Select the “Google map” widget;

The “Add widget” window will appear. Select “Device” as the datasource type. Specify the “lw006test” device as the datasource. Add “latitude” and “longitude” as time series data keys. Click “Add”;

To save the dashboard, click “Save” button in the upper right corner;

You have added a widget that displays the device's location on a map.
Next steps
-
Getting started guides - These guides provide quick overview of main ThingsBoard features. Designed to be completed in 15-30 minutes.
-
Connect your device - Learn how to connect devices based on your connectivity technology or solution.
-
Data visualization - These guides contain instructions on how to configure complex ThingsBoard dashboards.
-
Data processing & actions - Learn how to use ThingsBoard Rule Engine.
-
IoT Data analytics - Learn how to use rule engine to perform basic analytics tasks.
-
Advanced features - Learn about advanced ThingsBoard features.
-
Contribution and Development - Learn about contribution and development in ThingsBoard.