bao-optimiz / TTN-Node-Map_Lora

TTN Map - Maps all your GPS nodes and uplinks to gateways

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Logo

TTN Node Coverage Map

Project is aimed to store node GPS points and then display on a map the nodes and gateway connections
Explore the docs »

View DemoReport BugRequest Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. License
  6. Contact

About The Project

In this project were are going to save all the uplinks from TTN in the raw format to a MySQL database. From here we will recall the data and display it on a map. The map will display the location of the node, the uplink path and the gateway the node connected to. The node will be colour and the link as to the rssi.

TTN-Node-Map

Built With

  • Node-Red
  • node-red-dashboard
  • node-red-contrib-web-worldmap
  • node-red-node-mysql
  • MySQL

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • Node-Red

    https://nodered.org/docs/getting-started/
  • node-red-dashboard

    https://flows.nodered.org/node/node-red-dashboard
  • node-red-contrib-web-worldmap

    https://flows.nodered.org/node/node-red-contrib-web-worldmap
  • node-red-node-mysql

    https://flows.nodered.org/node/node-red-node-mysql
  • MySQL

    With a little bit of Googling find the installation for your OS
  • MySQL Workbench

    https://dev.mysql.com/downloads/workbench/
  • The Things Network – Application with GPS nodes connected

    https://www.thethingsnetwork.org/

Installation

  1. Install Node-Red following the relevant getting started guide for your operating system form the official website

    https://nodered.org/docs/getting-started/
  2. Install npm package node-red-dashboard

    npm install node-red-dashboard
  3. Install npm node-red-contrib-web-worldmap

    npm install node-red-contrib-web-worldmap
  4. Install npm node-red-node-mysql

    npm install node-red-node-mysql
  5. Install MySQL Workbench

    https://dev.mysql.com/downloads/workbench/
  6. Open Workbeanch and follow the instructions on creating a new database and table. Please keep a note of the username and password for the db, we will require it later to set up the node-red flow. We require a table that has two columns, "json" and "timestamp".

    https://dev.mysql.com/doc/workbench/en/wb-getting-started-tutorial-creating-a-model.html
  7. From your application in “The Thing Network” go to your “Console”, select the application that contains your GPS Nodes. This is the application that collect the data from your GPS nodes. Go to “Integration” and select “MQTT”, select “Generate new API key”. Note the “Public TLS address”, “Username” and “Password”, this is going to be needed in the MQTT node in the Node-Red flow.

  8. Install the Node-Red flow, copping the *.json from below into your Node-Red running on the sever you have installed Node-Red on. “localhost:1880”

    https://github.com/JohanScheepers/TTN-Node-Map/blob/main/TTN_Node_Map.json
  9. In the Node-Red flow configure the MQTT node “mqtt from TTN”, here you need the credentials from Step 7 and “MQTT in Node-RED [HowTo]” the link below is a good resource to read

    https://www.thethingsnetwork.org/forum/t/mqtt-in-node-red-howto/39909
  10. In the Node-Red flow configure the “json to DB” MySQL node. Select in the Database dropdown “Add new MySQLdatabase”. Enter your Host, Port 3306, User, Password and Database.

  11. In the Node-Red flow configure the “Query date from json BD - Set Date correct format”, here you need to add your database in the msg.topic. Where you see “soiot.json” replace this with your database and table name.

  12. In the Node-Red flow configure “DB to json” here in the Database dropdown you should see tor database, if not Deploy your flow and then re-check and see if it is there and select it.

  13. In the Node-Red flow configure the function node “Decoder ****”, in my flow I have two different GPS nodes decoders, as I use both Abbeway and Digital Matters GPS nodes. You need the change the “On Start” to suit your device decoder.

  14. Deploy your flow, now you need to wait and get some GPS date into the DB so you have date to recall. This will take some time, dependant on how often your nodes report in.

Usage

There are one user interfacing areas, Date Selection, you select the “date from” to “date to”.

Date Selection

There the user via the dropdown box the “date from” and the “date to”, selects “SUBMIT”.

Now the flow queries the DB and returns the data and plots on the map. It will plot the location of were the node were, the link path and the gateway connected to. The node and link colour is relative to the rssi.

You will note that sometimes the uplink were received by more than one gateway from the node. Here you will see that from one node location there are multiple links, each link will still be relative to the rssi, but you will only notice a plot with a number for the node. If you select it, all the plotted node points will pop up, by selecting one you will be able to see the uplink rssi and the gateway information.

You will also see all the “raw” data in the table from the DB.

Demo

Demo

Flow

Demo

Roadmap

See the open issues for a list of proposed features (and known issues).

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Project Link: https://github.com/JohanScheepers/ TTN-Node-Map

About

TTN Map - Maps all your GPS nodes and uplinks to gateways

License:MIT License