NFC login 2.0 finally working


It’s taken some time, but it’s finally working! It’s hard to debug when you don’t know what’s at fault.

  • Is it the PCB design? I’ve never done anything this complicated or as high frequency as this.
  • Is the the PCB manufacture? I decided to get the board made by DirtyPCBs rather than home etching, so at least that took one potential source of screw-up out of the equation.
  • Is it my soldering. I’ve never done anything as fine as the LQFP (larger chip) and QFN (smaller one on the right). They’re both 0.4mm pitch but at least the LQFP has pins that stick out rather than just metal patches on the edges of a square block.
  • Is it the design of the antenna? This is the work of the very talented Mathieu Stephan (from here) so probably not the weakest link.
  • Is it the firmware? I’ve had the code running on a MSP430F5529 LaunchPad, but I’ve switched down to a smaller F5510 and reassigned the pins.

Well, it took three tries – as you can see from the label. There’s a mistake around the bodged TPS77333 voltage regulator which is now a TPS77533. Another by the LED which I’ve had to swap for two separate ones rather than a red/green single package.

It turns out is was the QFN soldering. Buying a microscope helped but it’s finally there! It’s finally working! There’s more to do of course. I need to fix the mistakes. I need to laser cut a nice enclosure. The software could be tidier. Version 2.1 will be perfect (probably). I’ll publish the design and code when it’s tidy, but in the mean time if anyone’s interested in any of it, let me know.

It’s been harder and slower than I expected but I’m very happy.

A stereo microscope

Wow. I didn’t really think I needed a “real” microscope. So far for working on those tiny SMD components I’ve got by with a jeweller’s loupe and a magnifying headband from my father-in-law who is a retired dentist. For inspection afterwards, I used a £20 eBay USB microscope. This all seemed adequate.

However, for the latest version of my NFC login project I had to solder a TRF7970A NFC transceiver. These only come in QFN package. The 0.4mm pitch pins aren’t too much of an issue. I can handle these OK on the LQFP package that the MSP430 comes in. It’s the fact that there aren’t actually any pins sticking out – just a visible metal pad on the lower edge of the chip. I had to rework one a few times as I hadn’t got it quite right and I suspect I was starting to do some damage to the chip and/or the PCB.

I did a bit of research – mostly on eevblog. The really good ones are way to expensive for the amount of use it. The good value AmScope models that most people recommend are too expensive to ship outside the US. Brunel microscopes in the UK seem good, but still quite pricey. Then I stumbled across the usual eBay “bargain” direct from China. I’ve been happy with the price/quality compromise on the laser and CNC mill I got this way. Time to dig a bit deeper and see of this is likely to be a good idea.

Microscope1I found a very helpful review on eereview that served to be the same model. To be honest, it seems the same as some of the AmScopes too. It actually looks the same as the BMDZ series from Brunel too. I decided to risk trading off quality for specifications and went for it.

Here’s the image straight from the eBay listing. I assume the seller won’t mind as I’d be happy to recommend lapsun_gift. The microscope (plus some x0.5 and x2 barlow lenses) arrived in about a week. It was marked a $95 but form some reason UK customs decided to charge me VAT on £125. The cost was about £300 so I was OK with that. The same microscope without camera, ring light or barlow lenses was £450+VAT in the UK so I was happy with the price too.

wpid-wp-1448207092901.jpgI’m very happy with it. Inspecting a reworking LQFP used to be a pain. My USB microscope would allow me to see stuff but the lighting meant I couldn’t really be sure what was a short of solder and what was a reflection. The actual soldering had to be done with no magnification and then re-inspected. Now I can actually see properly. The microscope itself is 7x to 45x zoom. With the 0.5x lens I get less magnification and a 165mm focal length and can actually solder under it – whether an iron or hot air. Zooming in (and perhaps removing the barlow lens) means I can actually see the individual balls in the solder paste.

The 2x lens (i.e. up to 90x magnification) is a bit much for anything other than really detail inspection of a PCB. It should be great for counting a spider’s eye with my boys though – if it’s not too scary!

