Giter Club home page Giter Club logo

wireless-fleet-tracker's Introduction

Fleet Tracker Blueprint

Disclaimer: The blueprints and information made available on this page are examples only and are not to be used for production purposes. Twilio disclaims any warranties and liabilities under any legal theory (including, without limitation, breach of contract, tort, and indemnification) in connection with your use of or reliance on the blueprints. Any liabilities that arise in connection with your use of these blueprints shall solely be borne by you. By accessing and downloading these blueprints, you agree to the foregoing terms.

Problem Commercial vehicle fleet managers are required by law to track various driver and vehicle behaviors. Beyond the data logging mandated by law, there are other behaviors that employers might want to track. If they had a low-cost, reliable, and technical monitoring solution, they could remove or minimize the risks associated with their fleet management.

Solution We will create a Twilio-powered Fleet Tracker that uses off-the-shelf components to track and log: miles driven, hours of uptime and downtime, locations, average speed, and fuel consumption.

Degree of Difficulty (1-5): 2 This device requires some knowledge of the C programming language, microcontroller basics, and GPIO wiring.

What You’ll Need

Before we get started, here's a quick overview of what you'll need to build the Fleet Tracker:

Electronic Components In order to build your own Fleet Tracker, you'll need the following items:

Fleet Tracker Blueprint Development Flow

Serverless Twilio Fleet Tracker involes 3 separate development process

  • Twilio Runtime Functions
  • Angular Single Page Application
  • MultiTech Dragonfly hardware

Prebuilt Assets

If you do not want to build everything yourself, you could skip all steps related to building assets, and take artifacts and instructions from https://github.com/twilio/wireless-fleet-tracker/tree/serverless/assets directly.

Preparations

Developing Twilio Runtime Functions

Test function locally

Go to runtime directory.

$ twilio-runtime-utils.sh -c context-local.yaml run Authenticator/descriptor.yaml Authenticator/testdata/simple.yaml 
{"success":true,"username":"twilio","ttl":3600,"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTSzI2MzQ3MTM2N2E0OGI2Yjc4NjEyZTQyYzA5ZmFkNmI3LTE0OTUyMDQ5NDkiLCJncmFudHMiOnsiaWRlbnRpdHkiOiJ0cnVtcCIsImRhdGFfc3luYyI6eyJzZXJ2aWNlX3NpZCI6IklTYzg5NThjOGIzODNmZmM2YjhkMTc2ZmJlYmViMWE1YTkifX0sImlhdCI6MTQ5NTIwNDk0OSwiZXhwIjoxNDk1MjA4NTQ5LCJpc3MiOiJTSzI2MzQ3MTM2N2E0OGI2Yjc4NjEyZTQyYzA5ZmFkNmI3Iiwic3ViIjoiQUM3OTMzOTk2M2E5OWY0NzZlNmYwYjMyMTRhYmQ0OGE5ZCJ9.IPQ5QTkTacXaQ4YI4nifii_yrabI5Fk5gzYse8M4tT4"}

$ twilio-runtime-utils.sh -c context-local.yaml run FleetManager/descriptor.yaml FleetManager/testdata/list.yaml  

$ twilio-runtime-utils.sh -c context-local.yaml run FleetManager/descriptor.yaml FleetManager/testdata/add.yaml  

...

Deploy function

Currently twilio runtime RESTful API is not available, manual deployment process is needed. However you could follow instruction generated by the following commands:

$ twilio-runtime-utils.sh -c context-local.yaml deploy FleetManager/descriptor.yaml 

$ twilio-runtime-utils.sh -c context-local.yaml deploy Authenticator/descriptor.yaml 

Required functions

For Twilio Fleet Tracker, two functions are required:

  • Authenticator, token authentication for Admin UI
  • FleetManager, list/add/delete/genkey for vehicles

Developing Angular Single Page Application

Go to angular directory.

Run webpack dev server locally

$ npm install
$ ./node_modules/.bin/grunt dev

Build assets

$ ./node_modules/.bin/grunt build

Deploy assets to Twilio Runtime

Upload these files to Twilio Runtime assets:

$ ls -lh angular/build/assets/*.{js,html,js.map}
-rw-r--r-- 1 zmiao TWILIO\Domain Users 1.7K Aug 16 16:41 angular/build/assets/index.html
-rw-r--r-- 1 zmiao TWILIO\Domain Users  16K Aug 16 16:41 angular/build/assets/index.js
-rw-r--r-- 1 zmiao TWILIO\Domain Users  63K Aug 16 16:41 angular/build/assets/index.js.map
-rw-r--r-- 1 zmiao TWILIO\Domain Users 160K Aug 16 16:41 angular/build/assets/styles.js
-rw-r--r-- 1 zmiao TWILIO\Domain Users 343K Aug 16 16:41 angular/build/assets/styles.js.map
-rw-r--r-- 1 zmiao TWILIO\Domain Users 465K Aug 16 16:41 angular/build/assets/vendor.js
-rw-r--r-- 1 zmiao TWILIO\Domain Users 2.0M Aug 16 16:41 angular/build/assets/vendor.js.map

Developing MultiTech Dragonfly hardware

  1. Create an ARMmbed developer account
  2. Visit the Dragonfly Fleet Tracker repository
  3. Click the yellow Import into Compiler button
  4. Click the Import button

That's it! As a reminder, full instructions for this tutorial can be found in the Fleet Tracker Blueprint.

wireless-fleet-tracker's People

Contributors

jonedavis avatar

Watchers

James Cloos avatar Vivek B Gupta avatar

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.