NFC login (version 1.0)

After my experiments with NFC readers I felt it was time to actually create something useful to work with my NFC implant. At work I need to make sure that my PC is locked whenever I leave my desk. It’s not that I work with anything really sensitive, it’s just that given half a chance my colleagues will certainly send an email on my behalf admitting to unusual sexual inclinations or offering to buy everyone biscuits.

I decided the easiest way to do this was with keyboard emulation. It doesn’t require me to have any privileged domain access, modify the PC or install anything that compromises security. Plus, it should all be possible using a MSP430F5529.

The launchpad, booster pack and antenna.

The launchpad, booster pack and antenna.

My proof of concept involved a MSP430F5529 LaunchPad and a . I made sure that I could emulate a USB keyboard, implement a USB CDC serial port and read my tag id.

The USB side of things was adapted from some of TI’s example code. The NFC stuff was a little trickier. The Booster Pack is sold bundled with either the G2 or F5529 Launchpads. However the sample code is surprisingly complicated and only supplied for the MSP430G2553. Porting it over to the MSP430F5529 should have been fairly simple – just changes to some in assignment and clocking. It somehow took me ages but I managed it in the end. I must publish my ported code to save other people the same trouble.

I combined them all together to implement the following:

  • A USB CDC serial port allows me to set the password (but not read it). It’s stored in the microcontroller’s flash so persists when powered down.
  • Pressing one button on the launchpad send Windows-L to lock my PC. (Not actually easily accessible in its current form.)
  • It scans continuously for NFC tags and if it sees mine it sends Ctrl-Alt-Del{password}Enter

The 2 part 3D printed case for my NFC login

The 2 part 3D printed case for my NFC login

Hardware wise for version 1.0 I went with the setup from my previous including a DLP coil antenna and a cheap bit of U-FL to SMA cable from eBay. I don’t intend that the final version will be using a dev board and booster pack. It’ll be a custom etched PCB, but I decided to take the same approach as with Agile software development – produce a minimum viable product first and improve later. If I don’t ever get round to a nice neat version 2.0 then at least I can actually log in with my implant.

A view showing the installed boards and antenna

A view showing the installed boards and antenna

I 3D printed a case that allows the launchpad, booster pack and antenna to slot in. It comprises two parts that clip together and a couple of magnet to hold it firmly against the PC case on my desk. The case is 3mm thick but only 1mm thick by the antenna coil so it reads fairly easily.

OK, it just looks like a plain yellow box

OK, it just looks like a plain yellow box

The final version looks a little dull. It’s a plain box that was almost done in black, but I happened to have yellow filament in the printer. All that happens when I successfully scan my tag is that a red LED shows through the case for 5s whilst scanning is temporarily disabled and my PC unlocks.

I’ve got a little bit of tidying of the code before I include it. As it’s evolved from two different lots of sample code in different styles it’s a little bit messy. I’ll also attach the STL files for the case – designed once again in my 3D modelling package of choice OpenSCAD.

Source code (still messy) and STL files (under files folder) are now available at https://bitbucket.org/fredmurphy/public/src/127c1b2f26305bd8b2b2184084927da72457f9e5/LoginNFC/?at=master

Advertisements

NFC reader for the xNT (part one)

I’ve had my xNT NFC implant for a few months now and I’m very happy with it. The main thing I’ve used it for is opening my garage door. It was great to use it with an existing piece of commercial kit and get used to it, but I always wanted to build some custom things to use with it.

Some NFC readers

Some NFC readers.

The simplest way to get started was to find an existing NFC reader that I can interface with a microcontroller. A scratch-built reader will come in time, but for now this is the first step. I tried a few reasonably cheap NFC readers hoping that I’d find a gem amongst them. The ones that I tried are shown. There’s the (red) DLP Design DLP-7970ABP booster pack for the MSP430. This suits me as I’m a MSP430 user and may well use the TRF7970A to base my custom reader on. Next is the (blue) RC522 based reader I found on eBay. This was chosen just because the RC522 is a commonly used chip so there’s lots of sample code out there. Third the (green) YHY502. This is just something I found on eBay from China sorting by price. Lastly the (black) ID20-MFIA. I chose this as I’ve used the company’s ID-20 125kHz reader.

