Musings of ls6

Arduino and NFC - part 1

This is a repost from my posterous blog.

Introduction

Here’s an quite easy and not too expensive way to integrate NFC with Arduino.

Just in case, before we proceed, I’m going to make a disclaimer here. The NFC technology has been around for years begging to be adopted on a mass scale and when it have finally picked up the mess is considerable. For years the technology companies couldn’t figure out the “killer app” and finally we now see there isn’t one. Partly for this reason there’s no consensus on the terminology. So my disclaimer is that I need to work with Mifare cards only so to keep the cost low I have selected the NFC modules from Stronglink which only talk to Mifare cards. And not even all of them. Nevertheless, Mifare enjoys the widest deployment in, I believe, the whole world besides Japan. Your public transport card most probably uses it. So, before you place your order double-check if this module covers whatever card you want to play with. I myself have purchased a set of NFC stickers from Stronglink to be able stick them on wherever needed.

Hardware

An NFC (Mifare) module from Stronglink. I’ve chosen the SL030 because I wanted to work with 3.3V supply voltage but you can have a 5V version as well. Here you can see how big it is:

As with most of casual bloggers you have to excuse the quality of pictures taken with a phone.

The module comes as an board populated SMD components but without headers so if you don’t have spare ones laying around make sure you get them separately or you will have to solder wires directly to the board.

Connecting the module

The board supports I2C interface so you need just 2 wires, power supply and ground to connect it to Arduino.

Arduino to SL030 wiring:

A4/SDA 3
A5/SCL 4
GND    6
3V3    1

Here’s the board connected to Arduino Uno:

And to a JeeNode (the reason I needed a 3.3V module is that this is the voltage the JeeNode operates on):

Software

This NFC module is supported by the RFIDuino libraries hosted here written by Marc Boon (thank you, Marc!). The SL030 module works with the library that Marc called SL018. On the screenshot below you can see both the simple example code (available in the “examples” subdirectory) as well as the result of scanning a number of tags.

What’s next?

Well, that was pretty easy, wasn’t it? I consider this part a warm-up and “check if everything is ok” step. My final goal is to connect two readers to a single Arduino and possibly connect it to internet. If you get bored before part 2 appears, take a look at Marc’s code, there is a lot of comments that explain what is going on. You might also find the SL030 User Manual useful.

P.S. The JeeNode is a pretty cool device. You get an Arduino + Radio for less.