Lopy LORAWAN/LORA standalone gateway
Hi! I'm trying to build a gateway consisting of a Lopy connected to a Raspberry Pi over Uart. The lopy handles everything Lora (send/receive to/from lopy nodes) and the raspberry is going to handle everything about sending to database etc.
I more or less have a prototype of the system up and working. I can send data (with info about what nodes the data should go to) from the RPI over uart to the gateway which forwards data to the lopy nodes. Data back from the nodes are received from the lopy gateway and sent back over uart to the RPi. I think its kinda cool :)
I don't want to use for instance TTN. The connection to the closest antenna is to far away and I want to have complete control.
But the problem is that I currently have the system set up with raw lora (Lora.lora) so I suspect there is a lot of collisions. If I use only one node everything works fine. If I add another node and they send relatively frequent it's quite random what is received by the gateway. Is there an easy fix to this? Alternatively how hard would it be to set ut this setup with lorawan instead? Any suggestions would be highly appreciated!
I'm trying to use nano-gateway with loraserver.io but I can not downstream messages just upstream.
Can you share if you had the same problem?
@gnm I set up the Raspberry because I found it hard to connect to Eduroam wifi at my university. Setting up my own Wifi hotspot was therefore much easier (ethernet from raspberry pi). I ended up using TTN because it was easy and next to no modification of the example code from pycom was needed. I will let you know if I continue working on this
I have tested the nanogateway without the raspberry and it worked fine. I don't know why did you need the raspberry when connecting to TTN.
@gnm I ended ut using the lorawan-nano-gateway code and set up a Raspberry pi as a wifi-hotspot forwarding wifi packets to and from lopy to TTN. I might try to set up the loraserver.io on the Rpi, but I haven't tried it yet.
I find the project of connecting the nanoGateway to the LoRa server (open source) from www.loraserver.io very very interesting.
I do not know @thomand1000 if you have succeded or not with @seb suggestions (I suppose so, because the thread is inactive since a week ago), but I would really like to try it. However, I have many doubts about it, and maybe you could help me with, or maybe we can help each other in case you haven't got things working yet.
First, let me tell you my progress (not much, but it will help you to understand where I am stand): I have small LoRaWAN network running, with a nano-gateway taken from https://docs.pycom.io/chapter/tutorials/lopy/lorawan-nano-gateway.html
and connected to TTN directly from my Lopy, but honestly I don't understand the details of the nanogateway.py. However, beyond my lack of understanding of the nanogateway (and of loraserver, I am just about to investigate about it), it seems that the packet-forwarder used in www.loraserver.io is the semtech packet-forwarder (https://github.com/Lora-net/packet_forwarder/tree/master/lora_pkt_fwd), the same packet-forwarder the nanogateway is using to connect to TTN (https://docs.pycom.io/chapter/tutorials/lopy/lorawan-nano-gateway.html)...so it should work, I think.
Anyway, could anyone help me to understand how to install, configure and run the required services in the raspberry, and also how to modify the nanogateway? I would really appreciate it. I really want to try the loraserver (running locally in the raspberry) with the nanogateway.
@seb Brilliant. I'll try that. Thanks! :)
Ah I see, in which case my recommended setup would be as follows:
- Setup loraserver.io to run on your raspberry pi
- Setup a wifi access point on the raspberry pi
- Connect the LoPy to the new WiFi network running the LoRaWAN nano gateway code.
I am unsure of your universities rules so this way you do not require internet connections on any of the device and the UDP packets wont get filtered out by your universities network. If you need internet access on the raspberry pi you can always just plug in an ethernet cable.
From there loraserver.io just gives you an mqtt server to access the LoRaWAN network you just created,
@seb I'm at a University in Norway where it's quite hard to get a connection to WIFI for these kinds of devices. It's a Eduroam network. I have followed a thread on the forums to set up a connection, but unsuccessfully. Another thing is that the raspberry would allow importing the threading library, which could give me a bit more control over the different threads. When I got the UART connection between the devices working I kinda stopped looking back. But, I'm not 100% sure that it is the best choice
Is there a specific reason you need to send the data over UART to the raspberry pi? It might be easier to just run the Lopy stand alone as a gateway and have it talk to a lorawan server and then access the data via the lorawan server.
@seb Yes, I was thinking about using the LoRaWAN gateway example code and possibly rewrite it so that everything done over UDP is changed to UART. Do you think that is a good approach?
In regards to setting up your own LoRaWAN gateway, we have a tutorial on our documentation website that demonstrates how to use a LoPy as a standard LoRaWAN gateway (https://docs.pycom.io/chapter/tutorials/lopy/lorawan-nano-gateway.html). With this script running on your LoPy, it will run as a single channel gateway. You can then connect it to any LoRaWAN network such as TTN or if you want to run your own there is an open source project for that too: https://www.loraserver.io/