beanz Magazine

Portland HOP

Shou-Hui Wang on Flickr

With these new high-tech cards, public transit is easier than ever.

Do you ever take public transit, like buses or light rail? If you do, how do you pay for it? Do you use tickets, cash, or something else? That may not seem like the kind of place where there’d be interesting technology and software, but in my city of Portland, Oregon, our transit system, TriMet, just rolled out a really cool new way to pay for transit fare that’s personally made my life a lot easier! That’s the Hop Fastpass system and I’ll be talking about it and the technology behind it for the rest of the article.

First off, I cannot drive so I need to use public transit every time I want to go somewhere that isn’t walking distance. Until last year, when Hop was rolled out, I needed to either keep cash on me or use the ticketing app on my phone: one meant frequent trips to the ATM to make sure I had something to use while the other meant that my phone had to be as charged as possible before leaving the house. Those aren’t terrible responsibilities, but definitely mildly stressful when running errands or going to work.

Using Hop, on the other hand, involves a card the size of a credit card or driver’s licence that you tap onto a pedestal at a train station or inside a bus and your fare is automatically paid.

(Photos courtesy of TriMet)

It’s a process that feels a little magical when you first use it. You tap it every time you get on transit but you’re only charged when you don’t have an already active ticket. If you’ve used two tickets that day, then you’re upgraded to a day pass and won’t be charged again until after 2am that night. If you’ve used 20 days worth of tickets, which is the same cost as a monthly pass would be, then you’re not charged for the rest of the month.

So, clearly, there’s some sophistication going on here: there’s actual logic, decisions, identification, and network communication happening every time you tap the card.

But how does it work?

Well the card is a Radio-Frequency IDentification (RFID) card. You may have seen RFID technology used in things like identifying library books during check-out, keeping track of equipment, or even tagging animals. The HOP card is passive, only broadcasting it’s unique identifier when triggered by the presence of a receiver. Even though it’s small it still has space for an antenna!. You can actually see it in this picture, it’s the small band illuminated by the light.

The chip itself is even smaller than you might think. You can see it, the opaque part that’s green tinged, in this photo.

Tiny, right? It’s even smaller than a grain of rice!

Okay, so there’s receivers that can check the unique ID of a Hop card but what happens then?

Well, basically, the pedestals you tap the card on are running a small version of Linux. The code it’s running to read the card and communicate with their servers is written in C and C++.

The code for the Trimet servers themselves is pretty much all C#, handling the actual lookup of account information in their databases and checking to see whether you have an active ticket.

A lot of the odds-and-ends code to integrate pieces of the system and do things like checking system logs is written in Python.

Now, actually getting all of this software and hardware reliably working was a pretty non-trivial effort. Over a dozen different companies, including Google, were involved in the development and implementation of this transit system. They needed to not just handle the fares themselves, but securely allow you to connect credit & debit cards to your account that can be charged when your account runs low. They also needed to implement the systems to allow you to refill your card at convenience & grocery stores.

There’s a lot of i’s to dot and t’s to cross for something like this, which is why Trimet also worked with other local tech companies like New Relic in order monitor the health of the system.
So what can we take away from all this?

Well, for one thing I think this shows that there’s a lot of work that can go into even seemingly small things. Even paying for the bus has a ton to think about and many different moving parts.

I also think it shows that there’s a lot of opportunity in civic-minded technology. If this much works goes into paying for transit securely & reliably, imagine what might go into a system to help people be matched with affordable housing, or allowing secure online voting. While these projects are much too large for a single person, if you get good at something you’ll find a way you can make people’s lives better.

Learn More

RFID technology

https://en.wikipedia.org/wiki/Radio-frequency_identification

Smart cards in general

https://computer.howstuffworks.com/question332.htm

The major company that worked with TriMet

https://www.initse.com/ende/home.html

An article about local activists who are worried that the HOP card might hurt low income riders

http://koin.com/2016/03/18/bus-riders-unite-take-aim-at-trimets-hop-fastpass/

Also In The April 2018 Issue

Who chooses new emojis? And what’s coming in the next batch?

Build your own voice-controlled digital assistant with a Raspberry Pi and an analog speaker.

Using Scratch and some simple vector math, create your own Boids algorithm to simulate the flight of birds.

6 hands-on STEM camps and clubs to join this summer.

With these new high-tech cards, public transit is easier than ever.

Slice digital photos into pieces and have fun pasting them back together.

Meet the cute little bot that’s helping scientists understand the courtship of frogs.

Dive into the nitty-gritty of game-making with this popular Python library.

Learn about the Native soldiers and the creative cypher code that helped win WWII.

Our cars aren’t quite driving themselves, but they can help us park and avoid collisions.

Make your games even more exciting with custom user-created content!

A clever teacher uses our favourite round robot to bring books to life.

Learn how to search through blobs of text with speed, accuracy, and elegance… like a ninja!

Links from the bottom of all the April 2018 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for April 2018.