open-austin / project-ideas

:bulb: A place to collect ideas for Open Austin projects
183 stars 25 forks source link

Bus tracker hardware #63

Closed luqmaan closed 5 years ago

luqmaan commented 8 years ago

What problem are we trying to solve?

CapMetro publishes vehicle positions every two minutes. This is better than nothing, but in an ideal world we should have updates every five seconds. Because CapMetro uses the LCRA radio system to publish vehicle positions, ~2 minutes is the max frequency for every vehicle to report its position.

Lets try building some hardware to monitor the bus positions ourselves. This doesn't seem completely impossible:

The ultimate goal of this project idea isn't to build something production ready. It is to build a prototype/proof of concept and see what opportunities arise.

Who will benefit (directly and indirectly) from this project?

People who use the bus and need to know where the bus is.

Links to any research/data available/ articles

Code for Miami has started already: https://github.com/herrdragon/busTrackingGps

What are the next steps (validation, research, coding, design)?

Research.

What help is needed at this time?

scascketta commented 8 years ago

Ignore this, see the comment below:

I started working on this idea this week. I've got an old Raspberry Pi Model B+, a USB GPS receiver, and a USB 3G modem. I'm working on a Go program to use a publish-subscribe protocol called MQTT to send updates to AWS IoT (which has a managed MQTT broker) every 5 seconds. AWS IoT can then forward the updates to DynamoDB using its rule system, and we can write a Lambda function to consume the updates from DynamoDB and produce a GTFS-realtime feed containing vehicle locations.

Communicating with the GPS receiver is quite easy using gpsd, a daemon that provides, among other things, a JSON interface for the GPS data on a local Unix socket.

Powering the Raspberry Pi is pretty straightforward, any USB battery that provides enough amperage for the board and the accessories would be sufficient. I think 2 amps is the minimum necessary. Someone has measured power consumption for a variety of Raspberry Pi models.

Establishing connections with the 3G data modem is a bit trickier. I've been able to use Sakis3g to connect to the Internet over Ting's network but I've had issues getting it to persist connections in the event of signal loss or system reboots. I could really use help with this part, if anyone has experience with this. With Ting's rates, using 500MB/month would cost $18/mo.

In the future, I also want to make reproducible Raspbian images with the GPS update daemon and 3G scripts baked into the image. To start with, it's easy enough to just make an image of the Pi's SD card, and then distribute that, but ideally we could customize the Raspbian unattended net installer.

scascketta commented 8 years ago

...or we could use a cheap Android phone and just write an Android app to speak to AWS IoT, and let Android do all the hard work with cellular data connections and GPS. Chime in if you have Android experience.

The Android app can use MQTT to send updates to AWS IoT (which has a managed MQTT broker) every 5 seconds. AWS IoT can then forward the updates to DynamoDB using its rule system, and we can write a Lambda function to consume the updates from DynamoDB and produce a GTFS-realtime feed containing vehicle locations.

scascketta commented 8 years ago

I built a scrappier version (repo) of what I posted above a couple weeks ago. The location tracking works fine (simple to begin with). Instead of using MQTT to contact AWS IoT, it's now just HTTP -> API Gateway -> Lambda -> DynamoDB. The next steps are:

Oh also, with some input from @luqmaan, I emailed CapMetro for their feedback on this idea back on April 2nd, 2016:

I've been thinking about how to report vehicle positions more frequently, for example, every five seconds. I've set up some proof of concept hardware: https://github.com/open-austin/project-ideas/issues/63. But before I work on this more, I'd like to know what you think of the idea. What are the bureaucratic barriers? What are the technical barriers? Do buses have anything like a AC/DC outlet or USB port onboard? I'd really appreciate your feedback on this idea.

I pinged them again today and got a response:

Capital Metro is not interested in pursuing additional CAD/AVL hardware that would not integrate with our existing systems at this time. We are working to improve the polling rate of the vehicles in the coming fiscal year and hope to continue to improve our service and the availability of our data. Unfortunately, we cannot allow any third party devices to be installed on our vehicles.

3vivekb commented 8 years ago

At the @vta the CAD/AVL system produces gps info 90 seconds slow (over 1080 baud modems) but they pump their numbers into some proprietary Trapeze / Xerox software that made rather decent predictions. Not every two minutes mind you.

Instead though the buses got a Icomera/Moovit wifi routers installed that gives instant gps and speed data. And we're gonna build our real-time off of that.

TLDR: maybe it's not a question of improving their CAD/AVL but instead tapping into their wifi provider?

luqmaan commented 8 years ago

Trapeze / Xerox

Thats what CapMetro uses as well.

tapping into their wifi provider?

Most of the routes don't have WiFi unfortunately.

mscarey commented 5 years ago

Closing this because I think y'all succeeded in proving your point with this project.