LoRaWAN
LoRaWAN is a low-power, wide-area networking (LPWAN) protocol built upon the LoRa wireless modulation technique. It enables long-range, low-power communication for battery-operated devices.
The Things Network
Create a New Organisation
Log into the Things network: ttn.bitpool.com In the things network console, click on the organization icon. Click on the create organization blue button.

Add your new organisation. This will add you to the organisation as a collaborator. All other collaborators (users for this organisation) should be added here by selecting the blue add collaborator box.

Create a New Application under Applications
Create a new application.
When the application (Organisation) has been created, add the API key to the application.
Go to integrations in the tree and select MQTT. Select Generate New Api Key.

Go to Integrations (Left Hand Tree) and select MQTT. Select Generate New Api Key.

Generate an API key and save it so it can be re-entered into the password section below.
Example API Key: NNSXS.WFBIVY4CZAOAMGNP455MJ63JB62BNYV26USYIKQ.5HXPCJGTMPCKDEMQZUPJSOFCVJFET4UV7WQO7GDCRB6CVBNAWVDA
Image below is the username and password (API key) for the Bitpool MQTT Broker.

In app.bitpool.com, go to Bitpool connections – MQTT – External Broker – Add configuration.

Add a new pool or select an existing pool.
Add the correct endpoint, username and password (From the connection credentials above) and select the script from the drop-down box: “The Things Network”

Select the Test button, this will confirm the endpoint is valid. If endpoint is Valid, click on Create.
If successful, the window will close. If you selected a new pool, check the pool has been created in the Bipool portal - data - pools.
Register a New Milesight Device
Download the Milesight Toolbox Application on your mobile device. See Quick start guide from the device or website for more information. Use the Toolbox app and enable the new device at "Device Status" via the app.

Go to settings in the toolbox app – go to LoRaWan Settings and note the LoRaWan version (V1.0.3) and the APP EUI number (Join EUI) and the device EUI – some of this information can also be found on or in the packaging. All this information is required as part of the register end device process.

Registering the end of Device
Log into the Things network: ttn.bitpool.com
Make sure the user adding the device is a Collaborator for the application!
To register a device, go to Applications: Select the blue Register End Device button.

In the register end device section, you have two options from the Input Method.
You can select to add a device from the LoRaWan Repository (recommended) – however most times you will need to add the device manually.

Complete the device registration by adding the Join EUI (also know as the APPEUI), the Device EUI and add a meaningful name into the end device ID. Click on the Register end device button.
Generate the App key: Example: 6136C0D2E11DE5FA18FE83B353682F5D - this is entered into the device via the toolbox app.

You must enter the generated APP key from above into the end device by using the write feature in the toolbox application. The Application key is entered under LoRaWan settings – settings.

If all data is entered correctly the device will connect within 5 minutes.

Click on the device above – this will take you to a page like this.

Click on the Payload Formatters to go to this section.

Go to Github Website. https://github.com/Milesight-IoT/SensorDecoders/blob/main/EM_Series/EM300_Series/EM300-TH/EM300-TH_Chirpstack.js
Under the Milesight section, find the device you are working with: Find the correct TTN.js. file.

Copy the raw file by clicking on the top right-hand side copy icon.

Remove all the things network java script formatter data from the code box and paste the raw file into the box. Click on Save Changes.

Go to live data, you should see meaningful data uploading. Depending on the download settings in the device. There are Four data values in the below image.

Go to pool you created and check to see if it has streams from your devices

Adding Milesight Gateway
Follow the gateway user guide and Log into the Gateway.
Connect the Gateway to a Wireless Network.
Change the WLAN Work Mode form AP to Client.

Select the Scan Icon. Join the required network.

Enter the Network security key (password to the wireless network) under the Key section.
Select DHCP Client and press Save button.
Check under Status – WLAN, to see if the gateway connected to the internet.

Register the gateway by logging into: The Things Network.
Add the Gateway EUI address found under Packet Forwarder - General.

Update the below values in The Things network.
Set Frequency plan to AU_915_928_FSB_2 (TTN)

Add the ttn.bitpool.com server address into the packet forwarder section of the physical gateway or the things network address.

Switch work mode from “Client” back to “AP”, Create a name for your SSID network and assign a KEY (Wi-Fi password).
Disconnect the Cat 6 cable from the Gateway so the device can connect to the things network through the wireless network. Power down the device and back up again.
Last updated