I’m new to IoT and I could need some advice.
So I have the honor to setup a LoRa system and just to make everything clear I write down the components I will use:
- Kerlink Wirnet Station as the Gateway
- GlobalSat LS-111P CO2/Temperature/Humidity Detector which is LoRaWAN certified
- Elsys ERS-sound also LoRaWAN certified
- tabs movement detector also LoRaWAN certified
At the end of the day I need the complete System, just like the Architecture shows on the website. The Gateway sending information from the devices to our own server. No cloud.
As far as I can tell loraserver.io does exactly that. Since I’m new to IoT, the guides are hard to understand for me.
So I would like to know where to start?
I started reading about MQTT Protocoll and the mosquitto broker. Looks like a few hundred pages maybe. Am I going the right way? Do I need to know that much about MQTT and mosquitto? Because for the server there is much more needed than just mosquitto. I don’t only want to set it up and that’s it. I’d like to understand what I’m doing.
So any advice on what steps to take, what to read or watch, what to try or not, would be such a big help for me.
If possible I would do all these on a Windows machine. If not, on Ubuntu.
Thanks for any help in advance!
I am also kind new on IoT and had the same situation a few monts ago.
First of all, it is a interessting topic and its worth it
Now your question: loraserver does (as far as i know) not run on windows. the other products, like redis, postgres and mqtt (mosquitto) can run on windows machines - even if i would not do that.
then your next question about mqtt and mosquitto. generally you dont need to know much about mosquitto and the system will run - but i would recomand some resarching at least about QoS, authentication and how the system generally works. But as i said, you can also just start the mosquitto broker and loraserver.io will run.
Maybe just a last point how i did it. i used a SLES machine and put all the stuff on the same machine (Lora-Gateway Bridge, Loraserver, LoraAppserver, Mosquitto, Redis and Postgres). as everything was up and running (which is not that complicated) i started to look at every thing seperatly. so i started building a postgreSQL Cluster on own machines, Build a Redis Sentinel “Cluster” on own machines, changed mosquito to a verneMQ Cluster. On the Lora-Side i changed the Gateway Brige to run on the gateway. then i changed the loraserver and lora-app-server to run in docker container.
after every step you can proof if the system still works - and you can learn a lot during this procces.
if there are any more specific questions, just let me know. maybe i can help (even if i am not an expert)
So far I managed to set it up and have access to localhost:8080. Couldnt set up the devices yet, since Im waiting for someone else. I still have some questions and hope someone can help me.
Is there a guide for the lora-app-server, so I can learn how the webinterface works?
My next step is to install all these on Ubuntu Server with no GUI and access to the webinterface from another pc from local and also from web. The installation process will be possible since its only Terminal, but what comes after? Any advice would be great!
Have a great day!
I would say the best guide is the one you allready found on loraserver.io
If you have everything up and running, i would try to create a gateway in the app-server (you need a gateway-profile). after this, try to make a application and then register a device (you need a device-profile).
after step one (if everythings is configured correct (also on your gateway) you should see your gateway online (Gateways --> Select your Gateway --> Gateway Details --> Last seen).
after the step with registering the device, you should see data from your device. first you should see join requests, join accepts and later data framges (under your gateway in the register “Live Lorawan Frames”
Im on it right now. The device setup could be a problem since my partner wont be here today and I kinda have to wait for him. But I try to prepare everything until then. So I may get back ask for more advice or share the results.
Edit: Heres my question
Im editing the config file of the app-server and the
is something I wonder if I need it right now? Actually in my config the brackets are empty. Can it stay empty? And what exactly is that for? Im someone who only understands easy description. Imagine Im a kid.
Edit 2: Back to reading. This seems to help a little understanding json and jwt.
The jwt_secred is for authentication and authorization of the REST API and the gRPC Interface. Personally i only have experiences with the REST API.
Also here i recommend the documentation: https://www.loraserver.io/lora-app-server/integrate/auth/
with the command openssl rand -base64 32 you can generate a secret - put this in the configfile.
then go to the website (for example) https://jwt.io/
Put your informations there (in the decoded part)
for example (out of the documentation --> this goes to payload section): - you need to edit this for your environment
“iss”: “lora-app-server”, // issuer of the claim
“aud”: “lora-app-server”, // audience for which the claim is intended
“nbf”: 1489566958, // unix time from which the token is valid
“exp”: 1489653358, // unix time when the token expires
“sub”: “user”, // subject of the claim (an user)
“username”: “admin” // username the client claims to be
put in the secrete you generated in the part “VERIFY SIGNATURE”. after that you get a encoded token. with this token you can use the WEB API (https://servername:8080/api). put the encoded token on the header field jwt token.
you can also use curl with this secret, for example:
curl -X GET --header ‘Accept: application/json’ --header ‘Grpc-Metadata-Authorization: Bearer [Your encoded JWT Token here’ ‘https://servername:8080/api/applications’
–> this lists the number of applications you have configured.
hopefully i could explain it clearly, sorry - my english is not the best.
p.s GRPC uses the same authentication method - if you plan to use this.
Do I have to enter the exact information into nbf and exp? Since I dont know them…
Do I have to check the secret base64 encoded? Maybe I do understand it wrong but I used the base64 command you also wrote down.
Share JWT sounds like making it public, but thats what I have to click after all right? Will this be available for everyone?
Hope I dont bother asking. Thanks for everything!
As the Name says nbf (not before) and exp (expires) date says from when until when the token is valid
you can say (for expamle) its valid from yesterday at 12 until in five years - or whatever you want. so in this case the token can be used since yesterday to in 5 years. after this five years, the token will be invalid.
use https://www.epochconverter.com/ to convert “human time” to unixtime.
you dont need to share the JWT (i would not do this). Just put everything in the right part of the website (payload and verify) and then copy the left part (encoded) and use this for WEB API or Curl commands.
This gives the encoded token on the left:
use this encoded token for your WEB API or Curl
That makes sense. Didnt know I could set the expire date the way I want.
Thank you so much for your help!
Tomorrow Ill get the chance to play with the gateway and the 3 devices. Ill let you all know if we did suceed or did suceed,
Have a great day.
You can also have
lora-app-server issue a token for you by using the
/api/internal/login endpoint with a
POST request and parameteres
lora-app-server will use the JWT secret in its configuration file to generate and sign a token, and will later validate your requests with it.
So I have access to the gateway via putty now and Im trying to follow the guide. It says create the folder and download the armv5 file. Whenever I try to download it gives me following error:
wget: error getting response: Connection reset by peer.
My steps to this error:
- SSH into gateway via port 22
- create and move into /mnt/fsuser-1/lora-gateway-bridge/bin
- wget the direct link to the file https://artifacts.loraserver.io/downloads/lora-gateway-bridge/lora-gateway-bridge_2.7.1_linux_armv5.tar.gz
Any help would be great. Thanks!
Managed to move the files needed for the gateway. But I have a question now:
The guide says to skip the step of installing bridge if you want to install it on the gateway. So I did this gateway settings but I dont have any packet-forwarder. Do I also have to install bridge on the mosquitto broker?
I dont understand how to install the packet forwarder. The guide says how to install the gateway bridge on the gateway itself, but theres no guide on how to install the packet forwarder. I dont know how to keep on and could need some help.
Im trying to install the gateway bridge on the gateway itself, not on the server.
Please see the Kerlink wiki on how to install the packet-forwarder on the gateway: http://wikikerlink.fr/. There you’ll find both instructions and the packet-forwarder binaries You might need to request access if you don’t have an account there. You’ll need to contact the Kerlink support for that.
Thank you for your reply. I was actually there but it says I need
The following files:
custo libloragw file
dota packet forwarder.
produsb zip file
I dont know what prdusb file is, or where to get it from. The others I could download though.
It would be best to contact the Kerlink support with your questions regarding the packet-forwarder setup
I managed to install the gateway and already received a signal from the ERS sound sensor. I could see it in the server web interface. Didnt get more far than this. But somehow the sensor didnt send anymore, or lets say, just randomly, through the day it sent 5 signals. The sensor ist set up to send every 600 seconds. I guess I have to change something else? The thing is, I only set up the device in the web interface of the server. I didnt tell the servers or the gateway that this device wants to send more signals. So Im like confused, on where to set this so it does work every 600 seconds.
Thanks for any help. This is such a great project for me and I learn so much.
Have a great day!