Kicad Tutorial: Using the autorouter
This is part of a series of short tutorials on advanced topics of using Kicad, the favorite schematic/PCB design software here at Wayne and Layne.
Routing, the process of connecting all the pads of a printed circuit board (PCB) layout, can be a time-consuming and tedious process. To avoid the time and frustration of manually routing your PCB, there are various software tools called autorouters which can do this for you. This post will show you how to use the external autorouter from the FreeRouting website.
First, ensure that you have selected the proper trace thickness and clearance values in Kicad’s PCBNEW application, by going to “Design Rules”->”Design Rules”. Once you have confirmed the design rule settings, press the “traffic sign” icon in the top toolbar to bring up the FreeRoute interface.
The three buttons on the left will let us export the DSN file that is input to the autorouter, launch the autorouter application, and finally import the SES file that was exported from the autorouter. To start with, press the top button on the left, “Export a Specctra Design (*.dsn) File”. This will open up a file save dialog box, and you can just accept the filename as the default filename is correct.
Now, click the second button to launch the autorouter. This utilizes the Java Network Launching Protocol (JNLP), which downloads a small XML file that is used by your Java system to download the rest of the autorouter. You may see a browser window open up briefly when the JNLP file is downloaded. Chrome gives a warning about the file type, you can press “keep” to retain the file for use. Your browser might do the Right Thing with the .jnlp file, and open it with Java. If not, you can probably double-click the downloaded freeroute.jnlp file to launch it, or on Linux you can type “javaws freeroute.jnlp”. When the Freerouter window opens up, click “Open Your Own Design”.
Due to the Java security restrictions, unsigned applets downloaded from the web are not trusted very much, so you have to give it permission to read files on your machine. For whatever reason, on my computer it won’t let me check “Always allow this action”, so it asks me every time.
Click “Allow” and then navigate to select the .dsn file you exported from PCBNEW earlier. Click on “Open” and it will load your design.
When your design has finished loading (which may take a minute or two) all you need to do is to click the “Autorouter” button, then sit back and watch the magic happen. The autorouter will do an initial route, then go through a series of optimization steps to try and reduce the number of vias used, as well as trying to reduce the total trace length.
You can wait for the optimization steps to finish, or you can click once in the board area to interrupt the optimization if you are in a hurry, or the results are already good enough.
When you are satisfied with the routing, use the “File”->”Export Specctra Session File” menu option to save the routing results to the .ses file. You will likely get another security warning, click “Allow” to continue. Navigate the file system to where you found the .dsn file, and save as the same filename but with a .ses extension.
In PCBNEW, select the third and final button on the left. It will open a file select dialog box, and it should already have selected the .ses file you just exported from the autorouter. Accept the filename and Kicad will load the file into your design. It will ask if you want to reload the board connectivity. I’m not exactly sure what this means, but I always click “Yes”.
As a side note, some people dislike autorouters, considering their own manually-routed designs to be superior, and there’s some truth to that feeling. Sometimes the autorouter makes silly decisions, sometimes I can spot ways to route things different and save a via or two, but generally I prefer to let the autorouter have a go at it, then clean up the results.
Other tutorials in this series:
I am designing a medium complexity board. The autorouter is running for more than an hour (1200+ pass). If I stop it, it says “14 connections not found”. I can start autoroute again but it keeps running. That 14 number doesn’t go down. Any thoughts on what might be wrong?
I have had the autorouter run for a long time for very complex boards, but I have always seen it complete a valid design and then spend hours in the optimization phase, where it tries to reduce the total trace length and reduce the number of vias, etc. In your situation, I would expect that this is an unroutable board, where the components are spaced too close together, or your trace width/clearance settings do not leave enough room for all the necessary connections. You might try moving your components slightly to see if that improves things. Good luck!
The Web service mentioned in the tutorial above is no longer available.
But fortunately the author of Freerouting Alfon Wirtz has released his Java
sources under the GPL. After some googling I found them on github and on
my Ubuntu laptop I had to do the following to get it compiled and installed:
git clone https://github.com/nikropht/FreeRouting
# 1. Check prerequisites:
if [ ! -f /usr/share/java/jh.jar ] \n || [ ! -f /usr/share/icedtea-web/netx.jar ]
then sudo apt-get install javahelp2 icedtea-netx-common
# 2. Compile:
if javac -classpath /usr/share/java/jh.jar:/usr/share/icedtea-web/netx.jar \n `find -type f -name "*.java"`
then jar cfe fr.jar gui.MainApplication \n `find -type f ( -name "*.class" -o -name "*.properties" )`
else echo "*** Some .java file was not compiled. See above" 1>&2
# 3. Run:
java -jar fr.jar
Hopefully the code snippet has not be mangled by posting the comment here.
Best regards, Peter Funk, Germany.
This saved my butt! Thanks for information setting it up.
I had to make an extra folder for Kicad, because I couldn’t figure out how to get my “program files (x86)” pathline to work. Eventually I just moved everything to a folder without a space.
Definitively worth it ^_^
“Now, click the second button to launch the autorouter.”
There is no such button. The second button says “Create .dsn File” and is grayed out.
i finished designing my my home automation circuit with kicad and i am happy and its fantastic but unfortunately i have to say that my layers are not so good because of those mini via, i tried to use free router but it aint working at all i am getting these text messages as results:
one: 11:45:10: Canâ€™t open registry key â€˜HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Web Start\10.67.2â€² (error 2: the system cannot find the file specified.)
two: 11:45:10: Canâ€™t read value of â€˜HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Web Start\10.67.2\Homeâ€™ (error 2: the system cannot find the file specified.)
three: 11:45:10: Execution of command â€˜10.67.2\javaws â€œC:\Program Files (x86)\KiCad\bin\freeroute.jnlpâ€â€˜ failed (error 2: the system cannot find the file specified.)
if anyone has faced this before,please to tell how did you solve it.
Ok, you must be using a newer version of Kicad than was used in these little tutorials. What version are you using? Windows, OSX, or Linux?
Peter Funk, thanks a lot for posting the information on setting the offline version up!
My favourite feature with Eagle was that once you started routing a rat’s nest, you could have eagle sort of autoroute that one trace from the point that you stopped painting. This was very interactive and real time. Anyway to get that feature?
I don’t have a auto route options in kicad version 5
Hi Sri, thanks for the comment. Yes, it appears that the menus have changed in Kicad 5, and the autorouter button was removed. You can still export the necessary file by going to File -> Export -> Specctra DSN, and use that file with the autorouter. You can then import the Secctra Session (.ses) file by going to File -> Import -> Specctra Session. Good luck!
I am using KiCAD 5.1.0 rc2 and the freerouting.jar from layouteditor.com, renamed to
freeroute.jar. This seems to work fine, but I have two issues:
(BTW, The dsn has about 2500 tracks, 800 parts, and 6 layers)
1. I have to rip-up all my manually routed tracks, otherwise the autoroute crashes with a java stack overflow
2. It got down to 56 unrouted after about 6 hours on a 3.5GHz 16GB DRAM PC (Windows 10). And then ripped up 600 tradks to start pass 2. Then it got down to 130 unrouted and without any warning starts pass 3 — my question is, how can I stop when it is good enough, if I have no clue as to when it will just drop a great pass and spit it out only to create an ever -worsening attempt?!? I cannot find this information anywhere.