Connecting dragino lps8n whith chirpstack running on raspberry pi

Hello, i need to receve the lora sensors data on my local raspberry pi without using internet and have aproximatley 1 week to deliver this.
For this i have an lps8n gateway connected to a raspberry pi 4, where i’m running chipstark.

So i have followed all steps indicated here: Quickstart Debian or Ubuntu - ChirpStack open-source LoRaWAN<sup>®</sup> Network Server

Here are the steps and files modifed on the raspberry pi(i had mosquitto previously installed with user and password):

-sudo apt install mosquitto mosquitto-clients redis-server redis-tools postgresql
- sudo -u postgres psql
-- set up the users and the passwords
-- (note that it is important to use single quotes and a semicolon at the end!)
create role chirpstack_as with login password 'safe2023';
create role chirpstack_ns with login password 'safe2023';

-- create the database for the servers
create database chirpstack_as with owner chirpstack_as;
create database chirpstack_ns with owner chirpstack_ns;

-- change to the ChirpStack Application Server database
\c chirpstack_as

-- enable the pq_trgm and hstore extensions
-- (this is needed to facilitate the search feature)
create extension pg_trgm;
-- (this is needed to store additional k/v meta-data)
create extension hstore;

-- exit psql
\q
-sudo apt install apt-transport-https dirmngr
-sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1CE2AFD36DBCCA00
-sudo echo "deb https://artifacts.chirpstack.io/packages/3.x/deb stable main" | sudo tee /etc/apt/sources.list.d/chirpstack.list
-sudo apt update
-sudo apt install chirpstack-gateway-bridge
-sudo systemctl start chirpstack-gateway-bridge
-sudo systemctl enable chirpstack-gateway-bridge

-sudo apt install chirpstack-network-server

-sudo nano /etc/chirpstack-network-server/chirpstack-network-server.toml

[general]
log_level=4

[postgresql]
dsn="postgres://chirpstack_ns:safe2023@localhost/chirpstack_ns?sslmode=disable"

[network_server]
net_id="000000"

[network_server.band]
name="AU915"

[network_server.network_settings]
enabled_uplink_channels=[24, 25, 26, 27, 28, 29, 30, 31, 64]	

# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://localhost:1883"

# Connect with the given username (optional) #preconfigured mosquitto
username="hydrosafe"

# Connect with the given password (optional)
password="safe2023"

-sudo systemctl start chirpstack-network-server

-sudo systemctl enable chirpstack-network-server

-sudo journalctl -f -n 100 -u chirpstack-network-server

-sudo apt install chirpstack-application-server

-sudo nano /etc/chirpstack-application-server/chirpstack-application-server.toml


[general]
log_level=4

[postgresql]
dsn="postgres://chirpstack_as:safe2023@localhost/chirpstack_as?sslmode=disable"

# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://localhost:1883"

# Connect with the given username (optional) #preconfigured mosquitto
username="hydrosafe"

# Connect with the given password (optional)
password="safe2023"


  [application_server.external_api]
  jwt_secret="52KsYTQV1NhbCgkkRMM+U3FNCyBj11P5zfEbotfGwYg=”

-sudo systemctl start chirpstack-application-server

-sudo systemctl enable chirpstack-application-server

-sudo journalctl -f -n 100 -u chirpstack-application-server

-sudo mkdir /etc/certs
-cd /root/certs


On web browser: 
	http://localhost:8080
		user: admin
		pass: admin
	go to gateway:
		+create
		
	Network service: 
		Name: local host
		Host: localhost:8000
	Service profile:
		Name: local service

So after running this, i configure my lps8n and on the chiprstack as per image, but i can’t see the gateway:

I think the problem is in chirpstack config because i’m receving data on the pi on UDP port 1700 that is not been processed:

Someone please help, i’m new on this, i have read a lot, but can’t figure the problem.

Your server address is incorrect.
You need to set server address to the IP of the Pi. E.g: 172.x.x.x or 192.168.x.x.
IP 127.0.0.1 of a device is the IP of itself.

1 Like

srry, i have upload wrong the screenshot, after the original problem i have been playing giving the PI static ip, and forgot that the lps8n can also act as a router and had that ip. Using the ip of the PI the problem is as described.

I can see data through UDP 1700 but is not been processed as you can see in the screenshot of the “netstat -lnu” command.

I edited the screenshot so now is the correct configuration that doesn’t work

As far as i see you have missed the chirpstack gateway bridge.

as you can see here ChirpStack architecture - ChirpStack open-source LoRaWAN<sup>®</sup> Network Server - the gateway (in your case the dragino) sends data to the chirpstack gateway bridge. chirsptack gateway bridge is configured to listen on udp 1700.
So if install / configure chirpstack gateway bridge, chirpstack gateway bridge will get the data and forward it to your mqtt. where the chirpstack server subscribes to the topics and gets the data.

Information: The Documentation which you linked and also the link in my answer refers to chirpstackv3. maybe you should think about using chirpstackV4 from the beginning.

Link to v4: Introduction - ChirpStack open-source LoRaWAN® Network Server documentation

thank you that was it.
In the tutorial didn’t mentioned you have to edit this file too with:
sudo nano /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml
and then check it with:
sudo journalctl -f -n 100 -u chirpstack-gateway-bridge

I will check the V4 later.

I would like to use this oportunity to ask for how bytes are saved as a string in the data section for decoding

i have this:
data:“AwEABMgAAAAABQEABsgAAAAA”
data0:3
data1:1
data2:0
data3:4
data4:200
data5:0
data6:0
data7:0
data8:0
data9:5
data10:1
data11:0
data12:6
data13:200
data14:0
data15:0
data16:0
data17:0

so, how this 18 bytes data is converted in the data ascii chain, i would like to know, because i would like to be able to obtain the payload from the data string. I’m not knowledgeable in java, only c, c++ and python.
i generated the data with this codec java code:

function Decode(fPort, bytes) {
    var decoded = {};
      	decoded.data = []
      	
      	for (var i = 0; i<bytes.length;i++){
          	if(i == 0){
              decoded.data0 = bytes[i]
            }
          	else if(i == 1){
              decoded.data1 = bytes[i]
            }
          	else if(i == 2){
              decoded.data2 = bytes[i]
            }
          	else if(i == 3){
              decoded.data3 = bytes[i]
            }
          	else if(i == 4){
              decoded.data4 = bytes[i]
            }
          	else if(i == 5){
              decoded.data5 = bytes[i]
            }
          	else if(i == 6){
              decoded.data6 = bytes[i]
            }
          	else if(i == 7){
              decoded.data7 = bytes[i]
            }
          	else if(i == 8){
              decoded.data8 = bytes[i]
            }
          	else if(i == 9){
              decoded.data9 = bytes[i]
            }
          	else if(i == 10){
              decoded.data10 = bytes[i]
            }
          	else if(i == 11){
              decoded.data11 = bytes[i]
            }
          	else if(i == 12){
              decoded.data12 = bytes[i]
            }
          	else if(i == 13){
              decoded.data13 = bytes[i]
            }
          	else if(i == 14){
              decoded.data14 = bytes[i]
            }
          	else if(i == 15){
              decoded.data15 = bytes[i]
            }
          	else if(i == 16){
              decoded.data16 = bytes[i]
            }
          	else if(i == 17){
              decoded.data17 = bytes[i]
            }
          	else if(i == 18){
              decoded.data18 = bytes[i]
            }
          	else if(i == 19){
              decoded.data19 = bytes[i]
            }
          	else if(i == 20){
              decoded.data20 = bytes[i]
            }
        	decoded.data.push(bytes[i])
    
        }
}