11/30/2020 7:46 PM | |
Joined: 6/26/2019 Last visit: 9/27/2024 Posts: 22 Rating: (0) |
Hello, With the following steps you can implement a private lorawan server on the IOT2050. Follow this guide: https://www.chirpstack.io/project/guides/debian-ubuntu/ Install these three components: 1) Install ChirpStack Gateway Bridge 2) Installing the ChirpStack Network Server 3) Installing ChirpStack Application Server The only thing that needs to be changed is, when installing the postgres database, the username and password: create role chirpstack_as with login password 'dbpassword'; create role chirpstack_ns with login password 'dbpassword'; And change the data of the two files with our password: nano /etc/chirpstack-network-server/chirpstack-network-server.toml nano /etc/chirpstack-application-server/chirpstack-application-server.toml Reboot IOT2050. Go to the following link: Configure the network-server and generate a lora gateway and an application. Regarding the gateways, there are different ones on the market, the cheapest are single channel. Most come configured to go to: router.eu.thethings.network # EU 433 and EU 863-870 router.us.thethings.network # US 902-928 router.cn.thethings.network # China 470-510 and 779-787 router.au.thethings.network # Australia 915-928 MHz Change the address of the LORAWAN server, to the ip of the IOT, for example 192.168.200.1, the port, the same as 1700 (UDP). Things to keep in mind at the gateway are: LORASYNCWORD: 52 (DEC) 0x34 (HEX) 18 (DEC) 0x12 (HEX) PREAMBLE length: It is usually 8, although it depends on the internal architecture of the sensor it can be 16. It will depend on the class of end node to connect. I have chosen chirpstack and not TTN, in case you don't want the data to be always traveling through the network. Also, chirpstack hardware requirements work on the IOT2050 and the TTN stack needs superior hardware. When configuring the node (sensor) of the three parameters: mac set deveui 0102030405060708 mac set appeui 0000000000000000 mac set appkey 01020304050607080910111213141516 mac join otaa Appeui, if we don't go online it is not necessary. TTN uses it because it usually has its service in the cloud. https://www.chirpstack.io/application-server/use/devices/ If the sensor sends 4 bytes, for example: appDataSize = 4; appData [0] = 0xAA; appData [1] = 0xAB; appData [2] = (uint8_t) (batteryVoltage >> 8); appData [3] = (uint8_t) batteryVoltage; We have to de-codec the data on the chirpstack server (Device-profile / codec): “function Decode (fPort, bytes) { var decoded = {}; decoded = { "dvb": { "a": bytes [0], "b": bytes [1], "c": bytes [2], "d": bytes [3], "e": fPort, } }; return decoded; }” Internally ChirpStack communicates through MQTT, so if in NODE-RED we subscribe to the sensor information, we will be able to have the LORAWAN sensor information in our NODE-RED application. Mqtt-broker server = localhost / port 1883 Topic: application/1/device/# QoS: 2 Output: a parsed JSON objet And we will have the result of the bytes sent by our lorawan sensor within our node-red to do what we want. Additionally, in our chirpstack server we will also have other connection services: - HTTP - AWS - AZURE - GCP Pub / Sub - InfluxDB - myDevices - Pilot Things - Semtech LoRa Cloud - ThingsBoard I know it is not explained very in depth, but following these steps it works !!! NOTE: I have not used the image in Support v1.0.2. I have followed the steps to generate my own image with this guide: Best regards. |
This contribution was helpful to2 thankful Users |
Follow us on