Private Network without internet

another solution is to put your gateway and a LoRaWAN serveur (Raspberry PI or clone, VM, PC, Laptop, …) on the same IP network then configure your GW to forward packet to your private LoRaWAN server.

sorry @Jeff-UK, just read your message, you put the proposal before :wink:

This gateway looks like based on raspberry Pi with Jessie, so with ssh shell access should be no problem to install the server on it
Even better, take a new SD card, follow my setup and should works (reset pin is GPIO25 also) right out of the box after the config :wink:

In all case keep the original SD card to get back to factory default

Datasheet mention that the private server running on it is the same that the one I mention, I could have build this GW :joy::joy:

Yes you are right, we buy the gateway earlier for testing Lora and now we want to adapt it to a particular way.

Yes We could do that. But for a reason of cost we want to do it directly on the gateway.

I got a SD card of 4 Go, I will try the way you configured DIY GW and the Lora Gateway Setup in local server.

This GW has all what you need to achieve your goal. And you have 2 solutions

  • Ask them for a SD with the LoRaWAN server installed on it or they give a link to download the SD image
  • Buy new SD and follow my setup

Just curious what the price of this GW, no price indicated on the site ?

And they seems to have a great concentrator shield for RPI (the one in your GW), would be interesting to know the price :wink:

Understood wrt cost/single platform - hadnt looked at details of the GW your using but looks like @Charles has nailed it wrt adding app server to the core Pi to do what you need…I still use an original SMTC IoT Starter Kit (now obsolete/unsupported :frowning: ) for some tasks which is essentially doing same - running NS + Customised/Demo AS on the core RPi with local data stored to SD card for grab over SSH or Webpage or extract card for off line use…

Around 400$, the GW and sensors starter pack.

I have follow your setup and now would like to know where the data are registred on the SD card. If I registred a DEV on the gateway how does it work ?

@ Gauss_Moniotring We used a LoRaLAN network (private network using LoRa transport layer only) where we have a RPI-based gateway storing all sensor data on a SQLite database. Code is on github: https://github.com/ReiniervdL/Vinduino/tree/master/Gateway-Python

Now we are migrating our networks to TTN for several good resasons.

2 Likes

@Gauss_Moniotring was able to realize the private network of LoRa?

1 Like

No sorry I didn’t succeeded in. But I doesn’t have time to do more research on the problem

Hello @Gauss_Moniotring, There is a simple solution you can implement on two Raspberry Pi devices. You can possibly reduce it to one.
Use this loraserver https://www.loraserver.io/.
Install the gatewaybrgide, loraserver and lora app server on a raspberry pi.
Install node-red on same raspberry Pi.
Configure Node-red to connect to the MQTT server running with the Lora Server setup and write the data to anything you want. MongoDB, Influx, or other storage.

WR if ‘simple’ any chance you can post a blog or how to showing steps…? :wink:

Yes, sure I can. Will post a blog and share the link here.

1 Like

@aizukanne Great. we wait for the step by step

It is possible to implement a private LORAWAN Network to connect Lora Nodes via gateways to a LoraWAN server and have the data collected from these nodes saved to a database or other storage medium. I will attempt to outline the steps required in summary. While this is meant to serve as a sort of guide, I will be referring to other articles which have detailed step by step instructions for implementing some of the functional units while adding a few pointers of my own. This article would guide the integration of the system as a whole.

In order to implement a private LoRaWAN Network, the following are required.

  1. LoRa Nodes (The Thing in the Internet of Things)

  2. At least one LoRaWAN Gateway/Packet Forwarder (An Access Point for the LoRa Nodes)

  3. LoRaWAN Network Server.
    I use the opensource LoRa Server project by @brocaar available here https://www.loraserver.io/ , and it provides the following:
    a. LoRa Gateway Bridge: A service which abstracts the packet-forwarder UDP protocol into JSON over MQTT.
    b. LoRa Server: A LoRaWAN Network Server, responsible for de-duplication and handling of received uplink frames received by the gateway(s), handling of the LoRaWAN mac-layer and scheduling of downlink data transmissions.
    c. LoRa App Server: A LoRaWAN application-server, responsible for the device “inventory” part of a LoRaWAN infrastructure, handling of join-request and the handling and encryption of application payloads.

  4. Node-RED: A simple programming tool for connecting hardware devices, APIs and online services.

The situation described already has LoRa Nodes and a Gateway so I will begin with the LoRaWAN Network Server. A Raspberry Pi or other single board computer running raspbian, armbian or other debian strain including Ubuntu, is required.

STEP 1. The LoRa Gateway Bridge requires an MQTT broker. Follow the detailed instructions here https://www.loraserver.io/lora-gateway-bridge/install/requirements/ to install Mosquitto MQTT broker.

STEP 2. Follow the detailed instructions here https://www.loraserver.io/lora-gateway-bridge/install/debian/ to install the LoRa Gateway Bridge and confirm it is running.

STEP 3. Install all requirements for the Lora Server. These include MQTT, REDIS Server and PostgreSQL. Detailed instructions are here. https://www.loraserver.io/loraserver/install/requirements/ . NOTE that you already installed an MQTT broker on the same machine so no need to install another.

STEP 4. Follow the detailed instructions here https://www.loraserver.io/loraserver/install/debian/ to install the LoRa Server and confirm it is running. You may want to change a few parameters but from my experience, default settings work perfectly if all components are installed on the same machine.

