NFC Login 2.1

image

This should be the final revision. Just a few minor tweaks. The regulator is now a TPS77533 rather than an incorrectly footprinted TPS77333. Corrected the bi-colour LED wiring. Move to a smaller 4MHz crystal for the USB side of things. Shrunk it a bit as I’m no longer expecting to find any PCB bugs. Dropped the 0.1″ pin header as the TagConnect worked fine.

The most obvious change is the small capacitive touch sensor PCB on the front. The previous version searches for a tag a couple of times a second. This works fine but I don’t like the idea of all the 13.56MHz EM noise pollution. This will poll for touch frequently and if it senses a touch it will poll for tags rapidly for a few seconds. In theory it could be more responsive too. Not had a chance to code this yet though.

There’s is also a Login NFC the way to another implantee. I’d recommend you check out Hans Peter’s embryonic.dk blog.

Advertisements

NFC login 2.0 finally working

image

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 as 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.5mm 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 scribble on the board above. There’s a mistake around the TPS77333 voltage regulator which truned out to be a footprint error in the Eagle-supplied libraries. It’s now a bodged-in TPS77533. There’s another by the LED which I’ve had to swap for two separate ones rather than a red/green single package. My mistake on the pinout there.

It turns out the problem was the soldering of the QFN packaged TRF7970A. Buying a microscope helped me sort it out and it’s finally there! It’s finally working! There’s more to do, of course. I need to fix the mistakes. 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.

image

I laser cut a simple acrylic enclosure. It’s just black acrylic on the back – with some 5mm neodymium magnets press fitted into holes so it attaches firmly to my PC.
Some clear acrylic makes up the front so I can see the LEDs and the fruits of my labours. M3 nylon bolts go into threaded holes on the rear piece.

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

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

Laser improvements – coolant monitoring

One of the quickest ways to destroy a CO2 laser tube is to let it overheat. My laser has a very simple system – just a plastic breakfast cereal container of water with a small aquarium pump. It works well enough, but is easy to forget.

My first modification was to power the pump from the laser so that it’s running when the laser is switched on at the mains. That gets around the “oops, I forgot” problem, but doesn’t cover a pipe coming loose or the temperature creeping up. I really wanted to actually check cold(ish) water was flowing through the glass laser tube.

The water and temp sensor

The water and temp sensor

To check the flow, I started with a LM35DZ temperature sensor and a cheap water flow sensor from eBay. For neatness I carefully milled the flow sensor to embed the temperature sensor in it. This was then attached to the output of the laser. I intend to check that enough water is coming out and that it’s below a temperature threshold.

I etched a board with a MSP430G2533 microcontroller that counted the pulses from the flow sensor over a fixed timer period and used the onboard ADC to read the temperature. I set the threshold at 40C and 75% of the normal flow.

PCB with logic error

First PCB with logic error

My initial attempt used a MOSFET to pull the last signal down to GND if things were awry. Unfortunately this fired rather than disabled the laser! This was replaced with a 74LSxxx AND gate so I could force it to 5V and disable the active low signal. Some connectors to match the controller board meant I could drop it in with no rewiring.

The finshed PCB - with a fix for a lifted trace

The finshed PCB – with a fix for a lifted trace

So far it has been working well. (I actually finished this months ago but didn’t document it.) It’s not actually been needed to save my tube yet, but it’s nice to know it’s there. I might later and another sensor on the input and also flag if the difference between the two is too high. I could also add a cheap LCD display but that seems a little over the top.

Coolant monitor in the laser

Coolant monitor in the laser

As it’s a single sided board with some through hole pin headers, when it’s in place you only see the “boring” side of it with not tracks or components. Oh well – there’s no need for it to look pretty. Here it is in place. It’s a drop-in addition on the 6 pin cable to the controller board. It’s powered from the existing 5V line and simply forces the signal to fire the laser high (as it’s active low) when it senses trouble. From teh top you can see:

  • The connector to the sensor
  • A debugging / programming header
  • A currently unused connector for a screen
  • The connectors to patch into existing power and signals

If anyone wants a copy of the PCB layout or code, just ask.

Further PCB improvements

I’m glad to report I’m getting even better result with my PCB etching. Results do seem a bit up and down each time I get back to it but I feel I’m narrowing it down and getting more polished.

One. I’ve started using Ziplock vacuum bags to evenly press the transparency against the PCB. A really nice cheap substitute for a vacuum light box! I can thoroughly recommend them.

Etching underway

Etching underway

Two. I’m now able to get even better exposure with 3.5 minutes under the UV box rather than using the fluorescent tube. Maybe my developer solution used to be too strong. Maybe ditching the glass in favour of the Ziplock helped. Regardless, I’m getting a really good result. Here’s the partially etched board showing great definition.

