Atom Feed
Comments Atom Feed

Similar Articles

2012-03-27 16:26
Adventures in Class D (part 2b) - ringing in switching circuits
2011-06-03 18:53
Adventures in Class D (part 1)
2009-12-26 09:30
Blog Evolution
2008-10-19 16:20
The perils of CSS
2016-02-17 16:13
Simple Python Plugins

Recent Articles

2019-07-28 16:35
git http with Nginx via Flask wsgi application (git4nginx)
2018-05-15 16:48
Raspberry Pi Camera, IR Lights and more
2017-04-23 14:21
Raspberry Pi SD Card Test
2017-04-07 10:54
DNS Firewall (blackhole malicious, like Pi-hole) with bind9
2017-03-28 13:07
Kubernetes to learn Part 4

Glen Pitt-Pladdy :: Blog

Adventures in Class D (part 2)

Carrying on from where I left off - the output MOSFET drivers seem to be working on the bench, now I turn my attention to the controller/modulator.

All about modulation

Since this is only going to be used for low bass (<<100Hz), I'm not getting too fussed with open loop linearity since the feedback, but neither am I going to produce a careless design.

The basic architecture is a standard self-oscillating amp based on an integrator and a hysteresis stage. I have made the input and integrator balanced so that it can cope with the H-Bridge output and also gets extra noise immunity for free. I am using standard 5534/5532 op-amps which are well proven and not only have decent performance, but also decent output current which means I can keep impedances low and reduce the interference being picked up. I certainly wouldn't use these for high frequency amps, but they're plenty good enough for low frequency.

Having sufficient bandwidth in the modulator is important as the ideal "linear ramp" contains a fair amount of harmonics (else it would become sinusoidal) and keeping it's integrity is vital to the linearity of the amp. Fortunately this is rather easier with a low frequency amp as we can run at quite low modulation frequencies and keep plenty of margin on the bandwidth requirements.

I thought I was terribly smart at university when I worked out this design for myself, only to find the same idea a few weeks later when rummaging in the magazine archives for the '70s in the university library, and I'm sure there where many more appearances before that. Really, it's a bit obvious if you've ever done the usual trick of hanging an RC across a Schmitt inverter to turn it into a simple oscillator.

This does have a side effect that the carrier frequency shifts with the amplitude, but that may not be a bad thing - at low signal levels it's highest so it provides the most transitions and hence the smoothest output waveform. That's no bad thing!


With switching circuits, layout is critical, especially when there are hefty currents at play as there are with this design. Again I started witht he riskiest bits first: The drivers and output stages.

The drivers are particularly difficult as they need to float with the MOSFETs as they switch, and that means their "local reference" is switching with the output. Coupling to supplies and ground can result in spikes being coupled into the circuit as it switches and that could cause misbehaviour, instability, and it will probably all end with that familiar burning smell.

The drivers are hence not surrounded by ground planes and care has been taken to route supplies and ground away from the most sensitive parts of the drive circuit.

Grounding is critical as that's the ultimate reference point. I have ensured that the supplies are all symmetrically routed around ground and it comes to one star-point as it best practice.

The supply caps are on the board, but also high frequency electrolytics close to the output devices with a direct ground path between them to ensure the supplies are kept rigid at high frequencies.

At low frequencies we have 40000uF of supply capacitance per rail which aught to be be sufficient to deliver the grunt when needed.

Using Kicad

I had tried out a load of CAD packages and continually ran into the problem that there are none that seem to be sufficiently unrestricted for a design like this without spending a fair amount of money.

I eventually started playing with Kicad and it's actually not bad. It's not without some rough edges, but is very usable for jobs like this. Other things I have tried have been quite crashy, and no more refined than Kicad, so I give it a thumbs up.

I believe there is a lot of work going into areas where it is much needed like the Module (PCB symbol) library code and a load of other key areas, and it can even do 3D views of the board... that is if you spend the time making up the 3D stuff to go with your PCB modules - I haven't as for boards like this they are not really of much benefit. 2D does the job.

One area where Kicad did struggle was using multiple instances of the same subcircuit. It seemed to use the port names as net names and hence ended up with a number of nets joined together, though it did plenty of other stuff right like component numbering on each instance of the subcircuit.

I'm sure before long it will be doing boards like this without difficulty.

Finished PCB in Kicad

Once I've spent sufficient time sleeping on it to be happy that the design is good (I've already added a few bits and tweaked the input circuit a bit), it'll be off to be made and then the fun begins of debugging and getting it working.

It's rather like software, just less predictable - software isn't so prone to unseen "parasitic code" (bugs in tools / libraries) messing stuff up. It's also a whole lot more hassle and cost to fix bugs and do a new "build"  :-)