Site description

A blog for electronics professionals, amateurs, hackers, and anyone interested in the world of electronics.

30 March 2011

The Amp Hour #36 — Big Business Buffoonery

The Amp Hour podcast is essential listening for anyone interested in electronics. Dave Jones, Chris Gammell (and occasional guests) have a chat and a rant about life, the universe and electronics. Well, mainly electronics if I'm being honest. Great entertainment for the drive to work, or something to listen to rather than the bloke at the next desk. Unless you work in Ohio or Sydney, in which case one of them might well be the bloke at the next desk!

Yeah, they might possibly have mentioned my LCR meter project too. Cheers guys!

The Amp Hour

23 March 2011

Design for a Precision LCR meter (AKA: Prospero Gets a Brother) - Part 1

I suppose this project should really be called Antonio as it is the brother of Prospero, but it doesn’t exactly sound right for a piece of test equipment. An appropriate name evades me for the moment. It is probably just as well.

Measuring Inductance, Capacitance and Resistance.
In designing Prospero (the RF vector network analyser) it has come to my attention that the inductance and capacitance measuring equipment currently available to me isn’t exactly precision lab reference grade. A resolution of 1nF isn’t really good enough when you are working at sub-pF level. Upon investigating, it seems that a basic LCR (Inductance, Capacitance, Resistance) meter starts at around £150. If I want to measure the equivalent series resistance (and I do) then I am looking at upwards of £250. Hmm. I don’t really have that sort of money to spend on another meter, so just what is an engineer to do? 

Well, after an amount of thought (somewhat less than a second), I decided that building my own was probably the best way forward. But then you knew that didn’t you! 

So, what architecture? There are plenty of simple embedded micro based meter designs around, but they are all designed around similar methods and are rather limited in range and accuracy. I had specified that the unit be capable of a test frequency of at least 100kHz and most units seem to stop at 10kHz. That inherently reduces the ability to read small value components with a good degree of accuracy. I remembered that a few years ago I was sent a sample of Analog Devices’ AD5933 1MSPS 12-bit Impedance Converter. I had meant to do something with it, but it has certain limitations (which I will go into later) and at that time I was working in a lab which had nice test gear, so the chip got filed away. After a good read through of the data sheet however, I decided the AD5933 would probably take a lot of leg work out of my design and was good enough for my purposes.

Fig.1 AD5933 Impedance Converter - Simplified Block Diagram

Never Satisfied
As I mentioned, the AD5933 isn’t perfect. The 10-bit DAC generates spurious signals outside the desired band (although the LPF filters many of these out in the receive section) it is inherently very poor at measuring low impedance values, and the maximum text frequency is limited to 100kHz. Ideally I would have liked 1, 10 or even 100MHz available to test RF components. So I set to work to design something of my own. The first result is reproduced below.

Fig.2 Improved LCR Meter Design - Block Diagram

The intention was to DDS generate a clean 24-bit sinusoidal signal in software (probably with an ARM Cortex M3) and do the D-A conversion with a fancy hi-fi  chip (they really are absurdly cheap). They can be pushed to well over 200KSPS, giving a precise and clean 100kHz source with only a little filtering. Simultaneous measurement of the current and voltage components is to be done with another 24-bit 200KSPS+ hi-fi ADC chip and streamed into the processor via DMA.

To give flexibility, the output is capable of driving peak-to-peak levels between 0.01V and 10V at up to 10mA, with programmable offset. Voltage is sampled across the test ‘probes’ in a 4-terminal manner, with a set of programmable gains to ensure the best possible use of the ADC’s dynamic range. Current is measured via a transconductance amplifier (again with programmable gain) which produces a voltage proportional to the current through it, but without the ‘burden voltage’ associated with a simple resistor as used in most current measurement.  This is then presented to the second ADC channel. After grabbing a large enough sample, software performs a simple Fourier conversion to the frequency domain. Comparing phase and magnitude gives us our desired parameters.


In one of those moments to which most engineers are prone, I decided that wasn’t enough. I really needed 1/10/100MHz and had 14-bit 400MSPS DDS chips in stock. I could use one signal as a source, and a second (coherent) signal to compare the phase in a mixer, reading the magnitude in an ADC. Excellent.
One slight problem though. What I have actually described there is a network analyser. Basically it is a cut down version of Prospero, limiting at 100MHz instead of 500MHz, and not being able to measure the reflected signal. So what is the point making it when I will have a better tool in my hands before long? None at all! Sigh. I had gone around in a huge circle.

Back To The Beginning!

Anyway, I decided to go back to the start and go with the original AD5933 design. It can be modified to handle low impedance values, and the addition of a cheap external DDS makes the clock scale down to audio frequencies, which is handy for audio components such as loudspeakers etc. As you can see from the diagram below, the current sense gain will be selectable.

Fig.3 LCR Meter Block Diagram - Excluding Low Impedance Adaptor

