I was not looking forward to the manual work of routing traces in pcbnew (Kicad 5) so I started looking for autorouters. In Kicad 5 this is currently done externally, whereas 4 had a builtin autorouter.
Now I know this is a controversial topic because the best human routers can do better than an autorouter but you can always use an autorouter in the beginning until you get better. Or you can tweak the results of the autorouting. Sort of like the arguments over C versus assembly decades ago I think. Well, we know which language is used more now.
I tried freeRouting last night on a small board with about 60 nets and it did everything automatically, using 5 vias by the end. Well I moved the ICs to where I judged would be the best locations before starting which helped.
The best advice I found on freeRouting was this page by Peter Dalmaris, a maker and educator, who teaches Kicad on Udemy. Instead of getting freeRouting sources from github (where there are many forks) and compiling, download the LayoutEditor package, available for various platforms, in native package format. So if you use Linux, it's as easy as just downloading and installing the right package for your distro. The files will be installed in /opt with one symlink in /usr/bin. The freeRouting JAR file is included (it's a Java app).
FreeRouting can be downloaded from @mihosoft's webisite. Miho has made a lot of improvements. This is the preferred method, older releases in the wild don't work well or at all with modern Java versions. The colour scheme is different from what you see in older tutorials but is entirely customisable.
I made this shell script wrapper so that I can call it with or without a DSN file as the argument. If no argument is provided, it opens up the file browser. The advantage of providing a DSN file as the argument is you don't have to traverse the directories to find your project.
#!/bin/sh
if [ "$1" -a ! -r "$1" ]
then
echo "$1" not found
exit 1
fi
exec java -jar /opt/layout/bin/freeRouting.jar ${1:+-de} $1
(Yes, I know, this script won't handle spaces in the filename gracefully.)
A heads up, don't use Unicode characters like Ω or μ in symbol values. freeRouting can't handle it, presumably due to not being compiled for Unicode, perhaps for another charset like ISO8859.This seems to be fixed now.
Another gotcha is if you create mounting holes using the mounting hole symbol, you need to assign each hole a unique reference, otherwise pcbnew's Spectra DSN format exporter complains. You should make the references invisible so they won't appear on the silkscreen. This is strictly speaking not a freeRouting issue.
Here are a few things I learnt using freeRouting:
- Symbol placement is paramount. By arranging the components in positions that make the most sense in terms of signal flow, you can minimise the trace length and number of vias needed to connect them together.
- Don't be afraid to alter the position of components to achieve the above. For example if a CPU has data pins that go to peripherals on one side, then move those peripherals close to the CPU.
- Don't be afraid to reposition components for more logical routing to make the traces shorter. For example components can be rotated to eliminate crossovers.
- If you have multi-unit ICs like logic gates, you can change the unit that is used in particular places for better routing. Go to eeschema, swap around the unit letters of particular gates, then Update the PCB and you will get a changed rats nest.
- For components like 8-bit latches and buffers, you can even change around the assignment of the bits to address or data lines for better routing. Just because the pin is labelled D0 on the symbol doesn't mean you have to use it for the lowest bit.
- If you find an execution of freeRouting is faring badly in optimisation, i.e. has lots of vias, abort it and try again. Optimisation is sensitive to the first traces attempted which appear to be random. If a bad initial choice is made, it's hard for freeRouting to discover a better layout later on. I had one design which got down to 2 vias. When I ran it again, it ended up with no vias.
- Every time before you export a new DSN file for another autorouting attempt you should go back to the rats nest. You can do this by globally deleting all tracks, if you have already imported the SES results of a previous run.
- For sensitive components like crystals you can prevent traces from going in between the pins by adding a small keep out area.
- Leave larger keep out areas, like the entire vicinity of a crystal, for when you are ready to do copper pours. These large keep out areas and copper pours also need to be deleted if you want to go back to route from the rats nest.
- Don't forget to give power traces wider track widths using the net class feature of pcbnew.
You will appreciate Kicad's ability to make incremental changes to the schematic and then propagate it to the layout.
Here's a recent board I did with freeRouting:

freeRouting has also been mentioned in a few places on Hackaday, just search for it.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.