如果您已经基于最新版本的LoraWAN Server(go 版本)的环境,搭建好了服务器的环境,但尚未进行参数设置(此处以470MHz频段设置为例),可以参考如下链接进行设置:
LoraWAN网关如何接入ChirpStack服务器?百度安全验证
此处做简要的归纳如下:
归纳之前,简单普及下CN470段,LoraWAN分配的96个频点,具体,可以参考 chirpstack-docker中的如下位置:
chirpstack-docker/configuration/chirpstack-gateway-bridge$ ls -ll chirpstack-gateway-bridge-basicstation-cn470_
chirpstack-gateway-bridge-basicstation-cn470_0.toml
chirpstack-gateway-bridge-basicstation-cn470_1.toml
chirpstack-gateway-bridge-basicstation-cn470_2.toml
chirpstack-gateway-bridge-basicstation-cn470_3.toml
chirpstack-gateway-bridge-basicstation-cn470_4.toml
chirpstack-gateway-bridge-basicstation-cn470_5.toml
chirpstack-gateway-bridge-basicstation-cn470_6.toml
chirpstack-gateway-bridge-basicstation-cn470_7.toml
chirpstack-gateway-bridge-basicstation-cn470_8.toml
chirpstack-gateway-bridge-basicstation-cn470_9.toml
chirpstack-gateway-bridge-basicstation-cn470_10.toml
chirpstack-gateway-bridge-basicstation-cn470_11.toml
每组对应的频率如下(在后面的ChirpStack频段地区设置时会用到,再次声明,此处与CN470 频段为示例说明)
CN470组 | 分配的频点(MHz) |
---|---|
cn470_0 | 470.3、470.5、470.7、470.9、471.1、471.3、471.5、471.7 |
cn470_1 | 471.9、472.1、472.3、472.5、472.7、472.9、473.1、473.3 |
cn470_2 | 473.5、473.7、473.9、474.1、474.3、474.5、474.7、474.9 |
cn470_3 | 475.1、475.3、475.5、475.7、475.9、476.1、476.3、476.5 |
cn470_4 | 476.7、476.9、477.1、477.3、477.5、477.7、477.9、478.1 |
cn470_5 | 478.3、478.5、478.7、478.9、479.1、479.3、479.5、479.7 |
cn470_6 | 479.9、480.1、480.3、180.5、480.7、480.9、481.1、481.3 |
cn470_7 | 481.5、481.7、481.9、482.1、482.3、482.5、482.7、482.9 |
cn470_8 | 483.1、483.3、483.5、483.7、483.9、484.1、484.3、484.5 |
cn470_9 | 484.7、484.9、485.1、485.3、485.5、485.7、485.9、486.1 |
cn470_10 | 486.3、486.5、486.7、486.9、487.1、487.3、487.5、487.7 |
cn470_11 | 487.9、488.1、488.3、488.5、488.7、488.9、489.1、489.3 |
首先,使用以下命令进入chirpstack-docker文件夹:
#从github上下载的基于docker版本的chirpstack-server
#基于docker版本的chirpstack-server的下载地址链接:https://github.com/chirpstack/chirpstack-docker
#git clone https://github.com/chirpstack/chirpstack-docker.git
cd chirpstack-docker
然后,使用vim对一下文件中的 “chirpstack/configuration/chirpstack.toml” 进行编辑
vi configuration/chirpstack/chirpstack.toml
找到如下位置:
# Enabled regions.
#
# Multiple regions can be enabled simultaneously. Each region must match
# the 'name' parameter of the region configuration in '[[regions]]'.
enabled_regions=[
"as923",
"as923_2",
"as923_3",
"as923_4",
"au915_0",
"cn470_10",
"cn779",
"eu433",
"eu868",
"in865",
"ism2400",
"kr920",
"ru864",
"us915_0",
"us915_1",
]
您可以根据需求添加地区,这里我们将基本可能会使用到的地区全部添加,您也可以自行选择添加(此处以我们常用的470频段进行设置,增加CN470的所有频段):
# Enabled regions.
#
# Multiple regions can be enabled simultaneously. Each region must match
# the 'name' parameter of the region configuration in '[[regions]]'.
enabled_regions=[
"as923",
"as923_2",
"as923_3",
"as923_4",
"au915_0",
"cn470_0",
"cn470_1",
"cn470_2",
"cn470_3",
"cn470_4",
"cn470_5",
"cn470_6",
"cn470_7",
"cn470_8",
"cn470_9",
"cn470_10",
"cn470_11",
"cn779",
"eu433",
"eu868",
"in865",
"ism2400",
"kr920",
"ru864",
"us915_0",
"us915_1",
]
保存当前的修改,并退出当前文件的修改;
接下来,修改 " configuration/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml "
vi configuration/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml
#默认为 eu868 的配置参数,此处根据你的实际情况进行修改,
#将如下内容修改为CN470 你所需的频段,比如使用 cn470_0
[integration.mqtt]
event_topic_template="eu868/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
state_topic_template="eu88/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
command_topic_template="eu868/gateway/{{ .GatewayID }}/command/#"
修改之后,如下所示(后续的射频通讯采用 cn470_0 组的频点,在终端,网关,以及服务器均设置为此参数):
[integration.mqtt]
event_topic_template="cn470_0/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
state_topic_template="cn470_0/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
command_topic_template="cn470_0/gateway/{{ .GatewayID }}/command/#"
保存当前的修改后,退出当前文件的编辑。
在docker-compose.yml文件中找到以下内容:
vi docker-compose.yml
#找到如下位置
chirpstack-gateway-bridge:
image: chirpstack/chirpstack-gateway-bridge:4
restart: unless-stopped
ports:
- 1700:1700/udp
volumes:
- ./configuration/chirpstack-gateway-bridge:/etc/chirpstack-gateway-bridge
environment:
- INTEGRATION__MQTT__EVENT_TOPIC_TEMPLATE=eu868/gateway/{{ .GatewayID }}/event/{{ .EventType }}
- INTEGRATION__MQTT__STATE_TOPIC_TEMPLATE=eu868/gateway/{{ .GatewayID }}/state/{{ .StateType }}
- INTEGRATION__MQTT__COMMAND_TOPIC_TEMPLATE=eu868/gateway/{{ .GatewayID }}/command/#
depends_on:
- mosquitto
chirpstack-gateway-bridge-basicstation:
image: chirpstack/chirpstack-gateway-bridge:4
restart: unless-stopped
command: -c /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge-basicstation-eu868.toml
ports:
- 3001:3001
volumes:
- ./configuration/chirpstack-gateway-bridge:/etc/chirpstack-gateway-bridge
将上面的eu868修改为前面设置的 cn470_0 ,如下所示:
chirpstack-gateway-bridge:
image: chirpstack/chirpstack-gateway-bridge:4
restart: unless-stopped
ports:
- 1700:1700/udp
volumes:
- ./configuration/chirpstack-gateway-bridge:/etc/chirpstack-gateway-bridge
environment:
- INTEGRATION__MQTT__EVENT_TOPIC_TEMPLATE=cn470_0/gateway/{{ .GatewayID }}/event/{{ .EventType }}
- INTEGRATION__MQTT__STATE_TOPIC_TEMPLATE=cn470_0/gateway/{{ .GatewayID }}/state/{{ .StateType }}
- INTEGRATION__MQTT__COMMAND_TOPIC_TEMPLATE=cn470_0/gateway/{{ .GatewayID }}/command/#
depends_on:
- mosquitto
chirpstack-gateway-bridge-basicstation:
image: chirpstack/chirpstack-gateway-bridge:4
restart: unless-stopped
command: -c /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge-basicstation-cn470_0.toml
ports:
- 3001:3001
volumes:
- ./configuration/chirpstack-gateway-bridge:/etc/chirpstack-gateway-bridge
完成后,需要重启ChirpStack服务或者重启服务器,如果是重启服务器,ChirpStack未设置自动启动,则需要手动开启ChirpStack服务。
cd chirpstack-docker
docker-compose up
接下来登录到 LoraWAN Server 进行相关的频段设置,具体的设置仍然以前面设置的 CN470_0 进行设置,这个可以自行进行设置 ,亦或**参考前面所提及的参考链接**。
浏览器访问 Lorawan Server 的格式 : IP:8080
(IP为你虚拟机所获取到的IP地址,通过ifconfig查看使用虚拟机的IP地址)
此处提供已经搭建好的、基于go语言版本的LoraWAN Server的地址((建议使用VMware 15.5 及以上版本打开))
LoraWAN Server 百度网盘下载链接:
链接:https://pan.baidu.com/s/1V9H1YlyOA3ciS8_3CgmVcw
提取码:jq7n
(如遇到百度网盘链接失效的情况下,请通过本文最后提及的联系方式告知,谢谢!)
如在搭建过程中,有遇到任何问题,可通过如下方式与我联系,我将尽己所能,帮助大家解决实际应用过程中遇到的问题;
E-mail: [email protected]
QQ: 1652893264