NFC Clock

This is a blog post by aaron cope that was published on November 09, 2020 . It was tagged android, nfc and tools.

Time converter: TWA (Trans World Airlines), Lockheed L-749 Constellation. Paper, metal. Gift of TWA Clipped Wings International, SFO Museum Collection. 2002.113.011.

I am speaking later this week at the Museum Computer Network (MCN) 2020 conference about how museums adapt their interactive experiences to a world where COVID-19 makes it problematic to touch anything and about the tension between doing that work in-house or with a third-party vendor. In advance of that presentation we are releasing NFC Clock, a simple Android application to demonstrate NFC Host Card Emulation (HCE) functionality.

For those unfamiliar with the terms “NFC” or “HCE” here’s a quick overview:

  • NFC is an acronym for Near Field Communications, which are a set of communications protocols to enable contactless messaging between electronic devices. In its simplest form one device acts, passively, as a “tag” containing a value that is read by a second, active, device.

  • HCE is the acronym for Host Card Emulation. It allows a hardware device with an embedded NFC antenna, like a phone, to be configured to act as though it were an NFC tag. For example this is how many contactless payment systems work: Software instructs your phone to use HCE to configure itself as an NFC tag that broadcasts your bank or credit card number that is read by a payment terminal in a shop.

NFC Clock uses Android’s HCE functionality to make a phone broadcast itself as a new NFC tag, containing the current date and time, every second. Does that sound absurd? It should, because it is. The NFC Clock application is not meant to be “practical” but to serve as a reference implementation and a template for more sophisticated applications that want to use Android’s NFC/HCE functionality. It is meant to be a starter-kit to allow an institution to begin thinking about how it might enable near-field and touchless interactions using the phones, the so-called “bring-your-own” devices, that its visitors already carry with them.

"“Time, Turn, and Light” by #WoodyDeOthello depicts ambiguous sets of hands interacting with everyday objects such as clocks, a flashlight, a candle, and a doorknob. These objects are rendered in an uncanny fashion with a sense of play, emotional intuition, and surrealism that provokes viewers to reimagine themselves and the way they view the world around them." – Instagram, September 22, 2020

SFO Museum is investigating whether or not there are practical applications for HCE in our galleries and interactive displays. We haven’t made a determination yet but in as much as we’ve gotten the basic plumbing to work we are eager to share what we’ve learned so far, for two reasons. The first is something I said while writing about some experimental work around museum objects, NFC tags and mobile phones:

I probably wouldn’t recommend installing a fleet of Android phones in the walls and gallery cases of a museum but, for a unit cost of $100, there are a number of places where a tiny computer with a screen, an internet connection, sophisticated graphics and rendering capabilities and the ability to programatically broadcast itself (HCE) would be ripe with possibility.

The second is something I wrote on this weblog recently about the need for the cultural heritage to produce and share small focused tools:

The cultural heritage sector needs as many small, focused tools as it can produce. It needs them in the long-term to finally reach the goal of a common infrastructure that can be employed sector-wide. It needs them in the short-term to develop the skill and the practice required to make those tools successful. We need to learn how to scope the purpose of and our expectations of any single tool so that we can be generous of, and learn from, the inevitable missteps and false starts that will occur along the way.

NFC Clock is not meant to answer the question “How should my museum use HCE?” but only to answer the question “Where do I even get started with HCE?” We know that everyone is busy, especially so these days, and that the documentation for some of these technologies can be scarce and confusing. We are sharing what we have learned already in a spirit of generosity and with the hope that it will make things just a little bit easier for the next person who asks “How might we…?

Negative: San Francisco Airport, Administration Building. Nitrate negative. Transfer, SFO Museum Collection. 2011.032.0111.

The source code for NFC Clock is open-source and available from the sfomuseum GitHub account:

In a similar spirit I have also released a pair of minimalist iOS applications for reading and writing NFC tags. The reader application is what’s used to read tags “published” by the NFC Clock application in the video above. These are early-stage tools so they lack polish but they work and, importantly, can be used as reference implementations for more sophisticated applications: