Autorouting with KiCAD

I realize that my posts have slowed down, but that’s because I’m working on some consumer electronics at the moment. I’m hoping that in the next couple months I’ll be able to talk more about it.

Lately I’ve been getting into the PCB design portion of my project, and I tested out a bunch of different Autorouters. I was inspired to look into autorouters after reading Using TopoR to Autoroute a KiCad PCB by Dillon Nichols, who was in turn inspired to write his article based on Adventures in Autorouting written by Josh Levine. They’re both very interesting reads, and I highly recommend them if you’re into making your own PCBs in KiCAD. I wanted to share my own experiences.

I’m going to talk about the two that I ended trying out: DipTrace and FreeRouting.

Diptrace

Diptrace is fast which I was pretty happy about. It doesn’t have a Linux version, but I did get it running with Wine easily enough, and it runs very, very fast. The problem that I’m noticing with Diptrace is that it’s a full Electronics Design Automation toolkit, and not just an auto router. I also had some problems importing my KiCAD project with a 48 pin MCU.

48 Pin MCU misplaced and pins seem smashed together

I decided to try a simpler design (basically an arduino shield with one LED) so I could work through some of the problems I was seeing. Sure enough, this simple design was able to be ingested as a KiCAD project into DipTrace. Running Autorouter is pretty straight forward, you just setup your parameters and hit go. Once I finally got a routed board, I was then eager to get it back into KiCAD.

Initially I tried exporting Autorouter .DSN files, and then importing them into FreeRouting to then export them again as a Specctra Session .SES file, but that didn’t seem to work. KiCAD kept showing me errors in the file. Whether this was DipTrace, FreeRouting, or KiCAD’s doing, I’m unsure. At first I thought that the errors that I was getting was somehow related to the test board I was using but after creating a simple board these problem persisted.

Eventually I was able to get my design back from DipTrace into KiCAD, but it seems like I lost some information along the way. In order to get this far, I had to use DipTrace to export to an Eagle project, and then Import the Eagle project into KiCAD.

Before Routing (Left) vs. After (Right)

As you might be able to see, I lost some silk screen labels. Overall, however, this isn’t too bad. Whether or not this is worth the hassle, I leave up to you. It definitely feels like DipTrace trying to get users to use its full toolchain.

FreeRouting

Oh man. I’d love to tell you about FreeRouting, but the problem I face is literally “Which One?” Seriously, just google FreeRouting Download and you’ll get inundated with results all pointing to different versions, mirrors, and repositories.

I’m still piecing together the backstory on FreeRouting, but the general idea is that there was this guy, Alfons Wirtz, who in 2004 created his own Autorouter. He continued development on this project until 2014 when he released it under a GPL license. According to some rumors on EEV Blog he might have been pressured by a former employer to cease working on the project. I don’t know if this is true or not, but the end result is that it seems like people got really panicked and made copies of it everywhere on the internet. Why you ask? Well, because it’s an incredibly amazing tool, and nobody wanted to lose it.

So if you hear someone complain about FreeRouting, take it with a grain of salt. There’s like twenty versions out there right now. The one I’ve been using provided by Mihosoft at https://freerouting.mihosoft.eu/ seems to be actively maintained, and as of the writing of this article the last check-in to the repository was 2 months ago.

There also seems to be some confusion out there as to how to install this thing, which I thought was kind of funny. Some people are even going as far as installing other EDAs that have FreeRouting included as part of the product. To eliminate this confusion I’ll show you how to get it installed on Ubuntu:

git clone https://github.com/miho/freerouting.git
cd freerouting
bash gradlew assemble

If you get a complaint about not having javac or javadoc
sudo apt-get install openjdk-11-jdk-headless
And try the bash gradlew assemble command again.
Once it’s successful navigate to your executable,
cd build/libs
And run
java -jar freerouting-executable.jar

Anyway, once you get it running it’s a snap to get it working with KiCAD. Create your project like you normally would, place your components, and then export a DSN file from the PCB designer window. Open the DSN file with FreeRouting, and you should get your KiCAD file. Change any design parameters you want, and then click the Autorouter button.

Freerouting Final Output

The process will take some time. For this board, I think it took about 5-10 minutes. When it’s done, export the .SES Specctra Session file, and import it into KiCAD. I haven’t had any problems doing this, and no information has been lost so far. I’ve got to say, the entire process was pretty painless.

Reimport of FreeRouter .SES back into KiCAD

Now the observant among you might notice the white lines on the left image. That’s KiCAD’s ratsnest telling me that GND hasn’t been connected in several spots. If FreeRouting sees that you already have a ground plane it will assume that your grounds are connected and won’t route those traces. A way around this is to add a copper plane for ground AFTER Freerouting does its pathing. This way it will draw ground traces like it would for any other signal path.

Conclusion

I’ll probably look at other Autorouters, but for now I’m pretty happy with FreeRouting. At least with the version that I’m using. I’ve tried about 3 other versions, and the one maintained at https://freerouting.mihosoft.eu/ seems the best right now.

FreeRouting seems to be one of the few Autorouters that works really well directly with KiCAD, and has few problems working on Linux. And I can’t stress this whole “which version are you running” thing enough.

You might be saying, “Lee, you can’t really be serious about FreeRouting being viable. I’ve seen other people using it and the results aren’t what I expect!

Well, yeah, so let’s go back to Josh Levine’s blog post Adventures in Autorouting. In his article he shows this as part of his results that he obtained from his version of FreeRouting:

https://wpdotjoshdotcom.files.wordpress.com/2017/10/2017-10-22-11_01_19-pcb-layout-c__users_passp_documents_github_move38-blinks_diptrace_tile_tile-t.png?w=540
This image taken from: https://wp.josh.com/2017/10/23/adventures-in-autorouting/

Keep in mind that his post was written in 2017, and around that time, there was a version of FreeRouting floating around that attempted to create the extremely direct paths that you see above. I know this because I encountered this version as well. My results were similar-ish:

Using this other version, I couldn’t even get the same board to complete.

I’m thinking that the author of this version attempted to make pathing more direct and in doing so created issues that would made complex paths more difficult. If anything, FreeRouting has an identity crisis that needs to be resolved. Just make sure you get the right version before judging FreeRouting.