Wolfson Pi Audio Card – first impressions

Ever since the Raspberry Pi came out, I’ve been experimenting with its audio capabilities. The latest audio gizmo available for it is the Wolfson Pi Audio Card, which promises 24 bit, 192kHz recording and playback, with analog and digital I/O, for a very reasonable price. So of course I ordered one straight away. πŸ™‚

After waiting a month I finally got my hands on it. The software installation is somewhat unclear so I will document what I did here. I didn’t want to use the Wolfson official image as it was a massive 8GB download. I started with a copy of the image that I developed for PiTunes, and applied this patch to it, which adds the Wolfson kernel and the support files for the audio card. I then changed mpd.conf to use audio output device hw0,0 (it was previously 1,0 for the USB audio device) and added a call to SPDIF_playback.sh in my .bash_login file, to set the card up for digital output.

I also removed the invocation of pikeyd from /etc/rc.local, as the keypad and encoder were not present. They can’t be used anyway, since the Wolfson audio card hogs all of the GPIO pins. It doesn’t really matter, as MPD can always be controlled remotely.

On firing this up, I was surprised to find that it worked first time! πŸ™‚ I verified the output to be bit perfect at 24 bit, 96kHz. This is possibly the best value for money HD audio source you can get anywhere: you should be able to pick up a Raspberry Pi, a Wolfson Audio Card, a wifi dongle and a hard disk for under Β£100.

Current dumping for dummies?

This article (series of them with any luck) is inspired by Nick de Smith’s Quad 405 project. He was getting better distortion figures than my Blameless build: 0.002% at 20kHz! And from an amp that operated in Class-B and needed no bias adjustment or thermal compensation, how could this be? I had tried to understand the current dumping concept before, and failed, but this time I was determined!

And this time I had some help from Keith Snook’s excellent resource on the Quad amps. His series of “DCD Mods” to the original Quad circuit actually make the operating principle clearer. And, he had a copy of the classic Wireless World article: “Current dumping – does it really work?” by Lipshitz and Vanderkooy.

So here is a simple, intuitive (and maybe even correct? πŸ™‚ ) explanation of how current dumping works. Please refer to Snook’s DCD Mod-3 schematic, as well as the diagrams below, in which I’ve reduced the circuit to the bare minimum possible.

Current dumping amp simplified

You can see that the amp consists of three parts. First, a Class-A, current feedback error amp. In the DCD Mod-3 circuit, the inverting input of this amp is TR2 emitter, the non-inverting input is TR2 base, and the output is TR7 collector.

Second, a hefty Class-B output stage that runs with no idle current. In the DCD Mod-3 this is TR8, TR9, TR10 and associated parts.

Third, what Nick de Smith referred to as the “Maxwell-Wien Bridge”. This is obvious in the DCD Mod-3 schematic. I’ve drawn it in the same way here, but I’ve labelled the components Z1, Z2, Z3, Z4 in accordance with Walker and Albinson’s original analysis.

Then, to make things a little clearer, I’ve drawn the circuit again, but replaced Z2 and Z4 with resistors, of values roughly equivalent to their reactances at 20kHz.

We’re now in a position to see intuitively how the circuit works. The error amp is looking at the output from the output stage, fed back to its inverting input through Z1,Β and comparing it to the desired audio signal on its non-inverting input. It amplifies the error by a factor of -(Z2/Z1) which is -100 in my circuit. This amplified error drives the output stage, like in any normal audio amplifier. But a portion of it is also fed forward directly to the speaker through Z3. This forms a potential divider with Z4, so the speaker sees the fed-forward signal attenuated by a factor of roughly Z3/Z4, which is 100.

So, the error got amplified by -100 and then attenuated by 100 again. It follows that the error gain to the speaker is just -1. In other words, an equal and opposite signal cancelling the original error, to give a perfect output. So, we’ve rederived the original Walker balance condition: Z2/Z1 = Z3/Z4, or Z1Z3 = Z2Z4 as Walker wrote it.

