Skip to content

A real-time public transit status IoT device built with Node.js, the OneBusAway API, and a Tessel 2

License

Notifications You must be signed in to change notification settings

robatron/OneTesselAway

Repository files navigation

OneTesselAway: Real-Time Public Transit Status IoT Device

A real-time public transit status IoT device built with Node.js, the OneBusAway API, and a Tessel 2.

I built a real-time transit IoT device that tells me when my next bus will arrive. Built with Node.js, OneBusAway, and the Tessel 2. Why? Because constantly checking my phone and the OneBusAway app every morning while waiting for the bus was annoying. I also wanted to challenge myself by learning new hardware programming and electronics assembly skills.

👉 To learn more about this project, please see Building a Real-Time Public Transit Status IoT Device.

Photos

A couple photos of the project. For more, see the blog post.

The device itself. Bus #11 left 2 minutes ago, but there are other ones coming in 11 and 26 minutes.

The web UI which features real-time simulated hardware, advanced device controls, device logs, and more. It can also be run in "web only" mode which uses a full set of mocked hardware. By default, it runs on port 8080. To learn more about the web UI, see the blog post.

Development

Here's how to develop on the OneTesselAway device and/or the web UI.

Prerequisites

  1. Request a OneBusAway API key. (This step can take a few days.)

To request an API key for the Puget Sound One Bus Away data send an email to oba_api_key@soundtransit.org. Please include the first and last names of the contact person, email address (if different) and acknowledgement that you have read and agree to the Transit Data Terms of Use. Please allow two business days for processing requests.

  1. Put the API key in a file called oba-api-key.json at the root of the project under an apiKey property.
{
    "apiKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
  1. Install NVM
  2. Use nvm use to activate the latest version of Node supported by the Tessel
  3. Install the Tessel 2 CLI

Run the Web UI from your Computer (No Device Required!)

You can run the OneTesselAway Web UI from your computer without any hardware at all.

npm start

You can use the following environment variables to configure how the Web UI runs.

  • WEB_UI_ADDRESS - The address on which to run the Web UI
  • WEB_UI_PORT - The port on which to run the Web UI

E.g., to run the web UI on a different port:

WEB_UI_PORT=8081 npm start

Start OneTesselAway on the Device from your Computer

You can run OneTesselAway on the actual Tessel 2 hardware when connected via USB. This will start the device and the Web UI.

npm run start:device

Deploy OneTesselAway to the Device

You can deploy and run the code on the Tessel 2 hardware. (Deploy is via USB by default.)

npm run deploy

Todo

  • Make mock endpoint
  • Fix alarm (why doesn't it turn itself off?)
  • Wait between calls to OBA
  • Helper for update events
  • Make mock hardware utils
  • Clean up hardware pins
  • Stagger hardware callbacks, or at least let buzzer update on its own
  • Fix startup tune: LCD message and delayed tune
  • Allow songs to be changed via Web UI
  • Fix mobile view for web ui
  • Docs: Add link to blog post when it's done
  • Docs: Match title and subtitle w/ blog

References

About

A real-time public transit status IoT device built with Node.js, the OneBusAway API, and a Tessel 2

Topics

Resources

License

Stars

Watchers

Forks