# wireless-fleet-tracker **Repository Path**: mirrors_twilio/wireless-fleet-tracker ## Basic Information - **Project Name**: wireless-fleet-tracker - **Description**: 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. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-10-22 - **Last Updated**: 2025-09-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 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: * 1x [Twilio Programmable Wireless SIM](https://www.twilio.com/wireless) * 1x [Programmable Wireless Starter Pack](http://bit.ly/2fJXrnE) * 1x [OBD-II adapter](http://www.semiconductorstore.com/cart/pc/viewPrd.asp?idproduct=70453) * 1x [GPS antenna](http://freematics.com/store/index.php?route=product/product&product_id=83) * 1x [RF antenna](http://www.semiconductorstore.com/cart/pc/viewPrd.asp?idproduct=70343) * 1x [Arduino header pins](https://www.amazon.com/2-54mm-Breakaway-Female-Connector-Arduino/dp/B01MQ48T2V/ref=sr_1_4?ie=UTF8&qid=1505424045&sr=8-4&keywords=arduino+header+pins) # 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 - Build [twilio-runtime-utils](https://github.com/hellwolf/twilio-runtime-utils) with `make build` - Setup PATH to twilio-runtime-utils.sh shell script - Checkout `twilio-connected-devices` branch of [wireless-co-pilot](https://code.hq.twilio.com/zmiao/wireless-co-pilot/tree/twilio-connected-devices) ## 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](https://developer.mbed.org/) 2. Visit the [Dragonfly Fleet Tracker repository](https://developer.mbed.org/users/miaotwilio/code/DragonflyMQTT/) 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](https://www.twilio.com/wireless/blueprints/fleet-tracker/).