From Schematic To Product (KiCad + FreeCAD)

As I’m preparing for my new job as hardware engineer/PCB designer, I thought it was a good idea to get some practice going. But this time I decided to go the extra mile by not only just designing a PCB, but also taking care of the placement of connectors and switches because I will also be designing an enclosure for it!

FreeCAD

I found out that FreeCAD as the name implies, is a free CAD package which seems to have compatibility with Kicad after installing the Kicad StepUp plugin. At the download page they will probably make you download version 0.18 but I strongly advise to get your hands on the 0.19 version as in this version are already a ton of bugfixes for many problems that exist in 0.18.

To make things easier, here is a link to the download page for 0.19.

KiCad StepUp

KiCad StepUp (can be found with the plugin manager in FreeCAD) lets you import the .brd file of your PCB project, and turns it into a 3D model. Much like you’re used to in the 3D viewer of Kicad. After this it also lets you import the silkscreen (by exporting a DXF file of the silk screen layers), and the tracks, pads and power planes (just by selecting the .brd file again). FreeCAD will then with the help of StepUp, make sure all the silkscreen and tracks are aligned with your PCB (if you first make sure all units are set the same, otherwise there will be scaling issues).

Did I already mention that it also imports the 3D models of the components if they’re assigned in the .brd file? Just make sure they are .STEP files that come with the Kicad package or what you downloaded from the internet as I didn’t have any success trying to import .wrl (VRML) files. Models that you scaled inside the footprint properties might not get imported with the same scale. Rotation and offset do seem to translate over just fine.

The schematic

For the project I borrowed a schematic from my friend Dylan. It’s his own interpretation and modification of a “Benson preamplifier” of which I in turn added more modifications so it would be more suitable for PCB design (Click to open in a new tab).

The important parts to note is that there is a 1/4″ audio input, output and a DC barrel jack. Besides that there are 4 potentiometer controls the user should have access to: bass, treble, gain and volume. Besides that there is an on/off switch and a LED power indicator.

Working principle Bonson Praemp

My friend Dylan will now explain the working principle of this amplifier:

Hello, this is a circuit based on the Benson Preamp, called the Bonson praemp, because I'm refusing to call it a preamplifier. This is part of a streak of me going through circuits I see and even like, to conform them more to my standards while trying to keep the same timbre and character. I have let Trevor gladly use it as practice material. He ended up turning it into a custom size desk unit without bypass, so I guess he actually treated it as a preamp while I treat it as a distortion pedal.

