NFC antenna tuning without a VNA

Recently I started work on a new board. This one will be a front door entry system, so I decided to go with something that could read my NFC implant but also had a numeric keypad for the kids (and anyone else) to use. Not everyone wants to be chipped. Crazy, isn’t it? I’ll write more up on the board when it gets closer to completion, but for this post I’m going to concentrate on a small PCB antenna that’s intended for use with a tiny implanted tag. I’ve successfully used a wirewound inductor before, but I decided it was time to try a PCB trace antenna. This is the most common way to make an NFC reader, but nobody seems to have tried to tune one for an implant – probably because it means it will be worse at reading larger tags. Anyway, this is about creating a small PCB antenna and more importantly tuning it so that it read well.

IMG_20181025_215846So, this is the PCB. It’s based around a MSP430FR2633 for it’s great capacitive sensing for the buttons. There is also a TRF7970A NFC transceiver as I’m familiar with this. You may also notice that I’ve gone for a reverse mount RGB LED that shines through that unmasked piece of the board. I’m really pleased with how that works. Check out this video of the buttons in action to see if you agree.


The NFC part also worked fine, but I must admit the range and sensitivity wasn’t great. I had calculated that the PCB antenna should have an inductance of about 1μH so I just used the same matching components that worked well previously. What I really needed to tune the matching circuit was a Vector Network Analyser (VNA). Unfortunately these are very expensive and I’d likely only ever use one for this. Is there another way? Well, luckily I came across an article entitled “Impedance matching for 13.56 MHz NFC antennas without VNA” which seemed to be just what I was after. Then only slight problem was that I needed an accurate measurement of the impedence of the PCB trace – by which I mean it’s inductance and resistance. I needed to buy a slightly less expensive piece of equipment – an LCR meter. I went for the DER DE-5000 which I must say I’m extremely happy with.

Measuring and calculating

So it turns out that the PCB trace I expected to be about 1μH turned out to be 0.627μH with a resistance of 0.867Ω – otherwise expressed as 0.867 + j53.42Ω. The article suggested a parallel resistor of 362Ω so i went with the closest I had of 470Ω. Calculating the parallel and series capacitances seemed trickier. I ended up using some Smith Chart software from Fritz Dellsperger. and to be honest I sort of went with trial, error and adjustment to try to get the final point as near to 50Ω as possible. I managed a theoretical 54.973 – j1.455Ω

Smith chart

I approximated the parallel  capacitance to 100μF + 47μF = 147μF and the serial to 68μF + 15μF = 83μF. With the measured value of my PCB trace and the matching components I had it had been 8.847-j135Ω. No wonder it wasn’t great!

The end result

Whilst reworking the board I measured the lowish tolerance capacitors I was using and by selecting the most appropriate ones I ended up a little bit closer to my goal. Did it work? You bet it did. I must admit I was surprised how well. Just as I was surprised when the reader and keypad worked too. Maybe I should have a bit more confidence in these things (and myself).


Getting into FPGAs

minized20reset20corner20viewSo, I obviously decided that my world wasn’t already filled with enough random stuff. I decided that it would be a good idea to get my head around FPGAs. I’m sure many of you know what FPGAs are but just in case you don’t I’ll give you a quick summary. A Field Programmable Gate Array is user defined hardware. If you decide that you need some logic (e.g. an AND gate) you could use a discrete logic gate – hello 74LS08. You could of course use a microcontroller which might even be cheaper than the logic gate. Weird, but it’s starting to be true.

The other way is to have a big ball of programmable logic that you can configure however you want. Powerful, flexible, fast. Bizarrely, you can even program enough logic to create an processor. Yes, you can create (via software) some hardware that will run software. This is just a taste of how strange the world of FPGAs can get.

I asked a few questions about the easiest way in and got loads of different answers. Anyway, someone was kind enough to send me an Arty S7 FPGA board that he’d finished with. There is a course going on at Element 14 all about programming FPGA SoCs – that’s a chip with a microprocessor and some FPGA in one. So I bought a MiniZed.

I’ve only just started, but already it’s quite a trip. An FPGA is usually programmed in either VHDL or Verilog. They’re both languages that look a bit like a programming language but really aren’t. I’ve heard the learning curve described as “the cliff of insanity” and I’m starting to know how that feels. Anyway, the journey so far is strange but I’m enjoying it. I never did ask if you start at the bottom of the cliff and climb it or if you start at the top and fall off.

Rohde & Schwarz RTM3004 review

I finally finished my review and road test of the Rohde & Schwarz RTM3004 oscilloscope. For those that don’t know, that’s a very high-end 1GHz oscilloscope. It’s a mixed signal oscilloscope (4 analog and 16 digital channels). It’s also got a built-in function and pattern generator. There’s also some really nice FFT and Spectrum Analysis functionality. It’s got a great 10″ touch screen.

