The premise

This article uses Docker-compose to deploy ChirpStack. Make sure you already have the following environment:

  1. Git(optional, download the source code first)
  2. Docker
  3. Docker-compose

About LoraWan Server

Before talking about LoraWan Server, we need to know LoraWan protocol first. LoraWan is a remote transport protocol for the Internet of Things. LoRaWAN Open Specification is a low power Wide Area Network (LPWAN) protocol based on LoRa technology.

The protocol stack also references the official graph:

How is the data sent from the sensor to the server and processed by the application? Check out the image below, again from the authorities:

The sensor at the top is then transmitted to the gateway via LoraWan protocol, which is then transmitted over the network to the Network server (NS), which distributes the data to the corresponding application server (AS).

One smart toilet, for example, comes with LoraWan sensors in hand sanitizer and tissue boxes, supplied by two separate manufacturers. They upload the remaining data (how much soap is left/how many tissues are left) to the network server (including the part transmitted by the gateway of course), which distributes the data of the tissue box to the application server of the tissue box manufacturer, and the data of the soap box to the application server of the soap box manufacturer.

In this way, vendor neutrality can be achieved on the premise that everyone follows LoraWan protocol. I can replace any bad device with a manufacturer that complies with LoraWan specifications without worrying about vendor lock-in.

In this process, the web server plays a very important role, here is a look at the current open source web server.

Open source LoraWan Server

LoraWan Server currently has three main open source LoraWan Servers:

  1. chirpstack
  2. lorawan-server
  3. ttn

Among them, chirpStack and TTN are Golang implementations and Lorawan-Server is Erlang implementations.

This paper only describes chirpStack, which is also the LoraWanServer technology stack that our company is using. We have tried the deployment of TTN, but it is not as easy to get started as chirpStack, so we did not continue to study TTN.

Deploy ChirpStack

ChirpStack is fairly simple to deploy, using the Docker-compose deployment as an example.

  1. Download the source code
> git clone https://github.com/brocaar/chirpstack-docker.git
Copy the code
  1. withdocker-composeThe deployment of
> cd chirpstack-docker  
> docker-compose up -d
Copy the code

Here is the output after I execute the deployment command:

[root@node123 chirpstack-docker]# docker-compose up -d
WARNING: The Docker Engine you're using is running in swarm mode.

Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.

To deploy your application across the swarm, use `docker stack deploy`.

Creating network "chirpstack-docker_default" with the default driver
Creating chirpstack-docker_chirpstack-gateway-bridge_1     ... done
Creating chirpstack-docker_chirpstack-geolocation-server_1 ... done
Creating chirpstack-docker_chirpstack-network-server_1     ... done
Creating chirpstack-docker_mosquitto_1                     ... done
Creating chirpstack-docker_redis_1                         ... done
Creating chirpstack-docker_chirpstack-application-server_1 ... done
Creating chirpstack-docker_postgresql_1                    ... done
Copy the code

Now open IP:8080 and you can see the Application Server page of ChirpStack. My IP is 192.168.3.123 and you can see the login page:

)

The default password is admin and admin. If you can log in, the deployment is successful.

)

Of course, the sensor data cannot be received at this time (referring to the configuration problem of the network server), the default frequency band is EU868, we need to use CN_470_510 in China, modify the configuration/ CHIRpstack-network-server/CHIRpstack – The network_server.band in the network-server.toml file is CN_470_510

[network_server.band]
name="CN_470_510"
Copy the code

Comment out the network_server.network_settings configuration below:

[network_server.network_settings]

#  [[network_server.network_settings.extra_channels]]
#  frequency=867100000
#  min_dr=0
#  max_dr=5

#  [[network_server.network_settings.extra_channels]]
#  frequency=867300000
#  min_dr=0
#  max_dr=5

#  [[network_server.network_settings.extra_channels]]
#  frequency=867500000
#  min_dr=0
#  max_dr=5

#  [[network_server.network_settings.extra_channels]]
#  frequency=867700000
#  min_dr=0
#  max_dr=5

#  [[network_server.network_settings.extra_channels]]
#  frequency=867900000
#  min_dr=0
#  max_dr=5`
Copy the code

Just reboot the server again, and you’re done configuring the network server. Of course, a complete data path also needs to create applications on the server, create devices, create gateways, configure network server-related content on the gateway, and initiate sensor data.

This article only describes the configuration of network server ChirpStack.

Originated from four coffee beans, reproduced please state the source. Follow the official number ->[Four Coffee beans] to get the latest content