STEP 5. The requirements for the Lora App Server should be installed following the instructions here https://www.loraserver.io/lora-app-server/install/requirements/ . However, you will notice that all required services (MQTT, REDIS Server and PostgreSQL) have been installed in the previous steps so all you need do is to enable the pg_trgm (trigram) extension in postgreSQL as described in the link above.

STEP 6. Install the Lora App Server by following the instructions here https://www.loraserver.io/lora-app-server/install/debian/ . Basic configuration works out of the box where all LoRaWAN Server Components are installed on the same machine. Also remember to create self-signed certificates for the webserver and fill in the correct locations of these files in the configuration file. At this point, you should have a fully functional LoRaWAN Server. To confirm this, login to the LoRa App Server WEB UI by navigating to https://:8080/. Username is admin and Password is admin. Remember to change them.

STEP 7. When logged in, create a network server (basically enter the details of your Lora server installed in STEP 4), add an organization, create device and service profiles and add your gateway(s). I recommend creating at least two device profiles, one for Activation by Personalization (ABP) and Over the Air Activation (OTAA). Please note that the LoRa server IP address on your gateway software (identified as TTN SERVER) on most single channel gateways / packet forwarder configurations should be set to the IP address of this server. After this configuration, do not power up your gateway until they have been created in the Lora App Server. If they are powered on before creation in the app server and are automatically detected by the Lora Server, you will see errors when you try to add them later on the Lora App Server.

STEP 8. Create an application by adding the details of the application under an organization.

STEP 9. Create each of your nodes as devices under the application you just created. This ensures the data collected from these nodes are published under the application. The devices will be configured based on the selected device profiles which you should have created previously. The server can provide both ABP and OTAA authentication methods .

STEP 10. Install Node-Red. Node-Red is usually preinstalled in Raspbian. However it may be outdated and it is recommended to update it. Configure Node-RED to start on boot using the command

sudo systemctl enable nodered.service

If running debian/ubuntu, follow the commands here https://nodered.org/docs/getting-started/installation to install. Also remember to configure node-red to autostart on boot.

STEP 11. With node-red installed, connect to node-red Web UI by navigating to http://:1880/. Once logged in, select and drag the “mqtt in” node from inputs on the left column, into your flow. Configure it to connect to your MQTT broker and subscribe to the application topic as described here https://www.loraserver.io/lora-app-server/integrate/data/ . The first application is usually published as 1. If unsure, first subscribe to application/# and connect the output of “mqtt in” to a “json” node and then to a “debug” node to see the output in the debug tab. If the application ID is confirmed as 1 (for example), subscribe to application/1/node/+/rx to receive all data from all nodes configured in the application. At this point, details of any data transmitted by your nodes should appear in the debug tab. This is the full message payload published by the LoRa App Server, formatted as json and would look like this.

{"applicationID":"1","applicationName":"smart-nodes","deviceName":"alpha-monitor","devEUI":"1234567887654321","rxInfo":[{"mac":"30aea4ffff5614e8","rssi":-86,"loRaSNR":9,"name":"esp32-demo-gateway","latitude":11.123456,"longitude":12.123456,"altitude":453}],"txInfo":{"frequency":868099975,"dataRate":{"modulation":"LORA","bandwidth":125,"spreadFactor":7},"adr":true,"codeRate":"4/5"},"fCnt":784,"fPort":1,"data":"RIwPQWWe7kCFAAMAYgAzUH1PAQAB"}

The information from your nodes is stored in the object (“data”:“RIwPQWWe7kCFAAMAYgAzUH1PAQAB”) and is Base64 encoded.

STEP 12. Add a javascript function node to the flow after the json node. The json node converts json formatted strings to javascript objects. Open the javascript function node and enter the following to convert the data from Base64.

//Decode data from transmission into variables var newMsg = { payload: msg.payload.length }; newMsg.payload = new Buffer(msg.payload.data, 'base64'); return newMsg;

Remove the “debug” node previously connected to the output of the "json: node and connect it to the output of the “function” node. Deploy the changes and subsequent data sent by your nodes will be displayed decoded in the debug tab.

STEP 13. To store the data, you can chose to write them to a file or save to a wide choice of databases. To write to a file, drag the “file” output node from the storage section of the list of nodes on the left column to the flow. Connect the file node to the output of the “function” node. Configure the name of the file you want the data saved to and select the options as needed. Ensure you select “Append to file as the action”. Deploy your changes.

At this point all the data received from your nodes will be saved to a file and you can download the file at any time. If you are adventurous, you can configure the function node to format your data further before storing to file.

I hope this helps.

25 Likes

please how do i run this data capture on the raspberry pi

1 Like

Can you be a bit more explicit?

hello arinze. Now I have the system working. my nodes now send data to the Rak 831. the gateway now gets the data from four nodes at fixed frequencies. and i can now trap that with my nodered server. my chanllenge is that i want to involve control commands from the gateway back to the nodes. like i want to incoporate an LED and a Servo on each node. so i can turn on and off the LED and also control the direction of the servo. is that any way i can get help on this?

Hello Cherechi,

It is possible to schedule and send messages to devices. You can enqueue messages which will be sent to the class A devices in the RX window after they transmit. Take a look at the link below for details. https://www.chirpstack.io/application-server/integrate/sending-receiving/

Thanks,
I will have a look at it now.