What’s all this Black Swan stuff, anyhow?

I’m somewhat of a fan of Nassim Nicholas Taleb’s book, “The Black Swan”. To me at least, the book is about the human tendency to tell ourselves stories about reality, and then substitute the stories for what is really there. This idea should be familiar to any student of Zen. Taleb calls it the narrative fallacy, and explores its messy implications in business and finance.

It struck me today that this is how electronic design proceeds, too. We start by telling ourselves a story about how the proposed circuit will work. The electrons will go down here, some of them will go this way, this part will oscillate at 123 megahertz, and so on. We either make it up in our heads, or orchestrate it on a circuit simulator, but in either case we are dealing with a Platonic approximation to the real circuit.

It follows from this that the lab bench is Taleb’s “Platonic fold”, where our narratives collide with the messy reality of what the prototype circuit actually does. This is the origin of the pearl of wisdom attributed to (the sadly late) Bob Pease or someone similar: that a circuit always works, it just doesn’t always do what you expect. Anyone who has done any practical work with electronics knows the brain-wringing feeling of struggling with a circuit built on wrong assumptions in this way. It simply refuses to do what you want, for no reason that you can see, because your reasoning is based on the same faulty assumptions. The best you can hope is that you have the “Aha moment” and come away with your narratives more firmly grounded in reality.

It also follows that by going into production with a circuit that doesn’t work the way you think, you invite it to start doing things that you didn’t expect when it gets out in the field. This can generate Black Swans in exactly the same way as Taleb’s example of running a hedge fund based on invalid mathematical models.

Usually the results are negative and your company simply goes bust, but once in a while you can benefit, as in Bob Pease’s tale of the Philbrick P2 op-amp. This was a groundbreaking product that contained about $5 worth of components, but delivered enough value-added to the customer that it could be sold for the price of a small car. The P2 made the company, even though (according to Pease) nobody in the company actually understood quite how it worked. But in spite of this they managed to produce it consistently and have it work reliably.

What’s more, if this is true then the world of electronics must have its “Fat Tony” characters, rather than being purely the province of “Dr. Johns” as one might expect. (For those unfamiliar with the book, you might like to mentally substitute Thomas Edison for Fat Tony and Nikola Tesla for Dr. John.) They are probably the same people that George Philbrick called lightning empiricists, after the fashion (though before the time, this being the 1950s) of Taleb’s skeptical empiricists. Indeed, Fat Tony would probably have wholeheartedly approved of the above mentioned P2, if he didn’t actually design it.

Anyway, that’s me on the narrative fallacy in electronic design. Next time I’ll write about the normal distribution and power laws. Taleb has his “Great Intellectual Fraud”, and communications theorists have their AWGN – “Additive White Gaussian Noise”. Until then, what are the odds of Bob Pease and Jim Williams dying the same week? I make it about 1 in 9 million, but sadly it happened, as Pease crashed his 1969 VW Beetle on the way home from Williams’ memorial service. Both were legends of analog electronics, and the impact is hard to overstate: it’s as if Jane Goodall and David Attenborough got trampled by the same elephant.

In a twist that Taleb may have found bitterly amusing, Pease had just self-published a book on safe driving, which didn’t sell.

Finally, a use for Internet Explorer!

So, to cut a long story short, due to my employers’ “interesting” IT policies, I’ve ended up providing my own computer, which can only be connected to the guest wi-fi, not the real network. However, I would still like to access my work e-mail, which is kept in MS Exchange.

Enter “Outlook Web Access”. Now normally this isn’t a great deal of fun to use: the interface is clunky, and it doesn’t even refresh itself to show new messages as they arrive. But this is because you are limited to the “Light” version when viewing it with any browser other than IE.

Load the full version in Internet Explorer, and by some Microsoft magic, it is almost identical to the standalone version of Outlook inside a web browser container! You can even right click things and they do what you expect.

So, that makes two neat pieces of engineering from Microsoft that made my day. The other one was Windows 7.

Make a cappuccino, ghetto style

So, I recently got a copy of Harold McGee’s “On Food and Cooking”. Reading the chapter on milk foams inspired me to make this cappuccino recipe. It wouldn’t fool a Barista, but it looks and tastes better than what you get from a domestic espresso machine with its pathetic steam nozzle.

You will need: A way of making good, strong black coffee, such as a stovetop moka pot, and some ground espresso beans.

Some full fat milk, a jam jar with lid, a microwave oven.

Put the coffee on to brew. When it’s nearly ready, pour about 1 inch of milk into the jar, put the lid on and shake it as hard as you can for about 1 minute. This makes it frothy. Now remove the lid and cook it in the microwave for about 40 seconds on full power, or until it starts to foam up more. This cooks the foam and stabillises it, while making the milk nice and hot, as the steam from an espresso machine would do.

Finally combine the coffee and foamed milk in your favourite mug. You can put the milk in first and pour most of the coffee down the side, and use the last little bit to make a pattern on the foam.

Douglas Self, Jim Williams, and a sunny Saturday morning