OK – so if you’ve stuck with me this far you will probably want to know how they fared! To be honest they were all fairly similar. They all required the implant to be right over the PCB antenna trace (not in the centre). The alignment had to be right so without rotating my hand or the reader it worked along two sides of the trace. Whilst the ID20-MFIA didn’t have a visible trace it behaved similarly. It was also more of a pain to use too. I tried to get a quantitative measurement of range but it was tricky. They could all just about read through a piece of 3mm acrylic. Just. In practice you would want to be closer than that. Ideally with as little as possible between you and the PCB. Not as good as I’d hoped.

However, two things give me hope that we can do better. Firstly, my Samsung Ezon SHS-2320 lock seems better than that. I generally place my implant right against the reader but it seems to read well and consistently. I’ll have to do a teardown soon.

Secondly there was this post by Mathieu Stephan on Hackaday. As you can see Mathieu’s made far more progress than me. He was also happy to share his results, including schematics and the values that worked for tuning his antenna. What an awesome guy.

Mathieu’s work on inductor-based readers got me poking around a bit and I stumbled over this ferrite antenna also from DLP Design. Whilst I intend to etch some boards and try out Mathieu’s design, I’m fairly time-constrained by two young sons. I thought it’d be worth seeing if this off the shelf antenna would do the trick.

Adding u.FL connector

Adding u.FL connector

Cutting PCB trace

Cutting PCB trace


There were a couple of things I needed to do to get this working. I had to cut the trace to the PCB antenna on the rear of the board. It’s a 4-layer board so lucky it wan’t on an internal layer. I also had to add the unpopulated SMT u.FL connector to the board (marked CN1).

DLP 7970ABP and FANT

DLP 7970ABP and FANT

Finally one cheap eBay u.FL to SMA (note not RP-SMA) cable and we’re sorted! So – how did it perform? Not too bad.

I don’t think it was ever possible to get a huge read range, but it’s definitely better. It will now just read through 5mm of acrylic and whilst it still operates better if oriented correctly with the implant it’s not quite as fussy. It’s a worthwhile improvement and if you’re making your own board it would definitely be worth basing it on a coil rather than PCB antenna.

There are some differences between the DLP’s and Mathieu’s designs. There’s still the Ezon to take apart. So I’ll keep going in my search for the perfect reader. Also, it might still be possible that the right (i.e. smaller) PCB trace is even better. I’m also working on the code for my first xNT project, so stay tuned…

Freewheeling Friday

What a totally random Friday I just had. If you’re a fan of Ross Noble then you might have seen his series Freewheeling where he responds to random stuff on Twitter and heads off round the country on his motorbike. Well, he’s currently busy filming for series 2 and when he tweeted this I thought I’d mention my NFC implant.

I am looking to feature the following on freewheeling.
Ventriloquism
Taxidermy
Alternative people(tattoos body mods etc)
Can u help

The film crew in my garden

The film crew in my garden

A few messages back and forth with his production team and he turns up with a film crew to have a chat. We spent about 20 minutes or so in my back garden chatting about the back door to my garage / workshop which has an NFC-enabled lock. My wife also had a chat about how she wanted nothing to do with implanting it for me. She pretended to be all aloof about having a celebrity popping round, but when it looked like she’d be out before they turned up, she managed to cancel her other engagement!

Me, and a firmly shut garage door

Me, and a firmly shut garage door

I also showed him the Fisher Price records and the laser. We chatted for a bit about motorbikes while the crew sorted out the next destination – a taxidemist who stuff mice in positions reading the newspaper, etc.

Adam (two and a half) was too shy to join us.

Adam (two and a half) was too shy to join us.

He seemed to be a really nice genuine guy. And whilst it looks like a bit of fun it seems like really hard work to make it look that way. They do 2 weeks solid filming morning to night 3 times. Each week turns out to be a single episode. My older boy Adam is motorbike obsessed and loved his KTM SuperDuke. Ross even said he could sit on the bike, but a bout of shyness meant that he wouldn’t.

All in all, a fairly unusual day. Then off for a stag weekend…

Oh yeah – it should be on around the end of the year. I’ve no idea how much footage they take or how likely I am to make the final cut. It’s a great series though. Watch it anyway.