KiCad revisited

This refers to KiCad 2014-03-19 build 4756 on Xubuntu 14.04

It’s been quite a while since I last had a go at using KiCad as a complete PCB design package. Recently, for a few reasons, I’ve wanted to go beyond the usual Eagle free constraints and so this was a good opportunity to see if KiCad had matured from previous incarnations. So, as you’d hope on a Debian (or Windows, or OS-X) system a simple apt-get kicad would suffice. Well, it did, for a while. I went through the Getting Started tutorial for the schematic and saved the netlist etc. Problems started at cvPCB where none of the package modules seemed to be installed and they weren’t anywhere on the system. There appeared to be a link to a Bazaar repository to download the original .mod files, but that’s been taken down. After a lot of searching around, it turns out you have to do a complete build from scratch to get KiCad up and running into a usable form after getting it from the Bazaar repository. For Ubuntu users, you can try this (I’ve only tested this on Xubuntu 14.04, but it should work for others).

sudo apt-get install bzr
sudo apt-add-repository ppa:js-reynaud/ppa-kicad
sudo apt-get update
sudo apt-get install kicad
cd kicad
./kicad-install.sh --install-or-update

In order, this will 1) get the source management software bzr, 2) add the location of the KiCad files, 3/4) update your local version info and get the kicad sources (this is a 550 MB download), and 5/6) build and install KiCad. Compiling will take quite a while, so get a cup of tea while it does so. This is dependent on your computer spec, but mine took around 25 mins (2.6 GHz Core2Duo, 4GB RAM). Be aware you will have to enter your su password during the build. This will leave a big folder at the end called kicad_sources, which you may safely delete.

You should now have a working copy of KiCad installed on your computer ready to go! With this version, there are some inconsistencies with the Getting Started guide, but you can work around them reasonably easily. Honestly though, this is not what KiCad should be doing to increase its user share. In fact, while searching for solutions to installation problems, changing to other software was a common theme. Last time I tried it, it was so close to being a perfect FOSS replacement for Eagle, and I was really hopeful a couple of years later. However, it’s a major headache for people who just want it to work out the box rather than typing in obscure and unknown terminal commands and watching pages of scrolling text for half an hour. The packaged version doesn’t have to be the latest and greatest, but it does have to just work. There’s also no point in updating documentation until there’s at least a fixed version it refers to.

Anyway, I’m looking forward to using it now there’s a working version installed. So far, it’s looking hopeful and full credit to the KiCad developers for making such a good piece of software. I hope they can sort out their packaging so all this work doesn’t go to waste with a withering user base. Would welcome anyone’s own experience and thoughts with KiCad below.

A very quick KiCad board update

After finally finding time, if not all the right parts, to start soldering the preamp board (see previous post) there are a couple of quick observations to fill the time until the next post, which will have files included with it:

  1. The resistor and capacitor pads in 0805 SMD cases look too small to solder on, but are actually not too bad. They’re a little less forgiving than the default Eagle pads, overall though that’s one less thing to worry about. I haven’t tried the SSOP packages yet, but they look substantially more tricky.
  2. On closer inspection, ie actually soldering on the boards, the quality of the BatchPCB boards has dropped significantly. The silkscreen is fuzzy and a number of the drill holes are not centered. For the time being, I will move over to Dorkbot PDX for PCBs as the quality is excellent, and you get the bonus of 3 boards instead of 1 for a similar price and usually faster turn around. That that multiplies the number of potential coasters by 3 is another matter..!

That’s all for now, and hopefully I’ll be able to finish up the project in the next couple of weeks and post up some more information and files.

A relay attenuator preamplifier – bare bones

I recently acquired a second-hand Quad 306 power amplifier, which has notoriously high input sensitivity even after a couple of resistor changes to improve this (more on this another time). Having to keep the volume on the PC to about the 5th lowest increment did not leave a lot of room for volume alteration and kills the dynamic range achievable from the system. I had made up some boards a couple of years ago based on an excellent design by Jos van Eijnhoven, but had never got round to finishing either the boards themselves or the software for the control chip. Here, I would like to detail some of the features of this project.

Control board