Writing this, I was inspired by an article by Jim Williams called “Max Wien, Bill Hewlett and a rainy Sunday afternoon”, which documents his investigation of the Wien bridge oscillator and how to lower its distortion.

1. I’m a fan of Jim Williams, and his crazy cartoons and application notes with names like “Switching Regulators for Poets”.

2. My prototype Blameless power amp was getting good enough that I needed a really low distortion oscillator to test it. Surprisingly, even my 24-bit home studio gear wasn’t good enough: sigma-delta converters generate a lot of ultrasonic noise that inflates the THD figure. And my Twintrak Pro mainly generates smoke.

3. I could not find a Tektronix SG505 or SG5010 for sale at a reasonable price.

4. Neither could I be bothered building the oscillator section of Bob Cordell’s DIY THD analyzer.

5. A search of my kitchen junk cupboard yielded a RA53 thermistor.

6. A Google search of the part number revealed that it’s the magic ingredient for making a really good Wien bridge oscillator. So, using the RA53 and a NE5532 op-amp, it only took about an hour to make an oscillator that ran off a couple of 9v batteries, and measured about 0.007% THD at 10kHz on my analyser. (The remaining THD is probably a combination of ignoring Williams’ Law, thermal modulation in the thermistor, and the dirty mains in our lab.)

7. So, this morning I tested the Blameless using my new low-distortion oscillator. It was clean enough that I could see the “gm-doubling” distortion described by Self when the amp was biased too hot: the first time this effect has ever been reproduced at Conner Labs. 🙂 Optimal bias seemed to be about 8-9mV per side, though it wasn’t clear whether this was just cancelling the oscillator distortion, and the true minimum might be at a higher idle current.

8. The results were really good. The 10kHz, 100W, 4 ohm THD came out around 0.01%. I used the 80kHz low-pass filter, but from inspection of the residual, it wasn’t filtering much: mostly the 200kHz switching noise that our mains is ridden with. At 10kHz, 2W, it was about 0.007%.

9. I cranked it up to 140W and let it get really hot. This only caused about 1mV change in bias, and checking again at 2W, the THD reading and residual looked pretty much the same. Then I rigged up a fan to cool it down again, and that didn’t make much difference either. Yay for those ThermalTrak transistors, then.

10. Renting an Audio Precision test set costs about £600/month for the entry-level one. So, I decided to call it quits at this point. The Blameless is now complete, and it just needs another channel, DC offset protection, and a box. I shall publish the schematics soon.

11. When Jim Williams was done with his oscillators, he cooked some hot dogs. I am ashamed to admit that I ate a McDonalds.

12. Now I am obsessed with trying to make a digitally controlled version of Cordell’s oscillator. 🙂

Blameless first sound! :D

Today, after much testing with various dummy loads, including the dreaded 4 ohm reactive one (which showed up some parasitics that I managed to get rid of) the Blameless was finally plugged into a speaker.

It werks!
It werks!

Attempts to measure the THD have so far failed. They really just show up the limits of my  THD measuring system, which is currently no good for anything except finding gross faults.

For instance, the reading I previously got of 0.05% at 10kHz and 120W. When I took the amp out of circuit and connected the analyser straight to the oscillator, the THD reading increased to 0.09%.

The THD analyser does show up crossover spikes, though, if the output stage is underbiased. They were pretty much invisible by a bias voltage of 10mV per side (20mV total) which corresponded to 200mA total idle current. I set it to 13, which gives the 26mV total that some experts recommend.

Anyway, it’s working, and experimenter expectancy notwithstanding, not to mention lack of one channel, I swear it sounds better than my old MOSFET amp. Maybe there is something in Douglas Self’s claims of poor crossover distortion from MOSFETs. Once I get the other channel built and the system put together, I will make that low-distortion oscillator and do a THD shootout. Or an ABX test or something. Anyone want to lend me an Audio Precision test set? 🙂

More Blameless progress

The Blameless project is grinding on!

.

4-layer boards for the output stages were designed in Eagle and ordered from PCB Train. Some samples of the ONSemi NJL4281/4302 transistors with built-in thermal sensing diodes were obtained. The whole lot was fitted to a large heatsink using Sil-Pad A1500 high performance thermal pad stuff.

After testing using a bench power supply, it was connected to a large transformer, rectifier and some capacitors.

The power was turned on and amazingly it failed to explode.

More detailed info to come, but the maximum output is about 120-150W into 4 ohms, the THD about 0.05% or less at 10kHz and 120W (so should be nearer 0.005% at 1kHz) and the short circuit protection, thermal compensation etc. all works as planned.

Scripting fun: Rename files by date in Windows

When I’m working on a computer, I frequently make backups of what I’m doing. There are a lot of ways to do this, but the one I use is a bit ghetto.

1. Right click the folder with my work in it, and select “Send To > Compressed (zipped) folder”

2. Rename the resulting zip file so that the name includes the date in ISO format. You have to rename it in order to store multiple versions in the same place, so might as well add some useful data to the name.

3. Copy it to a backup drive somewhere.

