Git Product home page Git Product logo

chollinger93 / tinytelematics Goto Github PK

View Code? Open in Web Editor NEW
19.0 4.0 4.0 2.99 MB

Track your vehicle's live location offline by using little more than a Raspberry Pi & a gps dongle, without expensive subscription services.

Home Page: https://chollinger.com/blog/2022/08/tiny-telematics-tracking-my-trucks-location-offline-with-a-raspberry-pi-redis-kafka-and-flink-part-1/

License: GNU General Public License v3.0

Python 58.90% Shell 11.24% Dockerfile 1.55% Scala 28.31%
gpsd linux flink gps kafka python scala superset hacktoberfest

tinytelematics's Introduction

Tiny Telematics

Version Forks Stargazers Issues MIT License

Track your vehicle's live location offline by using little more than a Raspberry Pi & a gps dongle (aka "Tiny Telematics"), without expensive subscription services.

Introduction

Tiny Telematics is an application stack consisting of a Raspberry Pi client and a Apache Flink based backend that communicate via Kafka and cache data via redis.

Once running, Tiny Telematics can track your vehicle's location with reasonable accuracy, and doesn't require expensive subscription services or in-vehicle WiFi.

image-20220829125026749

More details can be found in architecture.md.

Client Setup

The client runs best on a prepared Raspbian image. You can find the steps to build this image here.

This image contains -

  • All gpsd dependencies
  • Python 3.8.13 w/ poetry
  • redis w/ a systemd service
  • docker

Docker

This does not work on armv6! This is the easiest route to deploy.

Make sure you expose your host network & the appropriate device in /dev.

# For local development, start a local kafka and redis instance
#docker-compose up -d 
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
# Build and run
docker build -t tiny-telematics .
docker run -v $(pwd)/config:/config --device=/dev/ttyACM0 --net=host --restart=on-failure:5 tiny-telematics --config /config/default.yaml

If you want to build a multi-arch image for a Raspi (armv7 or arm64):

❯ docker buildx create --name cross
❯ docker buildx use cross
❯ docker buildx build --platform linux/amd64,linux/arm/v7 -t tiny-telematics:latest .

Server Setup

Flink

See flink/README.md

MySQL

See flink/README.md

Kafka

See docker-compose

Development

Please see development_setup.md for details. tl;dr: gpsd, poetry, python 3.8.13.

Run Unit Tests

poetry shell
poetry run pytest tests -v  

Run

poetry shell
python3 tiny_telematics/main.py --config config/dev.yaml
# or sbin/run_client.sh - will ask for sudo to setup gpsd

History

I built this over the years in three different iterations - Hadoop, AWS IoT Greengrass, and what you're looking at now - for my blog. The most recent iteration is what I consider stable and usable and what I daily drive in my truck. The older git tags are mostly to accompany the older blog articles.

opener

License

This project is licensed under the GNU GPLv3 License - see the LICENSE file for details.

tinytelematics's People

Contributors

chollinger93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tinytelematics's Issues

Question: Differentiating btween lamba and spark architectures

Hey there!

Really enjoyed your article on Towards Data science! Great explainer on the arch and shows the scope of all the diff moving parts quite well.

One thing that might be helpful for other peeps coming to this repo would be separate branches (or other repo, what have you) with the the spark and aws setups respectively. At a glance it's kind of confusing to see what elements are for which config.

That said this is a pretty sweet project and ref point for peeps trying to dig into these tools!

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.