(I’ve taken some liberties with a “1” here and there: the potential divider really attenuates by a factor of 101. But so did Walker and Albinson and everyone else. I’ve also assumed that the output stage’s output impedance is negligible, and its input impedance is high enough not to load the error amp down and kill the feedforward signal. Again, I believe these assumptions were also made in the Quad 405 design.)

However, as every amplifier geek knows, Z2 is a capacitor and Z4 is an inductor. In fact, I remember Quad’s full page ads in the hi-fi press, that showed nothing but a picture of the inductor and the Queen’s Award logo.

Intuitively, what now happens is that the error amp integrates the error, but Z3 and Z4 are now a high-pass network that differentiates it again, so the feedforward works just the same as if Z2 and Z4 were resistive. But using reactances leads to some elegant synergies: each one ends up doing at least two good things at once, hence presumably the Queen’s Award.

Using a capacitor for Z2 gives classic dominant pole “Miller” compensation for the error amp, with all the associated benefits.

Using an inductor for Z4 saves power, isolates the output stage from nasty capacitive loads, and low-pass filters the remaining distortion harmonics.

Indeed, Z2 is the compensation cap, and Z4 the output coil, that most classic power amp designs need anyway. The only component that a classic amp doesn’t have is Z3. This suggests to me that an ordinary amp could be converted to a current dumper by just adding a resistor from the driver stage through to the speaker end of the output coil. (It also suggests that Quad’s ads should have showed a 47 ohm resistor instead of an inductor.)

A current-feedback amp with a hefty driver, like the Alexander, seems like it would be the best candidate, but I think it should be possible with a “Blameless” type voltage-feedback circuit, too. The only complication is that when you go to voltage feedback, Z1 isn’t a single resistor any more. Its effective value, as far as bridge balance is concerned, is the attenuation through the feedback network, divided by the input stage transconductance.

I could be wrong, but if this is true then the usual Blameless values give a value for Z1 of about 2500 ohms. That means the output coil would need to be 5 times bigger, or Z3 5 times smaller. That makes it 8 ohms, so in order to drive it, the error amp becomes an output stage and we’re back to square one! So, the Alexander is a much more attractive candidate for conversion, as it has Z1 = 750 ohms and Z2 = 100pF, giving a value for Z3/Z4 similar to the Quad 405.

I’ll leave you with a puzzle: In the DCD Mod-3 circuit (and indeed every other Quad 405 circuit) what are D5 and D13 for?

Cordellicious results

So, the low distortion oscillator is all put together.

Oscillator innards.

And it works very nicely.

Oscillator working, whee

When the oscillator output is connected straight to the analyser input, it reads around the analyser’s specified floor (0.0021%) between 20Hz and 20kHz. The above picture shows 0.0017% at 1kHz with the 80kHz low pass filter engaged.

I took it home and used it to test my new Selfless Amp against the old Ice Block. The “Selfless” was somewhat degraded from its earlier bench test results because of hum induced by the transformer, but it still managed around 0.002% at 1kHz and 0.008% at 20kHz. (Both about 70W into 8 ohms: the readings at lower powers were inflated by the hum, and noise from the preamp.) The Ice Block couldn’t match this with 0.005% at 1kHz and 0.015% at 20kHz. In fact, one of the channels had 0.3% and whacking the amp made it jump around frantically. (The distortion reading, not the amp itself! :p) Turned out the speaker relay was bad, which gives me an idea for another project…

Cordell oscillator success

Well, the Cordell low distortion oscillator worked a treat! It didn’t work right away: I left a connection out of the PCB. And then I didn’t have a TL074 chip, so I tried a LMC660, and the chip blew up for some reason, which had me puzzled.

(I just checked the LMC660 datasheet: It’s specified for 15V total supply voltage. I fed it +/-16, a total of 32V. Whoops.)

Then, Cordell’s schematic calls for a 2N4091 JFET, a device with a high Idss and low on-resistance, but I couldn’t find any of those. I tried a BF245C, but it wasn’t strong enough. The AGC loop just whacked the gate as far positive as it could go, trying to turn the JFET “more than full on”. So I kept adding more of the things in parallel, until I saw the AGC go negative by a volt or two. I ended up with 5 of them, bodged onto a piece of stripboard.