All control of the inputs and attenuator (described below) are controlled by a PIC16F818 microcontroller, running at 4 MHz from the internal oscillator. The software is simple and loops through repeatedly to control the input selector and the attenuator. The code was written in Hi-Tech PICC 9.80, and it can be downloaded here. The only real point of interest is the code for the button to cycle through the inputs, which goes dead until it’s been sensed to be have been released. The value read from the ADC is shifted into the PORTB register directly. Also on board is a simple headphone amplifier based around TI’s TPA6120 chip. No input buffer is required for this as it will always be driven from a low-impedance source. This section will initially be left unpopulated as there’s a good chance I’ll put a better headphone amp in there at some point.

Inputs

Although the majority of my listening is done through the PC these days, the flexibility to have another source or two connected was important. Thus, the design has inputs for 3 sources, with their respective grounds isolated. While this doubles the number of relays on board, it avoids any potential ground loop issues. The relays are driven by a ULN2003 transistor chip, in turn connected to and powered by the control board.

Inputs front

Relay attenuator board

Attenuation is provided using the design and values linked above, although on my own PCB. 6 relays (=6 bits) gives up to -64dB reduction across the range. The relays used are Omron G6K-2Ps, which are rather expensive but can often be found cheaply on eBay etc. Resistors are good quality Welwyn RC55s, available in all required values from Farnell. Again, the relays are driven by a ULN2003, all powered from the control board.

Buffer

The buffer is there to change to the high impedance output from the attenuator board in to a low impedance output for use with a power amp, headphone amp etc. The design borrows heavily from the JISBOS (JFET input, Bipolar output) developed on Head-Fi, and subsequently maintained by Ti Kan (see refs at the bottom). I originally bought a pair of the boards, but it turns out the 1/8 W through-hole resistors are next to impossible to buy here any more. Additionally, I didn’t want too many holes in the chassis, so opted to design my own board using the original layout as a guide. Resistors are changed to SMD 0805 where appropriate, and the mounting holes are the same as for the attenuator board allowing them to be stacked. The output transistors hang out from the side, allowing them to be heatsunk.

Power supplies

As this is a digitally controlled system, two power supplies are required; one for the analog and one for the digital sections. The analog section is powered at ±13.5 V by a σ22, which while over-rated for this task gives a very clean tracking output. Due to the potentially quite high currents required in the digital section (up to 8 relays on at one time), a linear regulator to take the analog +13.5 V to +5 V was not ideal due to the heat sinking requirement. The digital section is powered by a very small switching power supply, which gives 2.1 A at 5 V and doesn’t need a transformer or any heat sinking which saves weight, space, and money.

References & Suppliers

I’ll put up a full selection of files after I’ve actually built it all up, but this is just an introduction to the project and I hope it’s useful for your own projects.

Relay attenuator design: Jos van Eijnhoven
σ22 power supply and maintainer of the JISBOS buffer project: Ti Kan (amb Labs)
Parts: Farnell, Rapid Electronics, Cricklewood Electronics
Case: AudioKit


New boards. Eagle & KiCad

New boards have been arriving in the post over the last couple of weeks, although there’s been no time to start populating them to any proper extent. I thought I would share some of my experiences with CadSoft Eagle and the open source editor KiCad. I’ve always liked Eagle, and never really had the problems with the UI that many complain about. It’s not perfect, but it’s perfectly good enough when you’re used to it. Having tried gEDA and not having any luck with that at all (if you think Eagle’s UI is bad, just wait until you try gEDA..!), I decided to make up some boards with KiCad. Here are a few thoughts having gone through the whole cycle of schematic > layout > gerber > manufacture with both.

Schematic Editing

Eagle’s main strength, which I’ll come back to, has always been it’s large and largely accurate library. It is to be appreciated this is mainly from having a large existing userbase and, especially now it’s been bought by Farnell, this will only keep increasing. KiCad, in contrast, does not have a large library. The symbols used are also oversized, with a simple resistor taking up an inordinate amount of space. However, editing parts is very straightforward and I was able to fairly quickly (couple of evenings playing around) put together the start of my own parts library. The main difference to Eagle is that one does not choose the package in advance; this task is delegated to CvPCB, which sits between Schematic and PCBNew and reads the list in. Initially, this was an annoyance, but again it’s easy to get used to and allows easy editing of the schematic without worrying initially about the exact parts.