I got fed up of doing the renaming manually, so I created (cobbled together from various Howtos) a batch file to do it for me. Here’s the code:
@echo off
FOR %%V IN (%1) DO FOR /F "tokens=1-6 delims=/: " %%J IN ("%%~tV") DO IF EXIST %%~nV-%%L%%K%%J-%%M%%N%%O%%~xV (ECHO Cannot rename %%V) ELSE (Rename %%V %%~nV-%%L%%K%%J-%%M%%N%%O%%~xV)

Paste that all into a text file (one long line!) and call it something like RenameByDate.bat.

Now, if you drag and drop another file onto this batch file’s icon, it should get renamed to its original name, plus the date and time of its timestamp.

If this doesn’t work, you may need to enter the following three commands at a command prompt, to enable drag and drop for batch files.
ftype batfile="%1" %*
assoc .bat=batfile
regsvr32 /i shell32.dll

(from here)

Finally, place the batch file in your Send To folder. (C:\Documents and Settings\YourUserName\SendTo)

Now you can rename any file, adding the date and time to the name, by right-clicking it and selecting “Send To > RenameByDate.bat”.

In other news, I’ve mostly been automating Bill Of Material generation with Perl.

First THD analyser results!

I’ve finally got the THD analyser hooked up and working! Not very well, though, because I have to use it with my not-too-hi-fi signal generator, on account of the analyser’s own oscillator section being AWOL. My sig gen is DDS-based, so it puts out lots of high-frequency crud and DAC quantization errors, and these overwhelm the amp’s own contribution to the residual. Except if I test at 10kHz and press the analyser’s low-pass filter button, which kind of fixes it…

Anyway, I hooked the Blameless up to an unregulated power supply to pump in plenty of hum and grunge (got to test that ripple rejection too!) and made some THD + Noise measurements.

THD test setupTHD at 50W50W residual

10kHz, 50W into 4 ohms: 0.086%

10kHz, 2W into 4 ohms: 0.037%

(I measured at 10kHz to try and force the amp to generate more noticeable THD levels. And yes I have the hi-pass button pressed: some hum is getting in somewhere…)

I also tried setting the bias pot to minimise THD.  At 50W, this happened at a setting so cold that there was barely any bias at all! I measured a Vq of around 300uV. But at 2W, the minimum occurred at a Vq (across each emitter resistor) of about 14mV.

2W THD, underbiased2W THD, bias just right2W overbiased

I think what’s happening is that at high power and high frequency, an overly cold bias helps to counteract the transistors’ slow turnoff. Too cold bias effectively starts turning them off in advance. This gives a false THD null. 2W seems to be a better power level for setting it.

At both power levels the THD nulls were very broad, and seemed to stay stable when I let the heatsink get burning hot, and then applied a fan to cool it back down.

Still a long way to go in terms of refining the THD measuring setup… but it’s a start!

Blameless short circuit protection

So, now the short-circuit protection is tested.

I used a dual-slope VI limiter as described by Self in his book, except I simulated it in LTSpice and played with the component values to lower the power dissipation a little. Self’s original design allowed the transistors to dissipate nearly their full rated 250W, and I thought that was excessive, since it’s only possible at a case temperature of 25’C, and that will never happen in practice.

I guess his reasoning is that since the amp will only amplify AC signals, then under short-circuit conditions each transistor will conduct with a duty cycle of 50%, so the mean dissipation will only be 125W. But I can imagine situations where that wouldn’t work.I also plan to try the NJL4281/NJL4302 transistors in the future, and these have less SOA than the MJ15024/MJ15025, the devices that Self designed the circuit for.

My new values were supposed to make the circuit limit at about 125W. Anyway, so I made the circuit up and tested it with the method described on Rod Elliot’s site. Namely, I shorted the amp’s output with a 0.1 ohm resistor, and fed 100us pulses at a repetition rate of 10Hz to the input. I did this with the amp running off two regulated supplies, allowing me to vary the rail voltage and note the current for each voltage.

At first, the negative rail had no limiting at all! It started out at 12A and headed skyward from there. It turned out that I put a diode in backwards, and also the gain of the PNP limiter transistor was low, and the VAS current limit was a little high. Once I got that fixed, I plotted out the two sets of results in Excel, and added loadlines for reactive and resistive loads on 40V rails.

Protection locus

So you can see that with one pair of output transistors installed, we can just barely drive a 4 ohm resistive load or an 8 ohm reactive one. To drive a 4 ohm reactive load, we’d need two pairs, which is what I was expecting, and two pairs is what I plan to fit.

Finally as a sanity check I rigged up a reactive load: A big iron cored choke wound with about 80 turns of heavy wire. I put two 4.7 ohm resistors in series with it, and it could drive that easily at any frequency. Go down to one 4.7 ohm resistor, and I found a frequency where the limiter would activate and cause crazy clipping, like in Rod Elliot’s Figure 4 linked above. Again this agrees with what I expected, so we’re good to continue!

Note that before trying this test, I added the catch diodes from the speaker output back to the rails. Otherwise the output devices would be destroyed when the limiter kicked in.