A J111 would probably have been a better choice. These are the ones Douglas Self recommends as analog switches in “Self On Audio”, and they have a similar 30 ohm Rds(on). JFETs are so variable, though, you never know what you’ll get.

Frequency control with the “Blue Velvet” pot works great! There’s no noticeable amplitude bounce. Well, except for the fact that it’s backwards: anticlockwise to increase. I couldn’t see any easy way to dismantle the pot and reverse the action.

And, first time on the distortion analyser: 0.0015% at 1kHz! πŸ™‚ That’s better than the analyser’s own spec.

Stay tuned as we post some pics and stuff the thing into the spare bay of the DA4084.

Blameless finished!

Here it is, pretty much done! The weather was pretty bad this weekend, so I spent most of it in the workshop, wiring everything up.

Besides the stuff I’ve already written about, there is a soft-start module (built rather messily on a tagboard), and a preamp/protection PCB. This contains Douglas Self’s anti-thump and DC offset protection circuit, a thermal cutout circuit using the spare diodes in the ThermalTrak power transistors for junction temperature sensing, and a balanced line input stage using the INA137 and NE5532.

Here are some pics.

Gut Shot 1

The 10kHz square wave response, just short of clipping, into a dummy load.

I’ll do some whole-system THD measurements some other time. (I broke the Williams Memorial Oscillator. πŸ™‚ )

Power up, distortion down

I did some more work on my Blameless amp project. First of all, I built another output stage, so I now have two output stages, but still only one driver board. Then, I improved my distortion measuring setup a bit. I shielded all the cables and rejigged the grounding, which reduced the oscillator + analyser floor to 0.0036%, with the 80kHz filter engaged.

With this extra resolution I was able to do some more tweaking of the Blameless. I found the following issues:

The MJE350 transistor in the output stage pre-driver is much slower than its MJE340 “complement”. I replaced it with a MJE15033. This allowed me to reduce the anti-sproggie resistor on the base. I was running 100 ohms on the NPN side and 200 on the PNP side, so I changed both to 150 and retried the reactive load test. There were no parasitics, and hopefully I’ll get a bit more power before clipping now.

I was only running about half of the amount of feedback that Douglas Self used in his experiments. (I used the same input stage gm and compensation capacitor as he did, giving the same open-loop gain at 20kHz, but I designed for twice the closed loop gain.) To fix this, I reduced the input pair’s emitter resistors from 100 ohms to 51.

The input doesn’t like being driven straight off the wiper of a 20k volume pot: when I buffered it with a NE5532 op-amp, the noise and distortion went down. I think Douglas Self implicitly designed all his circuits to run best with a 50 ohm source impedance, because that’s what an Audio Precision test set has. πŸ™‚ He runs the input transistors at 2mA for high slew rate and lots of gm, but the downside is lots of noise current and a low AC input impedance. So, in the finished unit I’ll buffer the volume pot.

Adding a DC offset trim and tweaking it for minimum offset also reduced 2nd harmonic at high frequencies. Again this is what Self’s theory of the input stage predicts.

The biggest improvement came by swapping out the expensive PNP matched input pair for a pair of ordinary transistors that just had high beta: BC213C’s with 350 min. as opposed to the 100 typ. of the MAT03. Saving money while boosting performance, that’s more like engineering than hi-fi πŸ™‚

When I was finished with all this, I had a THD+N figure at 100W, 1kHz, 4.7 ohm load, of… 0.0036%! The same as the oscillator itself. The residual also looked identical to the oscillator’s own. At 100W, 10kHz, I got 0.008%, and this decreased to 0.0065% at 100W, 20kHz. (Because of the 80kHz filter, I assume.)

The 1W figures were slightly higher than the above, but from examining the residual, the extra seemed to be mostly the noise floor of the amp and oscillator, rather than crossover distortion.

These are pretty much the best results I’ve had, and I can almost imagine that if I had an Audio Precision, I’d be seeing the kinds of figures that Self claims.

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.

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!