You may have heard the saying “never trust the autorouter”, you may have even seen it written on a t-shirt!
Back when I used Eagle ECAD (Before AutoDesk did their thing), there was a built-in autorouter that was a handy tool to use to help with working out if you could hand route a PCB, or if something in the layout would make it impossible (or at least difficult to route).
KiCAD doesn’t have an auto-router built-in, there is an external tool called FreeRouting, It can be downloaded from https://freerouting.mihosoft.eu/
Once the file has been moved into the applications folder from the .dmg it is installed, however, you may get a prompt informing you that the application is damaged and you need to delete it, the way around this is in terminal:
sudo xattr -cr Freerouting.app
For this blogpost I am going to place the following components on a schematic:
- 1 x 10 Ω 0402 resistor (Resistor_SMD:R_0402_1005Metric_Pad0.72×0.64mm_HandSolder)
- 2 x 120 Ω 0603 resistor (Resistor_SMD:R_0603_1608Metric_Pad0.98×0.95mm_HandSolder)
- 2 x 120 Ω 0805 resistor (Resistor_SMD:R_0805_2012Metric_Pad1.20×1.40mm_HandSolder)
- 2 x 180 Ω 1206 resistors (Resistor_SMD:R_1206_3216Metric_Pad1.30×1.75mm_HandSolder)
- 1 x 10k 1206 resistors (Resistor_SMD:R_1206_3216Metric_Pad1.30×1.75mm_HandSolder)
- 1 x 2u2 1206 chip capacitor (Capacitor_SMD:C_1206_3216Metric_Pad1.33×1.80mm_HandSolder)
- 1 x Blue 0402 LED (Diode_SMD:D_0402_1005Metric_Pad0.77×0.64mm_HandSolder)
- 2 x Green 0603 LEDs (Diode_SMD:D_0603_1608Metric_Pad1.05×0.95mm_HandSolder)
- 2 x Red 0805 LEDs (Diode_SMD:D_0805_2012Metric_Pad1.15×1.40mm_HandSolder)
- 2 x Yellow 1206 LEDs (Diode_SMD:D_1206_3216Metric_Pad1.42×1.75mm_HandSolder)
- 1 x pre-programmed ATtiny85 MCU (Package_SO:SOIC-8W_5.3×5.3mm_P1.27mm)
- 1 x SPDT switch (Button_Switch_SMD:SW_SPDT_PCM12)
- 1 x Push to make switch (Button_Switch_SMD:SW_Push_1P1T_NO_CK_KMR2)
- 1 x 15mm brooch pin
- 1 x battery clip (SMTM1632:SMTM1632)
The battery chosen for this is a CR1632 coin cell, wiring them up to make a dice badge, that uses the ATtiny85 to play a pattern when left alone, but when the push button is pressed it will display a random dice number.
The text in blue in the lower left-hand corner of the schematic explains which LED sets need to be enabled to display numbers.
Laying the components out on the PCB editor so they fit on a circular 30 mm PCB, with ground fill on top and bottom copper gives me the following rats nest to resolve. At this point, there has been no optimisation of pins, or component orientation.
Now we have the components where I want them placed, I can now move on to having the autorouter have a go at cleaning up the ratsnest
Exporting a DSN file
File > Export > Spectra DSN saving the file as
Ratsnest.dsn, so I can feed it to Freerouting…
Running Freerouting from the applications folder (if you get an error saying it is damaged, the instructions for fixing it are near the top of this page), and opening
Ratsnest.dsn gives the following on the screen:
On the top bar is a button marked
Autorouter that you press to let it have a go,
Every time you click the Autorouter button it will generate a different solution, so if you are not a fan of the output you can run it again until an acceptable solution is returned. this is a fairly simple board so I was not expecting to run into any issues, however, had it been unable to route it taking what I saw from the auto-router back into the schematic capture, or the PCB layout software, I could move some of the components around, or performed a pin swap on the microcontroller.
And back into PCB Editor
Once you have a route that you are happy with, in Freerouting
File > Save and
File > Export Specctra Session File, it will ask you if you want to save the rules, I go with yes, as I don’t see a downside to this, and they may be useful at some point.
Back in PCB Editor
File > Import > Specctra Session… and the screen will re-draw, you will want to press
b to redraw the fill. Some new ratsnests will appear as the ground plain is no longer contiguous.
A little bit of cleanup later, and some more vias on the ground plane and we have a valid PCB:
Can I trust the Autorouter?
Well yes, but make sure you know what you are doing, and understanding and knowing its power and limitations will give you another tool for when you do PCB design.