RM3K with Keysight and RigolBasically it’s amazing compared to the Keysight DSOX1102G and Rigol DS1074Z that I’ve been used to. There’s nothing wrong with these two ‘scopes of course. It’s just that if they’re a nice family car, then I feel I’ve just been asked to drive around in a Ferrari for a month and write about it. Oh yeah – and you can keep the Ferrari when you’re done. As you can imagine, I’m quite happy about it.

I won’t reproduce the full road test here on the blog. If you’re interested in reading all about it then you can head over to Element14. If you’re after a video summary of the features then here you go.

Working on a oscilloscope review

You know how it can be sometimes. You’re working on one project, then it gets bumped by another. Sometimes that one gets bumped by a higher priority one. Your life is like a nested interrupt handler.

My latest project is moving my MSP430-based NFC reader over to the CC1310. It’s been competing with converting a garage into the noisy, smelly power tools and CNC side of my workshop setup.

img_20180603_112827638539278.jpgI’m very pleased to tell you than something more urgent had come up that has stalled these two. Rohde & Schwarz have asked me (via Element14) to road test one of their latest oscilloscopes – the incredible RTM3004. Even better, I get to keep it afterwards. This is a high end 1GHz 4 channel ‘scope with a 16 channel logic analyser, signal and pattern generator, spectrum analyser and loads of other features.

As you can imagine I feel obliged to put a reasonable amount of effort into this, although to do it in a fair and unbiased way. I’ve already started but I expect to spend at least another month of my free time on it. Stay tuned for the results which will appear on full over on Element14 but have a summary and link here too.

It’s been quiet here!

So, it’s been very quiet here on the blog for a while. It’s fairly likely that nobody had noticed, and very likely that nobody was too bothered. Anyway, I’m going to try to get back to it.


Getting ready for Christmas

The reason is simply that a few months ago we moved house. On the plus side we’ve moved to somewhere quite a bit bigger. On the down side it means that my lovely workshop that I spent months getting just how I liked it is no more. More accurately it’s someone else’s.

In theory I have more space for my geeky stuff, but it’s different space. Currently the desk-based stuff (coding, soldering) has moved inside. Much warmer in this cold “spring that thinks it’s winter” weather. The noisy smelly stuff like the CNC mill and laser are still in the garage and right now are still in boxes. General DIY and moving stuff means that it’s likely to stay there for a little bit longer too.

new workspace

My new electronics / coding space

Anyway, I am going to get back on the case. Coming soon – shifting my focus from MSP430 16 bit microcontrollers to TI’s 32 bit ARM offerings. I think I’ve decided that the home stuff I build need to be networked and our new place seems to be very unfriendly to 2.4GHz. The CC1310 may become my “go to” device. It’s a Cortex M3 with built-in sub 1GHz radio (on an M0 core) and even has a little 16-bit microcontroller on the side just to do sensor stuff with the main cores asleep. Very nice. Of course, that means RF stuff and more QFN soldering, but you have to progress.

Philips Hue – control anything hack

To be honest, my recent simple relay hack wasn’t really all that great. It just used the high power constant current output to drive a SSR. It wasn’t ideal, but it worked. I decided that it was worth the effort to track down some more useful outputs and properly detect the desired state of the bulb.

b22_closeupAll it took was a little bit of poking around and probing the pins of the SAM R21 microcontroller with an oscilloscope. It wasn’t actually that hard. On the B22 bayonet fitting version of the bulb I found some.

PA16 (pin 17 of the microcontroller) has a simple on/off output. It’s high (3.3V) if the light is on  at all and low if not. This is the perfect output to use to drive a simple output for a relay. It can be run straight to a SSR if that’s appropriate for your load. Or it can be used as an input to another microcontroller, a transistor to drive a relay, etc. This is probably the easiest one to use for a simple load. A slightly easier place to access it is on the end of diode D3 nearest the micro. It’s still some fiddly soldering, but it’s easier that a QFN pad on the SAM R21 itself.

PA17 (pin 18 of the microcontroller) has a decent PWM output. Unlike the one I found on TP5 of the E27 bulb, this stays high when the bulb is 100% on. It’s a 3.3V signal. It doesn’t seem to be quite linear – i.e. 50% brightness isn’t a 50% duty cycle but this may be deliberate to compensate for how bright it actually looks.

TP25 has a DC voltage of about 14V which is fed to the LM2204 3.3V regulator. This seemed handy for driving the coil of a 12V relay.

I rigged up a simple relay circuit – using the 3.3V PA16 output to drive a NPN transistor that can then drive the relay. Add the usual flyback diode (and a MOV across the relay contacts for the benefit of inductive loads) and all is g0od!

Poor post sales service from Zero Motorcycles

If you want the tldr version

I’m now a Zero owner, but not yet a Zero rider. I paid for a Zero FXS 8 weeks ago. Due to Zero’s errors, the process of registering it in my name hasn’t even started yet. In that time the price dropped £900. Zero won’t talk directly to me but have said via the dealer that it’s tough luck. They’ve got my money and don’t really care about either.

The full story…