WIN_20151122_16_23_58_ProThe camera is probably the weakest point of it all. When switching the camera in, you lose one of the stereo eyepieces. Not really a problem. However, I find the the image the camera sees is about 10% of what you see through the eyepieces. Focusing is tricky and I can’t see to get it to focus at the same place as the remaining eyepiece. In the image shown each pin is about 0.2mm with 0.2mm gap to the next one. Through the eyepiece you can see the whole 48 pin chip and some passives around it. It’s also far clearer. That photo really doesn’t do the microscope justice. Never mind – the camera was just a “why not” addition. I might try an adapter for my SLR camera at some point but no hurry.

Many people recommended a boom stand. This didn’t come as an option with the eBay model, but if I ever need one I can always add one later. The supplied one is certainly adequate for me so far. If I need to look at an angle I just tilt the board and refocuscam.


NFC Login 2.0 – the first custom PCB I ever ordered

Home etched v2.0 - dodgy solder mask and via drilling

Home etched v2.0 – dodgy solder mask and via drilling

NFC Login version 1.0 is working fine, but I always intended to ditch the development boards and create a custom PCB with just what’s needed. As always it’s finding the time to do these things. I had an attempt at a home etched one, but it didn’t go quite right. Then I was busy with the new workshop so it got put on hold. Eventually I decided that the 2 week wait for a PCB from China was actually quicker than finding time for the few hours it (in theory) took me to etch a board.

NFC Login 2.0 PCBs

NFC Login 2.0 PCBs

As it seemed very likely that there would need to be a further iteration, I decided that the cheapest option of using DirtyPCBs would be fine. I must say I’m fairly impressed with the quality. The only minor issue I had was that they seemed to use the tNames rather than the tSilk layer for the silkscreen. As likely to be my fault as their, I’m sure. Anyway, this was the result. Not bad for $25 including shipping for 10. That’ll give me scope for ruining a few too!

I started just adding a few components – just the minimal the USB and MSP430 parts – expecting that I’d find a problem. All good. Even the tiny TagConnect header worked fine. The only snag I can across was an incorrectly sized footprint for the TPS77333 regulator. This was annoying as it came from the TI library included in the latest version of Eagle. An earlier version the library which I used for the laser coolant monitor was fine. Annoying. Somehow it also seemed to struggle with the supply voltage when flashing an LED, which made debugging flaky, so I bodged a 77533 (higher power, different pinout) sideways across the board. It works. It’ll be updated in the next revision.

Populated board - note the bodged regulater on the right

Populated board – note the bodged regulator on the right

All seemed OK, so I added the NFC side of things. Things here were more problematic. Currently it seems that communication (SPI) between the microcontroller and the TRF7970A are OK. What I can’t seem to get in any output at all from the NFC chip into the RF circuitry. The 13.56MHz crystal seems to be working fine. This could take me a while. I had a few goes at removing and reattaching the TRF7970. Lots of practice reworking those tiny 0.4mm pitch QFN and LQFP packages, but there’s a chance I’ve damaged it. Maybe I need to populate another one to check.

CNC mill upsize

I’m very fond of my Proxxon MF70. I converted it myself and its what got me into the whole world of CNC. It’s great but the size does limit what it can do.
Since getting a new workshop I’ve been thinking of what to fill it with. Actually, that’s not quite true. I had an idea of some things to fill it with before it was even built. I just couldn’t buy them.

Sieg X3

I didn’t go for a Sieg X3

I’d been keeping an eye out for a bigger CNC mill for a while. Whilst I did consider a “proper” mill like a Sieg X3, these are really heavy, expensive and needed a lot spent on CNC conversion. To be honest, whilst it’s nice to be able to easily mill large chunks of metal I knew I wouldn’t be doing it all that often.

I’d learnt from tinkering with my CO2 laser cutter that cheap Chinese machinery is good value if you’re prepared to improve their shortcomings. The popular eBay CNC3040 or CNC6040 machines definitely fall into this category. It’s more of a router than a mill, but is apparently capable of machining aluminium if you’re careful.

