Guest blog #2: Near field communication by Donatien Garnier

Arthur C. Clarke said that, “Any sufficiently advanced technology is indistinguishable from magic.” As a child of the late 20th century I have experienced all manner of technowonders, from the Apollo 11 moon landing to motion-activated air fresheners that look like rocks. But brandishing your smartphones at each other to exchange data is, let’s face it, complete and utter witchcraftery.

Donatien Garnier of Cambridge startup AppNearMe describes how near field communication (NFC) can be used to talk to the Raspberry Pi.

Configuring devices with no physical user interface

Many projects have been using Raspberry Pi for embedded applications because it gives you a complete GNU/Linux platform with a great deal of input/output busses at a very competitive cost.

These RaPi-based projects are usually using some kind of connectivity (Ethernet, Wi-Fi, Bluetooth or even Zigbee or 6LowPan) and some of them are battery powered.

Here a Raspberry Pi was used to upload photos from a camera through Wi-Fi, here to power an WiFi-connected internet radio. On elinux.org’s RaspberryPi projects wiki page, you can find a couple other cool projects involving Bluetooth or Zigbee connectivity.

In all these projects most of the devices sit happily doing their job quietly however the connectivity parameters have to be configured at some point: SSID and passphrase for WiFi, pairing info for Bluetooth, security key for Zigbee, etc.

This leaves you with a few options to allow the user to configure these parameters. First one is to embed a touchscreen or a screen plus keypad on your setup. However your overall cost would increase a lot and this would make your device quite bigger. Plus remember how frustrating it is to input text on a tiny keypad?

You can plug your Raspberry Pi into a computer screen and keyboard and input the parameters using the command line, but this is both time consuming and requires that you actually have this kind of equipment around. If your device is in a closed case this means that you would have to expose at least the HDMI output and one USB plug, which can be problematic especially if your case needs to be hermetic.

You can also let the user write the parameters on a file on the SD Card, but sometimes you just don’t want him to be able to access the whole file system, it is still time consuming and having to remove and insert back the SD card can lead to involuntary damage on the hardware.

Near Field Communication (NFC) at the rescue

Another solution is to somehow shift these constraints to another device. This is one of the situation where NFC can help. NFC is a very short range radio technology that allows touch-based interactions (to get an idea have a look at what Google is doing with Android Beam). We (a recently Cambridge-established startup called AppNearMe) developed a solution that allows you to touch your RaspberryPi with your Android phone to get the device’s configuration interface. You can configure every parameter using your phone’s large touchscreen and touch the Pi back to set the configuration.

For instance here is a demo of WiFi configuration:

WiFi configuration

List of WiFi networks transmitted by the Raspberry Pi to the phone

List of WiFi networks transmitted by the Raspberry Pi to the phone

For now you can see that the hardware is a bit messy but we are working on a more integrated solution!

The hardware we used for the demo: RaspberryPi with WiFi dongle, mbed LCP11U24, Adafruit NFC board

The hardware we used for the demo: RaspberryPi with WiFi dongle, mbed LCP11U24, Adafruit NFC board

From a developer’s point of view we have a Python API (on the Pi side – will be released soon) and an HTML5/Javascript framework for developing the interface (no Android programming skills required – more info here).

Beyond connectivity

Of course connection parameters are not the only things that you might need to configure: units, time zones, location based on the phone’s GPS, calibration data for sensors or even user accounts for cloud-connected devices. You can also transmit authentication keys to unlock features.

Does it inspire you with new project ideas? We’d love to know, so feel free to drop us a comment!

21 comments

Avatar

It’s 6 AM right now in Turkey, and I can’t take my eyes off of your page. I have been playing with NFC on Arduino based projects, but enabling NFC on RPi is absolutely “magic” for me :) great work, can’t wait to hear more from you!

Avatar

Extremely excited I am interested in integrating this into my robotics project! The thing I most want is being able to send a shell command at the press of a button without having to have any other networking, screen or input device. keep up the good work guys!

Avatar

I’d really like to make a bar code reader (and a QR code reader in the mean time) from a webcam with my RPi. Unfortunately, I don’t even now how to detect such a thing in a picture. Then querying a webcam is just a no way for me. Would be gratefull to have an example of such a thing. Did I forgot to mention I would like to do this with nodejs ?

Avatar

You should check out ZXing (http://code.google.com/p/zxing/).

Avatar

That looks great. Well done. 3 questions spring to mind:

How big will the hardware be?
How much does it cost?
When will it be released?

Guesstimates are perfectly acceptable :)

Avatar

Hi Alex,

To answer your questions, the hardware should be 5cm*5cm big, and we’re planning a release in early 2013.
I can’t really give you a price yet as it will depend on order volumes/etc.

Thanks for the interest :)

Donatien

Avatar

Wow, this is exactly what I’m looking. I noticed that a number of Windows 8 phones and various other platforms have support for NFC, is there any plans to support non android platforms?

Avatar

Hi Jarrod,

For now we only support the Android platform as it this the platform with the most NFC devices available today.

That said, we wrote our framework with other platforms in mind (including Windows Phone); once we support another platform, the interfaces’ code (written in HTML5+Javascript) won’t need to be changed.

Donatien

Avatar

You could use this to implement a tidy dead drop (http://deaddrops.com/) that is highly weather resistant since it can be completely enclosed.

Avatar

So with this is possible put a rpi control the entrance of my house, open the door with a unique NFC code on my phone, make a register of the in and out and maybe connect the TV in my favorite channel, and when i’m go out turn off all this thing with the rpi.

Avatar

Can I ask why you are using USB for connecting instead of the i2c headers on the rPi and the breakout board? :)

Avatar

That´s my question to… Just like this tutorial from adafruit:
http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi

Avatar

This is super cool. I think that NFC-enabled setup is a necessary pre-requisite for a lot of “Internet of Things” concepts to become usable by mainstream consumers since many of these “Things” will be too small and simple to have any kind of built in UI.

Avatar

Will your PI code be compatible with libnfc (http://www.libnfc.org/http://www.libnfc.org/) so that we can use one of the more common NFC solutions ?

Avatar

The NFC stack we use is embedded in the LPC11U24, which allows us to meet critical timings requirements, so libnfc cannot be used with this solution.

Avatar

Can someone create an NFC that mutes phones when someone walks into a bathroom. Please.

Avatar

There are microSD with NFC chip available by DeviceFidelity & Tyfone; probably with microSD reader via USB hub could help. If they make it a 4GB products, it might just inserted into the SD card reader via an adapter.

Avatar

Maybe a stupid question. but for which use the mbed LCP11U24 for? What does it do exactly

Avatar

Hi Clive I have an idea for an application that requires a raspberry pi with an nfc reader. Can you give me an update on the work you are doing in this area?

Kind regards

John

Avatar

Hi John – it’s not a Foundation project: Donatien is the chap you need to speak to. Thanks.

Avatar

Hi,
I would be interested to hear about that Python API. Any news there?
thanks,
Daniel

Leave a Comment

Comments are closed