After my test ride of a Zero FXS it was only a matter of time before I got one. The things up in the air back then were:

  1. What’s going to happen with the long-promised UK electric motorcycle grant?
  2. What have Zero up their sleeves for 2017?

In October the grant was announced as starting from 1st Jan 2017. And in November Zero announced that there were a few changes to the 2017 line up, but nothing huge. For the FXS it was really just a wider drive belt and a higher amperage controller. No battery or motor changes.

This was enough for me to order and pay for a FXS on 17th December. Zero listed the 2017 as £9890 (after grant) and had a £1500 off offer on the remaining 2016 models. The 2017 models were going to be available for a few months but the 2016s were in stock. Let me see… £1500 cheaper and available immediately? Easy decision. I went for the 2016 FXS and paid my £8390. The dealer told me I’d have it by early to mid January just after the grant came into force. Perfect.

Balls-up #1

So. Early in January my shiny new bike arrived at the dealers. Yay! But the paperwork didn’t. What? How can a letter take longer than a huge crate? Zero hadn’t sent it, that’s why. Why not put it in the crate FFS? It eventually arrived a few days later.

Balls-up #2

Now, in the UK you need insurance to register a vehicle so I transferred the insurance over from the Aprilia Dorsoduro that I was trading in. Registration normally takes a week or so. I picked 21st January to allow 2 weeks to make sure the DVLA did their stuff. The dealer was happy to let me do this because – well why not? It was only after I’d done this that Zero revealed that well… they hadn’t actually sorted out eligibility for the UK grant at all. No way I’d get my FXS registered by the 21st. This left me uninsured on my Dorsoduro from that date.

My insurance company (Wicked Quotes) only wanted about £100 a year to insure either bike, but admin fees to change things were a different matter. As if the £50 to change it over wan’t bad enough, changing it back for a bit would cost at least £100 and they couldn’t guarantee that my premium on the final change wouldn’t increase. Considering they had quoted me £238 a year at an earlier date, I sense a trap. Anyway, it just wouldn’t be practical to change it. I was now insured on a Zero I couldn’t have and uninsured on an Aprilia that I did.

Oh well, bikeless for a week or two and riding uninsured on the swap-over trip to the dealers. I can live with that I suppose. Just need to make sure I avoid any cameras.

Balls-up #3

So on the 23rd January the grant was finally sorted. Registration underway! A week later I got a call. Registration rejected! What??? Apparently the “certificate of arrival” that is part of the import process had a US formatted date on it. Instead of saying 7th January (07/01/2017), it said 1st July (01/07/2017). The DVLA couldn’t handle this, and better yet, it was an official document that couldn’t be altered. It had to be redone. More delays. Now I don’t know exactly what this form is all about, but as Zero are the only Americans in the whole chain I have my suspicions as to who got it wrong.

Slap in the face #1

Just as this was happening I got a lovely promotional email from Zero. A 2017 FXS for the great price of… £8990. What? Only £600 more than I paid for the £1500-discounted 2016. Now we’ve all bought something that goes on sale later. That’s life. I wouldn’t complain about that. What really irks me is that this price drop is before the 2017s even available – they never were £9390. And it’s before I’ve even registered (due to Zero’s mistakes) my 2016.

I went for a 2016 because it was £1500 cheaper (not really) and available straight away (again no). I dropped Zero an email and copied in my dealer – the totally faultless 21st Moto in Swanley, Kent.

Slap in the face #2

Zero didn’t think it necessary to reply to me. After the dealer chased them Zero Europe said they’d see what they could sort out with Zero USA. After yet more chasing, I got a reply via the dealer.

  • Could I drop this 2016 (with a serious known issue I discovered described here) and take a 2017 instead? No.
  • Would they do anything about the price I paid or the problems they caused? No. Tough.

I was very close to seeing if I could cancel this whole thing, but decided this would be cutting off my nose to spite my face. I’d paid for it so probably couldn’t. And anyway, if anything the dealer would probably end up losing out.

I had also agreed to do some promotional stuff with the Motorcycle Industry Association to publicize the UK grant. I was after all the first person to make use of it. (Free publicity for Zero too!) It would seem unfair to let them down.

Something nice to say at last

Well, after all that ranting I can at least add some positive things to the mix. As I said, 21st Moto have been great throughout all this. Rob was dealing with all this and I know the problems weren’t anything to do with them. Even so, they felt bad about it all and have offered to drop £250 off the price out of their pocket. I kinda feel bad taking this as I have no problem with the dealer at all. As Rob said though, the buck does stop with them from a consumer’s point of view. They are they ones that have to deal with Zero.

Thanks, Rob and 21st Moto. Despite all the hassle I’ve had I can thoroughly recommend them. If the awesome silent power of an electric motor ever gets stale and I feel the need for a roar of a petrol engine, then I’d definitely be heading there with my cash for a Honda.

Hopefully only a few more weeks to go. (It’s now so close to the new 17 registration on 1st March I decided to go for that.) Once I’m on the bike I’m sure this will be a dim memory. And the weather’s not exactly been bike-friendly lately – below freezing with snow and ice.