I’d been watching for a while and some went for silly prices near the £1000 or so new price, so I was happy to snap one up for £615 including a few upgraded controller components. It had a slightly damaged table no doubt from some missed Z steps. slowly ramping the  endmill into it. It had the older blue (total junk) controller box which I was going to replace with a Gecko 540 I had hanging around for just this sort of thing. It has the older Huanyang VFD to drive the water cooled spindle but it seems this is easier to control using Mach3 than the newer Nowforever ones.

The new mill dwarfs the old one

The new mill dwarfs the old one

It arrived and I unpacked it. It’s so much bigger than my old mill. The spindle alone is about as big as the old table!

I was a little disappointed to find that the table was a bit worse than it looked in the photos, but I carefully filed it down so it was at least flat and turned the T-slot pieces around so the damage wasn’t in the centre. The bigger shock was the badly stripped threads on the main gantry assembly and the horribly bodged limit switch wiring. Oh well – nothing a little time and care wouldn’t sort out.

I fired it up using the blue box. One axis tended to freeze in one direction. It seemed to be the controller board rather than the stepper drivers. Switching to another of the 5 channels helped but it still missed steps occasionally. Moving from 16 to 8 microsteps helped again, but then it started really misbehaving. Time to ditch it and go Gecko. I’m not going to waste any more time putting lipstick on the pig that is the electronics. I’ll replace all the wiring with shielded stuff too.

A new workshop (part 2)

So the company who built and installed my garden building have done their bit. Now it’s time for me to turn a lovely garden office into a proper workshop / man cave. The included options of wood flooring or carpet tiles didn’t really suit me. I decided on a single piece of grey vinyl flooring from Factory Flooring Direct. I wanted something fairly hard wearing that could stand up to the abuse of a workshop and cope with any spills. The ply that the installers put down was a rather pointless 6mm, so that was ripped up and a sturdy 18mm ply base put down. My brother gave me a hand cutting the vinyl to fit as it wasn’t an easy job – especially with my attention for detail and the fact that I didn’t want skirting board to hide any gaps. It was hard for a number of reasons. Firstly, the roll was too heavy for one person to lift. Secondly, as it was one piece it was bigger than the room and hence hard to manhandle. We did it though. I now had a nice tough grey vinyl floor.


Workbenches fitted

Next was the workbench and shelving underneath. Being spoiled for space somehow made it harder to work out what I wanted and how I would lay it out. I settled on using some solid beech Hammarp kitchen worktop from Ikea. I intended to use oak but when I actually saw it the beech looked better and was cheaper too. The walls only really have decent support at the joins between the prefabricated panels so I used some steel angle iron along the walls and 30mm stainless steel legs to support it. All the metal is from Metals4U. The desk drawers are Ikea Alex and the kitchen units Ikea Metod / Maximera. Basically – it’s mostly an Ikea kitchen! That gives me some desk height (73cm) and mostly workbench height (93cm) space. All of this was meticulously fitted to the not-quite-straight walls so there was no gap. I borrowed a kitchen worktop jig to mitre and biscuit joint the worktop. Lots of work but worth it to get a good fit in the end. The under-bench shelves are just melamine panels – some 30cm and some 45cm deep. You may notice there are lots of sockets. You can never have enough sockets. There are 11 double sockets – some above and some below the worktop. There will also be one on the outside for garden power (hedge trimmer, etc.). The ones by the desk are always powered, but I carried over an idea from my previous workshop. The ones at the workbench can be isolated using an emergency stop button. It’s not just used as an emergency stop. I mainly to make sure that if the kids wander inside all the dangerous stuff and power tools can’t be switched on. I trigger it as I leave.

Moving toys in

Moving toys in

This is how the workshop looks after I’ve moved some of the equipment in. From the left you’ll see:

  • My desk for coding and microcontroller work (where I’m typing this right now)
  • Oscilloscope and solder station
  • An Up Plus 3D printer
  • The red emergency stop button on the wall
  • My small Proxxon MF70 CNC mill
  • A 40W CO2 laser cutter
  • A small metalworking lathe
  • A mitre saw
  • The kid’s workbench. They want to be like their dad!
  • The keen-eyed will have spotted 2 fire extinguishers (powder and CO2). I’ll be burning things with a laser in a primarily wooden building so a sensible precaution.
