GithubHelp home page GithubHelp logo

vinchu / bike-tracker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from toddmedema/bike-tracker

0.0 0.0 0.0 476 KB

Using the Particle Electron to get daily updates on bike lcoation

License: Apache License 2.0

Shell 0.20% JavaScript 1.40% C++ 97.98% C 0.42%

bike-tracker's Introduction

Bike Tracker

Worried about your bike getting stolen (or, something else valuable)? Want to be able to track your thief down and get your bike / car / tophat back? Then look no further!

This clever tracking device wakes up whenever there's motion, conserving battery life. Given an average bike use case (riding ~1 hr per day), it'll run forever with a small solar cell (see parts list).

Motion tracking outline:

  • Set your device name, allowing for multiple trackers on a single account (default: /sensor/toddbike)
  • Accelerometer wakes up the electron if the device moves in the 1-2G range (the onboard blue LED will also flash when it detects motion)
  • Upon wake (from motion or the long-sleep checking), it connects to the cloud and reports GPS every minute (ie /sensor/toddbike/g=40.53211,-40.23455)
    • since the GPS occasionally reports an invalid location even with a good signal, it continuously checks its location while on, and reports the last valid / good location at the check-in interval
  • Once the device stops sensing motion, it continues to report its location for 2 minutes (2 more reports), then goes to sleep for 8 hours
  • Publishes the battery status (ie /sensor/toddbike/b=3.94v80.1%) right before going to sleep, serving both as the "going to sleep" indicator, and allowing you to log battery state
  • Solar Cell optimization: If it wakes at <20% battery (not enough to start a cell connection, which draws a lot of current), it immediately sleeps for an hour; it'll keep trying this until it's above 20% (even at 20% battery, it should be able to keep doing this for 5+ days)

Parts list

To build your own bike tracker, you will need

  • A Particle Electron + Asset Tracker Shield. NOTE: Make sure to get the right cellular option for your country.
  • Optional: a more powerful GPS antenna and an adapter for that antenna
  • Optional: a solar cell - any solar cell will do, though the linked to one is nice because it fits on the rear rack of a bike, is inexpensive, and conveniently outputs 5v via USB. Note that it's rated for ~6 watts - if you get a solar cell with a smaller rating, it might not provide enough power to continuously power the tracker during the cold, dark days of winter.

Total cost: $110 - $170, plus $3/mo for the data plan

Setting up your tracker

First, register your Particle Electron with Particle, following their setup instructions. Then, install the particle-cli.

Then, you'll want to flash this code to your Electron. Start by putting it into DFU firmware flashing mode (yellow blinking), then run:

./build.sh
./flash.sh

Setting up your logging server

Once you have your Particle Electron up and running, you can run the logging server on your local computer to make sure it's all logging properly. To get that set up:

  1. Create a config.json JSON file with your Particle.com username and password
  2. Install node on your computer (v6+)
  3. In the project folder, run npm install to install dependencies
  4. Start the server with npm start. It'll log messages to the console, and also save them to events.log. If you want to get really fancy, you can deploy your server to the cloud via AWS, Heroku, etc.

Attributions and further reading

This project is possible thanks to awesome work from Particle and Adafruit, go buy stuff from them!

Related libraries and tools:

bike-tracker's People

Contributors

toddmedema 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.