Finally started using my Raspberry Pi! I built a bus clock to know when to leave the house and never miss the bus again. Wrote this little post to share the details and some pictures.
It’s sad because I desperately want a raspberry pi or two for some projects I’ve been kicking the can on, but I simply can’t get them for anywhere close to MSRP. The shortage hurts.
I haven't closely monitored the situation for years now, but it used to be the case that OS/software support for anything than a Raspi was often spotty at best.
With a Raspi, you not only have Raspian/RPiOS that fully supports all models back to the first one from 2011, but a decent number of really good alternatives like Fedora, Ubuntu and special appliance variants, e.g. for console emulation etc.
In contrast, my last experiments with some other SBCs consisted of downloading some ancient ISO files of questionable provenance from some shady .cn domains. It might have gotten better, but one should carefully investigate the software situation before buying a non-RPi SBC.
It depends on your level of expertise and how comfortable you are straying from an online guide. It's just a small matter of computer engineering, for different difficulty values of "just".
This is getting significantly better and fast - largely due to RPis being unavailable for 2 years and growing (and won't get better anytime soon). Odroid's ecosystem is quite a bit better these days. I highly recommend getting an XU-4 from Ameridroid or HardKernel themselves (my last order arrived within 10 days from South Korea to the west coast with zero customers issues) for a fraction of the RPi 4 MSRP cost (much less what it actually costs now) and tinker.
Ya know, I just realized I missed the Thursday batch of Pi4s and got to thinking about my ODroid C1. I have generic USB cables and chargers laying around but I still don't know where my non-standard C1 charger went.
The last time I made this sort of comment one of the top replies was that Pis are notoriously picky about their power supplies. Be that as it may I've not run into any trouble with my Pis (Zero W + 3B). Hence I'm using my Pis while my C1 sits unused.
I have one or two I’ll sell you below MSRP. I don’t use them anymore (barely did did to begin with). Email is in my profile. I just sold a Remarkable2 eink tablet to another HNer this way!
Yea I was surprised with that one too. It wasn't my local station but I think that sometimes happens when it's a busy station at a busy time so they have more than one bus. Or it might be a bug.
Not very surprising to me that they'd start bunching by Bethnal Green tube having all just been slogging their way through Mare Street in Hackney, honestly
Wow! I wasn't expecting this at all. Thanks for the cozy hug of death :) Also, thanks for posting the archive link! I'll try to make it more resilient for the future.
The problem I’ve faced is that the official live update arrival times are often wrong.
I’ve fantasized for years about engineering a network of self contained + solar powered microcontroller / camera units that I could place on top of bus stops to track them myself.
Then again, by the time I get around to it the official arrival times will likely have become more reliable.
It’s a fun problem. We hire 4 trolleys for our open studio event in Somerville. One of our volunteers bought some smart phones, and we pulled a together a php and MySQL back end, some google maps and Trolley Tracker. We can see them bunch up over the course of a day.
A lot of transportation services have tracking now.
Why is the live data wrong? Why is it called live data, then? HH
For example, here in Prague, trams always arrives on time schedule or few minutes after that. (you can wait 2minutes lol)
Also all of our public transport has publicly accessible GPS tracking. Buses are more off of the time schedule, but you can check the GPS and compute the live time.
And subway doesn't make sense to track, since it arrives every few minutes at any station.
Ha! I should have specified, I’m in the US- I think it’s a large number of factors that ultimately boil down to “there’s no incentive to be accurate” our buses are often 15-30 minutes late.
I don’t think this is very typical, but I have even had a bus driver stop mid route, say “this is as far as I’m going today”, kick everybody off, and drive away
Ha! me and several engineers from Lockheed built just such a thin in 2007 -- but we couldnt get funding for it (we built the RFID tracking system for the military) but we were too early for the market at the time and people werent educated about tracking so we go rejected all over....(it was for fleet operations - we built the tracking systems for all weapons shipments and containers for the military at the time.
This sounds epic! How did you handle powering the devices at night / rainy days? A battery presumably.. but seems like that would seriously up the maintenance cost.
You would have to replace the batteries fairly regularly and I have a feeling that without funding anything I cowboy rig would be super flaky.
2007 means that the network would probably have been an issue as well. Though, I’m less worried about that these days.
The network problem was an issue in 2007 - and so we were working with cell companies to get sim cards and a deal - but that was really difficult because cell plans were still super expensive and this was a novel startup.
There are two types of RFID [active|passive] active required a battery which was rather small but the pings were so low power that the battery lasts a really long time.
We pivoted and built a tracking system for the cannabis industry - but cannabis growers didnt want to pay for anything they werent legally mandated to do so - we built a system called GreenScale which could track all employees in your growfields, bins etc... but again we are a bunch of engineers (my partner designs and builds the crazy sensors for TDK currently but designed the sensors for Google's RF hand sensors)
However, currently, we have a medical tracking system we have built for elderly care which integrates with Alexa and will tell you where your elderly care person is, if they accessed the restroom, if they fell... etc - but its based on a custom Ras PI basically and it uses RF as opposed to video etc with highly sensitive pressure sensors and other metrics to determine human action in a room....
When I was Director of OPs for Cognitive networks we buil spying bullshit on every single Vizio (and a couple other brands) TVs and could get a screenshot from any single TV connected to the internet...
We were always 5 years too early with our designs... and then all sorts of companies got founded upon things we were already doing 5 years prior... but people didnt undersrtand wtf we were trying to do and we are nerdy engineers and not salesmen so had a shitty time trying to get people to see our visions...
One of my partners now in eng manager at netflix instead.
The Transit App [1] crowdsources position data for vehicles. It's a gamified thing that rewards you with points or whatever for leaving the app running with your GPS on while in motion. This lets them have up-to-the-second knowledge similar to how Google Maps running on phones gives Google live traffic data around the world.
True, but I think part of the point is that the GTFS data is subject to the technical competency of your local transit agency, and that seems to vary widely— sometimes they lie about where vehicles are, or pretend that schedule-inferred positions are GPS positions, or they're missing vehicles, or the data is delayed, or whatever.
When Transit captures this information from their own users, it's much more trustable— basically all they'd have to watch for is someone maliciously poisoning the data by telling the app they're on a bus when they're really in a car, but that would be a lot of effort to go to just to be a jerk and end up shadowbanned.
Arrival time estimates are really difficult. I much prefer being able to see where the vehicle is on a map and make my own decisions, based upon my own experiences.
However, I played around with one provider (Availtec's) estimations for Birmingham, AL's bus system.
This looked at the GPS position of the vehicle to see when they actually arrived at a stop and back compared it to the running estimation time. As we can see, it isn't great.
In London? They're usually quite accurate - used to be tracked by roadside beacons so had less resolution but now it's all GPS I think.
Of course sudden traffic, letting an elderly passenger get etc will mean that the countdown won't be the same to the second. But that's going to be the same if you used roadside cameras too.
Generally it should be seen as more of an estimate based on how long the last bus took to arrive from the same point rather than an exact prediction but it's usually useably accurate in my experience.
Yea so far they are mostly accurate but there have been one or two occasiones with minor delays. I didn't know they used to have roadside beacons :| How did those work?
If you’re interested in this you might also be interested in a project I’m currently involved with.
There’s a legal obligation in the UK for bus operators to supply live vehicle location positions and static timetable data to the Bus Open Data Service here : https://data.bus-data.dft.gov.uk
For a minute, before following the link, I was thinking 'why not just look up the schedule? And, did you leave a RasPi on a bus?! Those things are like $200 now! Maybe you can get it back at the bus depot...'
In some areas, it would be necessary to somehow install trackers on your busses that you use. Depending on the jurisdiction, I've had to deal with busses either being possibly 10 minutes early, or missing their stop time by up to half an hour.
I love these types of projects. Being able to automate or make a daily chore easier is so liberating.
As a public transit user, I too have written a dashboard for my transit system on top of the smashing dashboard. It runs on a raspberry pi hooked up to a TV in my front room.
As others below have complained about arrival estimations being unreliable (or these days where we are low on operators and have a bunch of ghosts buses!), I found having a map with real time location gives me a better idea when I should leave:
I'm amazed at my own programming progress over the past 10 years. I used to read these posts in awe of how people knew how to do such fascinating things that seemed so magical to me. 5 years ago I got myself a raspberry pi and an Arduino starter kit and just started playing around with them. I learned python by practicing on leetcode and other sites and I'm able to recognize a lot of libraries and patterns in his code. It's a bit less magical but I have a much more refined appreciation for posts like this.
Next step is realizing that most code is a liability and you will begin to loathe anything "smart". I'm at this step right now. I'm curious if any graybeard out there can share what the next step is.
This is extremely accurate in my experience (besides trusting only myself, I don’t even trust myself). In general, the engineers I work with are much less “techie” than a lot of people I know outside of work.
If only the Chicago CTA api was close to reliable... It's well known for the ghost buses and disappearing trains. However we wouldn't probably need to call Apis, just refreshing their website would work as it's similar to OP's (or Google maps or any other using the apis).
The best solution here would be to secretly implant a RPI zero with gps into every bus
Yeah my apt complex sucks, doesn't accept deliveries and FedEx doesn't have tracking like Amazon does. Usually I try to change the delivery address to some hold location but sometimes not possible.
It was a lazy update every 5 seconds loop/webpage updates image url with time query. Not great but did it's job.
Re future work "It bugs me that I’m fetching this information every 30 seconds even though most of the time I won’t use it":
Take a look at Home Assistant, which runs nicely on the same hardware. You get a reasonably capable platform that knows when you're home and can be told a schedule, so you can then limit the checks to times when you'll actually need to know.
I think that the platform is more than reasonably capable.
Either your usage fits into one of the zillions integrations (especially via HACS), or you can easily build something alongside with pyscript.
The state machine in HA is excellent, I use it for unrelated projects instead of a bus or something like that.
The UI is good and is getting better. I wrote years ago my own dashboard (that uses data from HA, among others) but I am slowly getting used to the idea that I may simply replace it with a full-screen page from HA's UI (especially when I manage to have widgets written in Quasar/Vue running correctly)
I just took a quick glance at the specs, and sure... running an lcd and parsing some text from the web seems totally doable, and in contrast to RPi (3, 4...), you can actually buy picos :)
Now if only this could be done for public school buses that never show up at the same time. Younger kids are required to be dropped off/picked up in the presence of an adult, but one is often left out in the cold/snow/heat/whatever for far too long wondering if the bus will ever arrive, or if they were already passed by.
Small UX idea: what you really care about is not when the next bus arrives, it’s “can you make it?” Of course, you can arrive at the latter from the former, referencing the current time, and roughly how long it takes to get to the bus stop (with reasonable buffer time).
Or you can do this work in code, and put a countdown timer beneath each bus time (such that you walk out the door before time expires and you will make it).
I have a tablet mounted on the wall which displays different kinds of stuff, like weather conditions and forecasts and so on.
Among this is the time of civil dawn, because at this time I don't want to be riding bike anymore since it's getting dark (and colder).
Next to it is a countdown timer with an offset of minus two hours, since I do ride my bike around 1 to 1.5 hours. So when I see that this timer is reaching 0, I know that I'm at my last opportunity to go for a bike ride that day. Once it reaches 0, it shows the countdown to the correct, non-offsetted time of civil dawn, but in another color, so that I know that I still have time to make a shorter ride.
I barely look at the time of dawn, since the countdown timer is so much more informative for me. It let's me know how many hours or minutes I still have to do things.
My dream UX for that is a single ambient led ranging from green to red, but making it overall usable counting we're two, using two different trains, with different WFH schedule is rather complicated
> you can do this work in code, and put a countdown timer beneath each bus time
Some years ago there was a student union at the university where I was studying. We had a space dedicated to us in one of the buildings near the campus area.
Some of the members wrote a program to retrieve subway departures and show them on a screen in our space.
The authors of said program made it simple but friendly. It would show all upcoming departures from the subway station, with the number of minutes until departures, and color coding.
A countdown with green color coding meant that you were likely to make it since there was a lot time left.
Orange color meant that you’d have to hurry up and go to make it.
Red meant that you’d really have to run, and that even then you might not make it.
Very handy system, especially for late nights when you had to pay attention so that you’d get on the last subway for the night that would take you home.
I loved that student union. Easily the best part of studying at the university for me was being a member of that student union. I have so much in my life to thank for the experiences I made from being a member in that student union :D
This is exactly what Web Out Of Browsers (https://woob.tech/) aims to do: get information stored in websites, and offer a programmatic way to use them.
There is an application called woob travel that shows timetables: https://woob.tech/applications/travel. It plugs back ends, each of which is a website. Once parsed, the data is programmatically available for anything.
Yes a web scraper. But it's not (just) an end to end scraper: it gives you easy access to the data so you can do whatever you want with it. Display a table for easy consumption, store it in graphite for historical data, ring a bell when a threshold is reached...
For a moment i though he did a solution for the «ghost buses» . I always used the bus app and it works fine untill, from time to time, you turned 2/3 minutes before to the bus stop, timer goes down, then says due…. And disappears!!! And no bus pass, trust me, i question myself several times. The 254 is a common offender of the “ghost buses” :)
While this is a nice project, it's basically just simple web scraping. I was hoping for something a bit more interesting, like decoding the radio signals for the bus stop displays[0] and using that data. If it's available from an API it of course makes more sense to use that though.
Or setup a RPi camera, with OpenCV and recognize your bus while it's around the corner 2 streets before coming to the stop so you know you'll have a full minute until it gets there. I mean a 30 meters pole on top of your house isn't something that hard to do. And the programming of that is so much more fun that just the web scrapping. Plus is actually more accurate than a web scrapping that can have de-synchronizations between that and the real bus.
I'd been exploring a similar project a few years ago, and ended up making a map that showed the location of buses along the routes I tended to take. I was pretty happy with it...except for the fact that it was built for the town (Duluth, MN) I went to school in, and I didn't get it finished until finals week of my last semester, and I left town immediately after!
That board deserves to be on display at City Hall or something. Inspiring work and I lament with you that you weren’t able to use it more than a few days.
Thanks! :) I definitely thought about seeing if I made a polished version, if I'd be able to sell a copy to the local transit authority, or something. But it made for a great conversation piece, and was tons of fun to build, so it's definitely a success as far as I'm concerned.
Small world. I did this on behalf of BlirpIt for UVM back in 2009 or so. We had trackers on each bus, and they would report location on a certain interval, or whenever the speed changed by a certain threshold from the speed at last report. We had server-side geofences on each bus stop, and defined a "route" that was just a chain of stops, and then we stored a moving average of time between each pair of stops and that was about it. One of the more fun projects I was doing back at that time!
I think the biggest difference is that I wrote my version as a web app without any backend (it gets data from a REST API + a hardcoded schedule as a fallback), so that I could host it on GitHub pages and display it on a cheap Android tablet. I still use it every day and am glad that I made it :)
I recently moved to Belgrade, Serbia and found out that Google Maps are giving sometimes inaccurate data about public transit. All locals are saying that they are using Moovit app. And that app on Android has a widget showing next bus/tram/trolleybus: https://imgur.com/a/OsDyLIR
In February 2020 I did almost same: used beautiful soup to parse njtransit's arrival time website to send a push notification to my phone about 10 minutes before bus arrives to my stop in the morning, so I had enough time to get there. Unfortunately, something happened that year, which forced me not to use bus any more.
> It bugs me that I’m fetching this information every 30 seconds even though most of the time I won’t use it.
You don't have to. If the program knows that the bus is 20 minutes away, it could wait 10 minutes or so before doing a refresh (assuming the bus doesn't magically gain a lot of speed in the meantime).
These are my favorite kinds of projects. Not some major disruptive application, just a tiny project that solves a real problem for a real person. Great job OP!
I had this exact idea more than 5 years ago, but the only thing my city provided were horrible PDF timetables. No GTFS, not API, not even an easy to scrape HTML table. Ever since then, my constant side project has been to create a hub for transit and other mobility data from all providers in the country (Slovenia) and just this year, all the work has started coming together.
That stupid bus clock will become not only possible, but trivial to build in just a few more weeks. It took a many meetings with company executives and government officials, freedom-of-information requests, hours of reverse engineering apps and subsequently arguing with lawyers... I accidentally stumbled onto two entirely separate multi-million-euro cases of clear corruption in public tenders, several CVSS >= 7 vulnerabilities, got both job offers and legal threats (once from the same company) and throughout the process learned more about multiple different CS fields than I did about even a single one in 3 years of university.
So if anyone else wants to build such a clock, but is disappointed that their local bus company doesn't have an API, don't be discouraged. There is always a way. It might cost you a year's worth of free time and most of your sanity, but you will end up with some shiny LEDs on that wall that still won't prevent you from missing the bus and a bunch of extremely niche knowledge. 10/10 would recommend
reply