Up for some circuit analysis? The Bonchild (name changes every time, it's a rule) consists of the same building block repeated over and over, the jfet common source amplifier, using the odd duck of jfets, the J201, very appreciated in the pedal world for the low Vgs and the ease of overdriving it, leading to a streak of jfet adaptations of tube preamplifier of which this and the Benson, together with the very very similar Plexi Drive and some circuits on ROG. http://runoffgroove.com/fetzervalve.html for more info. Did you recognize that test setup at the end? Me and Trevor used a modified version of it in another article!

The tube legacy of this circuit reflected in the high impedance design followed which was the main thing i addressed: common cathode triodes have an output impedance which is many times higher than common source usually, and that creates the need to use higher value resistors in tone networks and such, which can lead to higher Johnson noise (not sure how much it matters here but it makes me feel better) and worse output impedance.

The first stage is an unbypassed common source amplifier, with input impedance of 1M and a flat frequency response. My first change was removing a big resistor in series with the input, which reminds of the grid stopper usually welcome in tube amplifiers, but which I think is of no consequence here except adding noise right where it matters most. 1K or so can do well for ESD protection instead if wanted. In my case this stage biased with the drain at about 6V, which is off from giving maximum clean output and instead closer to the biasing suggested by ROG. I say in my case because already there's some variation between mine and other values I found online. I decided to stick with the decision of not having a way to adjust bias on this stage because it's close enough and this stage will clip only when pushed hard anyway.

After this comes the volume and bass network. In short the Gain is a volume control (voltage divider) to attenuate the signal going into the next stage, and between lugs 2 and 3 there's a conventional "bright cap", which lets high frequencies bypass the attenuation depending on the pot setting. The series resistor tames this effect. C2 in series with C3 form an high pass RC filter with the volume pot's total resistance. What the bass control does is progressively short out the 3.3n cap so instead of a filter with 3,19nF and 100Kohm, we have a filter between 100nF and 100Kohm which lets all audio frequencies pass. Actually the finite pot resistance means when the bass is cut it forms a shelving filter because lower frequencies pass, altough greatly attenuated. That's why you can't use a pot that's too small.

Here the change was getting rid of that awful antiquate 1M potentiometer and redesigning it for lower impedance. I started by scaling down resistance by 10 and capacitances up by 10, then working in LTSPICE to try and get the same response across the whole range. I also removed another big series resistor, which other than noise meant there was always a minimum of -3dB attenuation, which is a small amount on the log volume scale (and hey, if you crank the pot, it can give you a bit more "gain"), but also meant reworking the rest of the passive network because now the bass cut could be more effective. Also hey, I like to save on parts that aren't needed. And hey, this all meant I could get rid of that ugly 2M bass pot and instead use a much more common 100K or 250K, which is log and wired as bass cut and gives a much smoother response. You can also use a rev log wired in reverse. I guess they don't make C2M pots…

The bright cap and resistor, the bass capacitors were tweaked to get a similar response, usually whithin 1dB of the original, with common values. 250K bass cut gives you more range than the original.

Then there's another common source stage, this time fully bypassed, which means more gain. We also see a trim pot on the drain resistor. This is to account for the large variability between each single jfet, by letting you set the drain voltage to a desired value, in this case 4V which is again slightly off from a symmetrical swing and maximum output headroom. This is usually the preferred method, but keep in mind you're varying the load resistance and hence voltage gain of the stage! But then if the bias was off transconductance was too and you have the "gain" attenuator so things kinda take care of themselves. On a bypassed stage like this, a source trimmer would work well too.

The output of this stage goes into the final common source, again unbypassed (it was bypassed but they decided it was too much gain i guess). The input impedance is 100k, which forms a RC highpass with the 22n which barely invades audio and especially guitar range. I decided to keep it but 100n is probably fine. If we consider that the output resistance of the previous stage is roughly 10k + trimmer resistance, there's also a small but negligible amount of attenuation.

The output of the final stage goes into the final lowpass network and the volume control. We can consider the tone control a second order RC network in which one half is variable, composed by the treble pot, R11, C8, C10. The variable lowpass is done with what I call "guitar style", adding series resistance to the capacitor leg to reduce the attenuation to almost zero. I like this kind of filter here because it doesn't add series resistance to our output and instead exploits the output resistance of the last stage, meaning at the frequencies of interest its gain is basically reduced, resulting in lowpassing. Again the output resistance of the stage depends on the trimmer setting, and that's in series with both sections of the filter, but again our main filter is variable so we can account for most of that. An output attenuator works as volume control and pulldown for C9, the DC blocking capacitor.

My changes here were concerned with output impedance. We don't start well from the 10K+ of the common source, but we can do our best. I reduced R11 to 10k, which is still more than i wanted but a lower value would have led to less attenuation of treble. I also found that a more common 100K for the treble pot still gives all the treble and so also a better sweep. C9 has been changed to a 10u so that impedance remains as low as possible at low (mains) frequencies, with no audible change. The overall response is very close to the original again. The 100K volume still hampers our output impedance but we can't really go lower without losing output or loading down the last stage.

Thank you Dylan…

Hardware layout

My general layout for the device is to have the audio input and output besides eachother on a front panel of the device, along with the power LED and the potentiometers bass, treble, gain and volume in that order from left to right. The two tone controls and the two “loudness” controls will be visually grouped together. The power switch and DC barrel jack will be placed on a panel at the back of the device.

Because this is sensitive audio, there will also be a metal enclosure surrounding the electronics to minimize the amount of noise that can couple.

This makes it so the 3D CAD project will have 4 parts: PCB, front panel, back panel and a metal enclosure or what I call a shell.

Visually the enclosure will be a standalone flat box that can be placed on or near your guitar amplifier. For this example (and for the sake of practice), it will be visually comparable to a Focusrite 2i2 external audio interface.

PCB layout

The final PCB layout has gone through many many iterations as I kept on finding mistakes in the process of the enclosure design. Examples are scaled down potentiometers which made the PCB seem shorter than it in reality wouldve been and the lack of a power switch or indicator LED (these were added later in the design process). You could say that this project lacked some management and peer reviewing as I all did it with a sense of trying to have fun and learn new things as an engineer.

The final PCB layout looked as follows (Click to open in new tab):

As this might not look that pleasing, here’s also a 3D render of the board to get a good idea of the placement of components:

FreeCAD enclosure

The next step would be to design an enclosure where the PCB fits into. In the front panel there will be holes where the potentiometers and the LED sticks out of, but also gives access to the 1/4″ input and output jacks. In the back panel will be a hole for access to the DC jack input, and a slot for the on/off switch.

Sadly because of my lack of knowledge with (Free)CAD etc, most of the holes and slots were drawn with reference to wherever the PCB sat comfortably in the enclosure. Theoretically you would measure the height of the potentiometer shafts (and other components) measured from the PCB so you could come up with actual figures of where the center will be for the holes. Instead I just drew them where they seemed to sit well visually. This is obviously not how you’re supposed to handle these things and I strongly discourage you to do it this way. It might take some time and looking through datasheets, but please get sub millimiter precise locations for where your holes and slots should go.

In any case, this is how the enclosure turned out with and without the PCB:

The enclosure won’t be manufactured in real life as I don’t have the funds or means to do this, and this project was purely done to learn and have fun.

Project download (Requires FreeCAD 0.19!)

Leave a comment