1-Integration Milesight Gateway

2-Integration Chirpstack v3 with Milesight Sensor

3-Integration Chirpstack v4 with Milesight Sensor

4-Integration Milesight Gateway via Basic Station 




4-Integration Milesight Gateway via Basic Station

TABLE OF CONTENTS


Description

By default, ChirpStack v4 is configured to use the Semtech protocol. To enable support for Basic Station, manual configuration is required. 

This document provides a step-by-step guide to enable the Basic Station mode on ChirpStack v4, add the gateway, and verify the complete data flow configuration and operation.


Requirement

  • Gateway Model: All currently sold models are supported. This guide uses the UG65 as an example.
  • Available ChirpStack v4 Environment: Docker deployment is used in this guide

  • Frequency Band: EU868 (used in this demonstration)


Configuration

Step 1: Generate Certificates

a) Obtain Device ID

First, obtain the device ID of your gateway. 

The operation is as follows:

Copy this value; it will be used later.


b) Execute Commands

Assuming your ChirpStack v4 deployment path is:

/root/chirpstack-docker

Run the following:

mkdir -p /root/chirpstack-docker/configuration/chirpstack-gateway-bridge/certs

And :

cd /root/chirpstack-docker/configuration/chirpstack-gateway-bridge/certs
openssl req -new -newkey rsa:2048 -nodes -keyout key.pem -out cert.csr -subj "/CN=24e124fffef5a458"
openssl x509 -req -in cert.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out cert.pem -days 365 -sha256

Note: 

24e124fffef5a458 is the gateway ID used in this example. You must replace it with your actual gateway ID. Do not copy it directly, or connection errors will occur later.


After running the commands, you will see the following files created in the certs directory:

Now the certificate files are ready.

Download the files ca.pem, cert.pem, and key.pem to your local machine, and rename them as shown below:

Step 2: Modify Configuration File

Run:

cd /root/chirpstack-docker/configuration/chirpstack-gateway-bridge

Locate the configuration file for your gateway's frequency band. 

Since the gateway uses EU868, the configuration file is:

chirpstack-gateway-bridge-basicstation-eu868.toml

Use vim or nano to open it and modify it as shown in the example screenshot. 

Refer to the values below exactly:Please noted that these paths are inside the container, not on the host machine. 

Follow them strictly.

tls_cert="/etc/chirpstack-gateway-bridge/certs/cert.pem"
tls_key="/etc/chirpstack-gateway-bridge/certs/key.pem"
ca_cert="/etc/chirpstack-gateway-bridge/certs/ca.pem"

Other configuration files can be left as default.


Step 3: Add Gateway in ChirpStack

Follow the steps in the ChirpStack UI as shown below:

Pay attention to the Gateway ID (enter it correctly)

Click the Submit button:

Now the gateway is successfully added.


Step 4: Gateway Configuration

a) Disable Built-in NS Function

Do as shown below:

If the status shows Disconnected, it means the feature is successfully disabled.

b) Configure Basic Station Parameters

Set the following parameters:

 URI 

wss://192.168.45.224:3001 (Replace 192.168.45.224 with your ChirpStack v4 server IP, let the port as default port)

 CA File(*.trust)

This is the ca.trust file generated in Step 1

 Client Certificate File(*.crt)

This is the gateway.crt file from Step 1 

 Client Key File(*.key)

This is the gateway.key file from Step 1 


Click Save

After a few seconds, if the Connect Status shows Connected, then your configuration is successful.


Step 5: Verify Results

Log into the ChirpStack v4 web interface to check the gateway status:


If you see real-time updates under the LoRaWAN frames tab, the data link is working correctly.


Now your gateway is fully integrated with ChirpStack v4 using the Basic Station method.


FAQ

Q1:What if I have multiple gateways using the same frequency band?

A1:Log into your ChirpStack server and run:

cd /root/chirpstack-docker/configuration/chirpstack-gateway-bridge/certs

First, generate a new certificate and key for the second gateway:

openssl req -new -newkey rsa:2048 -nodes -keyout gateway1.key.pem -out gateway1.csr.pem -subj "/CN=REPLACE_WITH_OTHER_GATEWAY_ID"

Then sign it using ca.pem and ca-key.pem:

openssl x509 -req -in gateway1.csr.pem -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out gateway1.crt.pem -days 365 -sha256

Download the following three files, rename them as per Setp 1, and upload them to the new gateway for use:

Note: You do not need to modify the chirpstack-gateway-bridge-basicstation-eu868.toml file for the new gateway.


-END-