Control is to be done via a simple PIC16, with connection to the PC via an FTDI USB module. In theory I could probably bit-bang the operation from the FTDI module, but that would probably end up being more expensive and more complex than a cheap and fast PIC16. With an on-board micro, I could build in an LCD and do all the maths on the embedded micro but, to be honest, it isn’t going to move outside the lab, and it is far easier to do more exotic maths on a nice fast PC with a good display. Nevertheless, I will probably provide the appropriate connections to drive a standard LCD text module.

For the moment, it is my intention to derive power from the USB connection. The entire system is low power, with the AD5933 drawing a nominal 10mA at 3V. Dropping from 5V to 3V also gives me the opportunity to provide more precise voltage regulation than USB gives, and also the ability to remove noise on the power lines, both of which improve the accuracy of the system.

In Part 2 I intend to cover the design of the low impedance adaptor, how the current range is selected, and some ideas on how the system accuracy can be improved beyond the 0.5% claimed for the AD5933. Until then, toodlepip!

17 March 2011

The Brotherhood (and Sisterhood) of Engineers

I have an awful lot of updates to write; The designs of Prospero and Miranda (Vector Network Analyser and JTAG programmer respectively) are coming on nicely, and there is a huge amount to say. But I am not going to, at least not yet. There are much more important issues I need to speak about.

Japan. One week on and things are at least starting to be a little clearer, but the media are largely still hysterical and uninformed. Even respected sources such as the BBC, CNN and New York Times are having trouble getting good quality information. For example, the BBC was presenting the loss of coolant in the used fuel storage tank as "current" more than 18 hours after the event. Media outlets are even copying things off each other, ending up with a strange sort of echoing feedback loop. Instead of reporting the known facts, they are falling back on the old method of wheeling in some supposed expert or other, who is then made to hypothesise what may be happening. The Japanese broadcaster NHK is not massively better, but at least seems to have faster access to what facts there are. You can currently stream NHK here via Ustream: . Their main fault is not displaying a "repeat" caption on video that might be an hour or two old, giving the impression that it is live.

Enough complaining though. I do not propose to cover the horrendous humanitarian situation. Far better people than I have written about it, and anything I could add would be pointless. You have seen the photographs and the news footage, they all speak louder than words.

My first comment is what happened in Tokyo. Or rather, what didn't happen in Tokyo. I don't know for sure what the earthquake measured in the city centre, it would be considerably less than the 9.0 at the epicentre, but still up around the 7.8 level. Beyond what they were theoretically designed to withstand.

If you are an engineer (of whatever discipline) you will know that engineers share that intangible "something". Whether you are in electronics, automotive, structural or civil engineering, we all share the universal foundations of maths and science and a similar outlook on life. The attitude of doing the best you can, going that bit beyond the specification, to make the best possible product, whatever it happens to be. Because you just never know when that little extra can make a big difference.

Quite often, when we do our jobs right, nothing happens. A Formula 1 car crashes backwards into a concrete wall at 150 mph and the driver walks away. The media call it luck, or maybe God's will. What they rarely mention is the truth: Thousands, possibly millions of hours of hard work by clever, educated, experienced engineers. To every single one of the architects, designers, testers and yes, even you bureaucrats who came up with and enforced the Tokyo building regulations, you have my utmost respect. So far as I am aware, nothing happened. No pictures flashed around the globe of skyscrapers that collapsed. No footage of thousands of sobbing bereaved Tokyo people. Other areas weren't so lucky, with fires breaking out and many people losing their lives. Let us hope that in future years that those areas can enjoy nothing happening too. It won't be luck that does that. It won't be God. It will be engineers. Invisible, un-named, unseen. Working hard to make sure nothing happens. That makes me proud.

Events move on however, and all the airtime is now being devoted to the Fukushima Daiichi nuclear plant. I'm not going to say much about nuclear plant engineering. At this time we don't have much information about how things failed and what the mechanims were, so it is difficult to say anything except to ask why they think it is a good idea to build nuclear plants near sea level on the coast facing the Pacific tectonic plate boundary, which has historically experienced powerful earthquakes and tsunamis. I believe nuclear power has a big future in the future low-carbon world, but not if they build fundamental weaknesses into power plants, relying on luck for nothing to happen.

Finally. I don't have many heroes on my list, and there are certainly no overpaid footballers or other sportsmen and women on it. The emergency workers who ran into the World Trade Centre towers when any normal human being would have been running away are certainly on it. Hell yes. I think that list has just acquired some more names; The engineers, technicians and others who are currently battling to stop Fukushima Daiichi nuclear plant becoming a hot Uranium dust emitter. These people must know that their lives are probably going to be severely shortened by what they are having to do. Ladies and gentlemen of Fukushima Daiichi plant number 1, you have my profound respect and admiration. Japanese popular culture has a long history of heroes and superheroes. I suspect they have just found some real superheroes, whose actions will be remembered long into the future.

I salute you all.