PCB Editing

KiCad’s main strength lies here, I think. The design rules are easily and logically editable, which is a massive plus. They’re also enforced as you edit, which was strange at first, but again makes perfect sense. KiCad is completely open with regards number of layers and layout size, which was the main attraction at first. When you edit a trace to a better (?!) location, the old trace is removed automatically, which is a nice feature as it removes hanging traces that might otherwise be missed.  The main annoyance (the same applies in KiCad schematic) is that if a part is moved, the connections don’t come with it. Again, this is easy to forgive and overall PCBNew seems pretty well polished.

Where KiCad massively falls down at the moment is the actual footprint library. This is also my fault as I should have checked more thoroughly before committing the design to the board house. On receiving my boards (pictures are below), the SMD pads are just the size of the component body. This means there is no where (or very little space) to solder on to. This doesn’t look like it’s going to be a problem for the 0805 packages, but I’m dreading soldering the MSOP, SSOP, and QFN packages. Additionally, the connectors (2-pin etc) have solder mask over the bottom of the board! I’m currently having a go at scraping off the solder mask, but it could be hard going…

Gerbers

KiCad’s integrated gerber output functions are miles ahead of Eagle, I think. While it’s easy to have an external Gerber viewer to check your output from Eagle, having it as part of the whole editing package makes life very easy (a shame I didn’t use it properly!). Overlaying all the layers is very handy, as it’s easy to check drill and mask alignments etc.

Overall, Eagle or KiCad?

In terms of the actual process of drawing schematics and layouts, I wouldn’t really choose between the two of them. Neither of them have truly “point-and-click” usability, but it really doesn’t take much to start producing functioning and moderately complex designs. My main problem picking up KiCad was simply from being familiar with Eagle and trying to do it that way, so from fresh it should be easier.

For the hobbyist, Eagle is a fantastic resource. Despite the 100 x 80 mm and two layer limit, an awful lot of projects can be realised in this space. The component library is really what makes it, however. Having a pretty comprehensive and well maintained library of parts means that anyone can feasibly put together a good PCB in an evening with little worry that the results will be usable. I haven’t tried the very latest version yet, but the inclusion of package download straight from Farnell is another welcome addition.

KiCad is by far the most mature and usable open source design tool out there. I don’t, however, subscribe to the view that simply because something is open source makes it automatically better and I look forward to seeing KiCad being improved further. While it’s possible to pick up and start using it in an evening, its biggest problem at the moment is the rather flaky and potentially inaccurate parts library. That the symbol and footprint are disconnected helps to an extent as it’s easy to modify one of the other, but surely getting basic packages into a solderable form is the very least that can be expected. If you have large or complex mixed signal projects to realise, or want to do commercial boards, KiCad really is a very good piece of software, but realistically expect to make all your symbols and footprints from scratch (that includes even resistors and capacitors).

Manufactured Boards

Below are the boards that have arrived. The rather jazzy purple board (Eagle) is v2 of the NoNe DAC (I’ll put more about this up when I have time). This came as a set of three from DorkbotPDX, which despite its ropey name has sent back some very nicely made up boards. The purple soldermask is consistent, and the pads are some sort of gold (or gold look-a-like…) plated. The price was good as well, and I’d be more than happy to use them again. The green boards are from BatchPCB, which shouldn’t need much introduction. Clockwise from top left, they are 1) WM8716 development board (KiCad), 2) SMD s20 preamplifier (KiCad), 3) microcontroller board and TPA6120 headamp (KiCad), 4) a Walt Jung positive super regulator (Eagle)

The next image shows the misplaced soldermask on the external wire connectors (highlighted in red).

And finally a comparison of the pad size for 0805 resistors from a board made in KiCad (left) and Eagle, both highlighted in red. With no external pad to solder on, I think the QFN and SSOP packages will be impossible to solder but it’s still possible to try! Maybe time for that reflow oven…?