You'd never know it was a workshop from outside

You’d never know it was a workshop from outside

All this stuff only really takes up half of the workshop – the mostly hidden half. The right hand side should soon be getting a sofa bed (for the occasional brave visitor), fridge, etc. It’ll be a family space and my wife will have her input. However, I have said that if a scatter cushion appears it’ll have an accident with the mitre saw.

There’s still workshop stuff to do. There’s plenty of storage space under the bench but shelves and wall-mounted tool boards are coming soon. The laser isn’t usable yet as it has no exhaust venting. I’m also planning to put a sink in there to allow making a cup of tea and washing hands. It’ll drain onto the ground rather than have any plumbing back into the drains so it’ll be fairly limited. I’ll let the rest evolve as needed. Maybe it’ll never happen but the plumbing is there.

A new workshop (part 1)

Current workspaceMy current workspace at the back of the garage seemed like luxury at the time. Rather than just squeezing everything onto a small piece of kitchen counter next to a sink, I made a custom L-shaped workbench that was built like a tank. It had shelves below, some above and plenty of power points. Unfortunately I soon filled the space with a laser cutter that was bigger than I expected. Then the old space beside the sink became occupied with a lathe. It’s true that stuff grows to fit the space you have.

Since we moved into our house 7 years ago, there has been a bit of ground at the bottom of the garden under the shade of some old plum trees. Only brambles grew there along with builders’ rubble and a small shed. It was fenced off and more or less abandoned. The time eventually came to do something about it. The full space was 9m x 4.5m. Trees and a fence were removed. Earth was shifted and the ground was flattened – very hard work. About two thirds of this space was about to become a new workshop, with the remaining third for the kids to have a swing, slide or something.

I shopped around for a while. Dunster House looked OK, but had enough bad reviews online that they were discounted. Then I found The Garden Office. A bit more expensive but much better. They’re a really great company who I can highly recommend. I went for a building with internal dimensions of 5.5m x 3.8m – about the largest I could go and still leave a reasonable space for the kids. I was very impressed when visiting their showroom. Unfortunately they’re now so popular they had a 3-4 month lead time.

Workshop base in progress

Workshop base in progress

Eventually, one Friday the sent out a team to lay out the base – some very helpful guys who got it as close a they could to the boundary to maximise space. Rather than the more usual laying of a concrete base, they drill about 20 holes and poured concrete down to form pillars for the structure to rest on. Far less hassle than a full base and it seems to work really well. Each pillar has some adjustment to get it perfectly level

Workshop build in progress

Workshop build in progress

Then on the Monday to Wednesday of the next week the rest of the build went ahead. Once again, a really great team who seemed genuinely keen on providing what I wanted rather than just getting the job done. I knew I wanted lost of power points but I had no idea where. They were happy to run extra cabling where I thought I might want them and to leave some panels loose for me to get in there and wire it all up. They also left the flooring unfitted at my request so I could fit a thicker plywood base and a custom vinyl floor.

The only minor glitch came with the laying of the armoured power cable to my new workshop. Rather than waiting for an electrician to sign it off, the build team buried the cable themselves (along with some CAT6 and water pipe). There was a bit of hand dug trench they didn’t back fill, and the depth of the cable here didn’t look right. I dug a few test holes and found it hadn’t been bured to a safe depth – despite the trench being dug deep enough. Maybe they didn’t think anyone would be picky enough to dig and check! Anyway, it was remedied quickly and without any quibbling by the Garden Office team. I always say you can tell more about a company by how they handle the odd mistake then if they make no mistakes at all. Once again they did well. If you’re after any sort of garden building I have no hesitation recommending The Garden Office or their sister company Green Retreats.

Workshop installation finished

Workshop installation finished

Well, my lovely new garden building is up. Now it’s down to me to sort out the inside and turn it into a workshop…

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