Three. I got some Tin plating solution. No idea why I didn’t do this before, as it’s really easy and gives a great finish. The instruction say to carefully clean the copper with an abrasive. However, I assumed that as I’d just removed the etch resist from the copper with acetone and it had to be just about as clean as it could be. I popped it straight in the tinning solution before I got fingerprints all over it.

Etched and soldermasked board

Etched and soldermasked board

Milled, drilled and populated

Milled, drilled and populated

I had to mess something up and I removed the protective layer on the soldermask before exposing. Some of it dulled a little on contact with the transparency. Oh well. Otherwise I’m very happy. The ridiculously small negative text even came out a little. Here’s the board before drilling and populating. It a simple MSP430 based alarm for when my two year old son opens the front door. He can now just reach the handle.

When I’ve got it all sorted (and have tried the via rivets too) I think I might do a proper write-up.

Animated Lego Darth Vader build monitor

Darth Vader build monitor

Darth Vader build monitor

At work we use Continuous Integration to build and test our code as we check it in. It helps catc problems early and ensures we keep code standards up. We were using CruiseControl.NET but have now moved to TeamCity. Anyway, this is no use unless people take notice of broken builds and this was starting to slip. I decided that something fairly visible (but not too annoying) was needed. After spotting a Lego Dath Vader toy torch it seemed like a good solution.

The standard toy has a button on his chest that is used to switch on some while LEDs in his feet. There was also a red LED and a AAA battery in his lightsaber so it could be switched on. The plan was to add a servo to his arm so he could wave the lightsaber around and replace the red LED with a RGB one so that the colours could change. All of this under PC control of course.

Get out the Dremel

Get out the Dremel

Remove the battery connectors

Remove the battery connectors

Rather than describe in detail exactly what was needed, maybe some photos of the progress will sum it up. First I had to get a servo in place operating his right arm. It required cutting away the battery compartment, filing the joint to make it a little easier to move and hot-gluing the servo in place.

Make a slot for the servo horn

Make a slot for the servo horn

Make room for the servo

Make room for the servo

The front just involved making a bit more room to glue the servo in. The a slot needed to be carefully added for the servo horn to drive the arm. The horn was later screwed to the servo. The connection between the servo horn and teh shoulder joint is just a push fit.

For the lightsaber, the battery, connectors, original PCB and LED had to be removed. The switch was glued in place as it wasn’t to be used but needed to fill the hole. As ther was no PCB to locate the new LED, it was glued into place.

Finished arm

Finished arm

Finished saber and hand

Finished saber and hand

Running the 4 wires from the RGB LED involved carefully drilling a path through the side of the lightsaber, the hand, arm and shoulder joint. I had to be careful that the wires coming out of the shoulder didn’t limit the servo movement.

Closed up

Closed up

The next step was putting all this under PC control. I decided that the recently release MSP430F5529 Launchpad would make an ideal control system. It has built-in USB functionality and could easily handle a few PWM channels. All that was required was to connect ground, 5V and a PWM signal to the servo and 3 PWM signals to the channels of the LED. The photo also shows the clear acrylic base – cut using a 40W CO2 laser.

Darth-62-complete-controlleI intend to etch a small microcontroller board that will fit inside where the battery compartment was, but for the initial build uses the Launchpad externally, in a 3D printed enclosure.

The connection between the device and the PC is using a USB serial port. As far as what controls Darth Vader, I tried a number of options. Initial control was done from an ASP.NET MVC web page. Anyone in the office could control him with simple URLs like fredpc/Vader/Colour/Blue or fredpc/Vader/Position/0.

The connection to TeamCity proved a little more difficult. I started work on a Java plug-in for TeamCity that would call these URLs, but it was a pain to get the plug-in installed and working in TeamCity. All the documentation I could find was out of date and inconsistent – as is often the case with Java. So I went with a Windows service that polls TeamCity (using Rest APIs) every 10 minutes. Later, I realised that information like who is assigned to fix a build was missing from the APIs. Believe it or not the best solution I could find was to screen-scrape the HTML from the page used by the TeamCity Tray Notifier! I’m not impressed with the API side of TeamCity at all.

I you’d like to see it working, here are a couple of videos of it in action.

Adjustable MSP430F5529 Launchpad enclosure

F5529 caseI’ve been working on a project using the MSP430F5529 – a really nice microcontroller with built-in USB functionality. The final product should get an etched board. However it has a whole Launchpad for now, so I thought I’d dust off the 3D printer and make a case. My favourite tool is still OpenSCAD so I came up with an adjustable enclosure. It should be easy to add any openings or custom bit if you want to.

 

Here’s what it’s being used for. More info on that later…WP_20131014_001