Kicad Like a Pro, 2nd edition | How to automatically route a PCB using Kicad and FreeRouting

I’d like to show you one of the things that you can do really quick in Kicad. One of the features that can take your work with circuits and your workmanship to the next level.

It is one of the recipes in my book, in which you will learn how to quickly create the connections (routes) in a circuit board. When I write “quickly”, I mean it. By using an open source component that implements this feature in Kicad, you can automatically wire the components on a typical Arduino 2 or 4 layer board in a few seconds.

To achieve the same result manually you would need an hour or more.

(But don’t worry if you have gaps in knowledge that make you feel a bit lost; in the book, I explain all the concepts you need to make this recipe easy to understand and implement).

The autorouter that was included in Kicad 4 has been removed in Kicad 5. It is likely that a new autorouter will be added in the future. Until then, you can use an external autorouter.

In this recipe, you will learn how to use FreeRouting, an open-source autorouter.

The online project home for FreeRouting is at freerouting.org. There, you will find information on how to install it on your computer and usage documentation. FreeRouting is a stand-alone program with many capabilities. If you are planning to design a large PCB, it may be worth spending some time and studying the FreeRouting documentation. In this Recipe, you will learn how to use FreeRouting to autoroute a simple PCB that you are working on in Pcbnew.

In my experience, the easiest way to install FreeRouting is by installing yet another application, LayoutEditor. LayoutEditor is a general editor that is used in micro and nanoelectronics. It happens to include a binary version of FreeRouting and installers for a huge variety of operating systems. This means that you will not have to worry about downloading the source code of FreeRouting and compiling it for your operating system. For this reason alone, it is worth downloading it and installing it.

Start by going to the LayoutEditor download page, and download the version for your operating system. Once you have it on your computer, install it. When the installation is complete, go to the installation directory of the LayoutEditor. On my Ubuntu computer, this directory is /opt/layout. Navigate to the bin folder and find a file named “freeRouting.jar”. This file contains the FreeRouting application. You can copy the file to a location that is convenient for you to access, or create a shortcut.

This is a Java application, so if you don’t have the Java Runtime Environment, you should install it now. On Ubuntu, you can install the JRE through a terminal window by typing:

$ sudo apt install default-jre

Now that you have access to FreeRouting, let’s use it.

Open an unrouted project in Pcbnew. You can see my example in Figure 1.

Figure 1: We will use FreeRouting to autoroute this PCB

You must export a Specctra DSN file that contains the information that FreeRouting needs in order to do the routing. Create the DSN file by clicking on File, Export, “Specctra DSN…” (Figure 2). A dialog box will ask for a location and file name for this file.

Figure 2: Export the DSN file for FreeRouting

Proceed with FreeRouting. Run freeRouting by double-clicking on the .jar file. The Java Runtime Environment should execute the program assuming it is installed correctly. FreeRouting will ask you to load the DSN file, so locate it and load it. Eventually, FreeRouting will display your board with the various footprints and its layout exactly as you see it in Pcbnew. To run the autorouter, click on Routing, followed by Autorouting (Figure 3).

Figure 3: FreeRouting showing an unrouted board

After a few seconds, FreeRouting will create the routes and show them in red and blue color, depending on the layer that the route exists in. You will need to import this version of the board back to Pcbnew to continue with the work there. To export from FreeRouting, click on File, Export, Export Specctra Session File. You can close FreeRouting and return to Pcbnew.

Figure 4: Exporting the routed PCB from FreeRouting

In Pcbnew, go to File, Import, “Specctra Session…“ and select the file with the .ses extension that FreeRouting created (Figure 5).

Figure 5: Importing the SES file

Pcbnew will display the fully routed board, as you can see in Figure 6.

Figure 6:The fully autorouted board

While the autorouter did its job, there is still work to do. For example, you will need to pay attention to power traces and confirm or edit their widths. You must also run the Design Rules Check to ensure that none of the design rules are violated.

Should you use an autorouter, or route everything manually? It depends. There does not seem to be a consensus on this topic. Many people opt to use it; others prefer manual routing. The newer versions of Kicad, starting with Kicad 4, introduced powerful interactive routing tools which make manual routing fast. I prefer to use the autorouter for larger boards because of its speed, and then use interactive routing to make any changes necessary.

Check out Kicad Like a Pro, 2nd edition, ebook, available on the Tech Explorations bookstore

Check out Kicad Like a Pro, 2nd edition, ebook, available on the Tech Explorations bookstore

Related Articles

  • Nice article…I will certainly be trying FreeRouting. I work as an electronics engineer and I have designed several small and large PCBS but have only recently started using KiCad for hobbyist projects. In work I have used Altium, Eagle, Cadstar and Easy-PC. All of these EDA tools have their pros and cons and it really depends on the user experience and requirements of the job when choosing EDA software.

    Having a tool that is fully featured as well as being easy to use is the holy grail in my opinion. Being able to quickly find or draw footprints is critical as well as it being easy to quickly capture schematics and perform layout.

    In the past I have avoided auto-routers as I have found they always perform a poor job but that is because their algorithms are limited. The design rules must be very carefully considered before applying the auto-router and its this area that needs the most attention. I do agree that for large projects or where speed is of importance an autorouter is very attractive. It’s the safety concerns and design requirements which often cause issue…get those right and an autorouter could certainly save time and effort. I need to get to grips with KiCads push and shove routing as I have heard good things about it!

    • Hi Alexander, thank you for your comment. I was talking to an engineer that designs motherboards for computers that operate at the GHz range, with a lot ICs etc.
      He told me that he does not use the autorouter because he can’t trust it. When the board has hundreds or thousands of routes, it is possible that the autorouter can introduce an issue that the human designer wouldn’t have (and would have avoided the issue in the first place).
      With the autorouter, in situations like that, you will have to debug a big route network by reverse-engineering the computer’s work.

      • The big issue for me when designing complex PCBS is meeting the EMC requirements…with hi-speed ARM processors nearly every project is as complex as a motherboard. Add in Differential signal routing for ethernet and SD cards and memory…just routing the microcontrollers alone is difficult…add in some safety critical circuitry into the mix and its a job that must be very carefully and slowly thought about. So far I haven’t found an autorouter capable of doing that…lets see how FreeRouter does! 🙂

  • >