GithubHelp home page GithubHelp logo

iotgod / ttn-tracker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kizniche/ttn-tracker

0.0 1.0 0.0 5.44 MB

Download GPS data transmitted to The Things Network for live display on a map

Home Page: https://kylegabriel.com/projects/2019/04/lorawan-tracker-and-mapper.html

Python 0.72% JavaScript 96.94% CSS 1.50% HTML 0.66% Makefile 0.01% Dockerfile 0.06% Shell 0.12%

ttn-tracker's Introduction

The Things Network Tracker (TTN-Tracker)

This is a Flask app served via Gunicorn and Nginx using docker containers orchestrated by docker-compose.

For use with TTN Mapper nodes such as kizniche/ttgo-tbeam-ttnmapper for the T-Beam TTGO (tracker node), which transmits data to The Things Network (TTN) for TTN Mapper.

This app pulls coordinate data acquired from the tracker node that's been stored on TTN. It stores these coordinates in an SQLite database and displays the coordinates on a leaflet map in your web browser. This is useful for testing the signal range from LoRaWAN gateways while driving, so you can see when and where your signal was able to reach a gateway.

This is very similar to the TTN Mapper frontend, however TTN Mapper takes a long time to update the data points on its map. This software runs locally on your own hardware and responds instantly to new data on TTN when the browser page is refreshed, making it a good companion in your vehicle if you want to get instant updates as to whether your tracker node successfully transmitted its coordinates or not.

TTN Tracker 01

Web browser view of TTN Tracker with the gateway (blue marker) and points where the tracking node successfully transmitted to the gateway (red marks).

Platforms

Successfully built this on the Raspberry Pi (Raspbian Buster) and a desktop PC (64-bit Ubuntu 18.04.2). However, since this is docker, it should run on a variety of other platforms.

Features

  • Multiple map layers, including topology, streets, and satellite (Bing API key required for satellite)
  • Automatically acquires new data and adds markers to the map
  • Tracking tool to use device GPS to place marker of current position (and direction) on map
  • Scale bar at edge of map
  • SSL/HTTPS (required for location tracking)
  • Measuring tool for measure distances between points
  • Map stays focused on the same point across page refreshes
  • Clicking gateway or data point markers pops up information about them

TODO

  • Add user-configurable auto-refresh

Install

Make sure you have your application set up on The Things Network with the integration "Data Storage". The integration "TTN Mapper" is optional but is recommended to be able to provide signal data to the public.

Install dependencies

sudo apt-get install libffi-dev libssl-dev

Install docker and docker-compose

curl -sSL https://get.docker.com | sh
sudo pip install docker-compose

Add user to docker group

sudo usermod -a -G docker YOUR_USER

Then log out and back in again.

Clone this repository

git clone https://github.com/kizniche/ttn-tracker.git
cd ttn-tracker

Edit the config file

Edit ttn-tracker/flask_app/config.py with your application API Key, application ID, Device ID(s), gateway location(s), and Bing map API key (optional) before building the docker images. If you need to edit this file after the images are created, you can rebuild the image (destroying data) or copy the new config file over the old file while the flask_app container is running (see Notes, below).

nano flask_app/config.py

Build and start the services

make build

Access the app

Open a web browser to the address, below, replacing IP_ADDRESS with the IP address of the system running the docker containers.

https://IP_ADDRESS/dsf673bh

Note: there is no security preventing someone from viewing this page if they happen to request "/dsf673bh" on the server (however, knowing this is the page is unlikely). Therefore, make sure you are comfortable with this or implement your own security measures such as not allowing port 443 to be publicly accessible (connect to your home network via VPN to access the app) or add a login system such as Flask-Login.

Notes

Stop services (preserving data)

docker-compose stop

Start services

docker-compose start

Stop services and delete data (keep containers)

docker-compose down

Stop services and delete containers

docker-compose rm -fs

List docker containers

docker ps

Start a shell in a docker container

docker exec -i -t CONTAINER_ID /bin/bash

Copy a file to a docker container

docker cp ./foo.txt CONTAINER_ID:/foo.txt

Copy a file from a docker container

docker cp CONTAINER_ID:/foo.txt ./foo.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.