Adventures in Autorouting
Why are we humans still wasting our time doing a crappy job at manually routing printed circuit board traces? If a computer can beat the best Go player on earth, surely it can route a mess of traces better than idiot me!
Let’s try out a few of the latest and greatest auto-routing programs to see how useful they are routing my new board!
A new PCB for the Blinks gaming platform. It is basically an Arduino with RGB LEDs for blinking and IR LEDs for communicating. This new version adds a Service Port so developers can talk to their programs at 0.5Mbs while debugging (way cool, right?!).
Many (but not all) components on the board must be in fixed locations:
I’m guessing it would take me at least 10 hours to manually route this board, and I would be grumpy the whole time, and I would not be happy with the results because I demand better quality than I have the skills or time to be able to produce.
Topographical routing with smoothly curved, minimal length traces. Sign me up!
This is what TopoR looks like while routing….
Look at all those crazy topographically guided spiderwebs! After about an hour of my CPU blowing at full blast while I watched cat videos, TopoR suggested that it had done about all it could do. It presented a layout with every trace routed and not a single design rule violation…
Wow! I do so love the optimal directness of the traces! This is a nice route!
I am a little concerned about the way the traces sometimes connect to the corners of the LED pads. Will this make them harder to inspect after reflow? We’ll see! Maybe there is a way to turn this off, but I can’t find it.
Here are the numbers…
After seeing this output, I was ready to buy TopoR. Even if it only worked on this design, it would have already paid for itself. Unfortunately, it seems to be hard to buy. You have to register on the website to place an order, and the registration doesn’t seem to work. Grumble. I will report if/when I am finally able to buy it!
Conclusion: TopoR is very, very cool and gets so much so right. It gave me a usable (actually excellent!) design with only a couple minutes worth of work on my part. I’ll try on future designs to see if the magic lasts, and will report back here!
Shape based, optimal routing solution adapting to the natural flow of the nets while following advanced DFM and timing constraints. This is what I’m talking about!
This is ELECTRA whilst routing…
This first time I ran it, it finished in a couple of seconds with 12 unroutes. Not a good default behavior! So I bumped up all the the iterations so it would at least try.
Here is the best route it could come up with after about 15 minutes…
Not bad looking from afar, but there are still 4 unroutes! Looking closer, one of them is a silly no brainer. Really computer, you couldn’t figure this one out on your own?…
The others, not so easy. Everything is totally walled into a corner, with no obvious way out. It would have taken hours and hours of doing large parts of the route over to get everything connected.
Conclusion: Give me reasonable defaults – or at least ask me what I want. Don’t give me an almost finished route where you do all the easy parts, leaving me to try and clean up your seemingly unroutable mess. No value, at least for this board.
As far as Windows EDA goes, I am a Diptrace fan. While Diptrace is far from perfect, at least it doesn’t continually punch me in the face like EagleCAD does.
Diptrace has an autorouter baked in, and it is only one click away. I picked “shape-based”. It looks like this while routing…
After about 10 minutes of taping and ripping, it passed back this route…
There are two unroutes… but they are far from deal breakers. There were visually obvious paths for each of them, even to a stupid human like me. Why would it leave these easy ones for me? Just to make me feel invested in the process?
It only took about 5 minutes to manually complete the board and I had a working layout with no design rule violations.
I think took another 45 minutes or so to do some optional clean up, like pulling in the corners of wide turns to shorten the traces, and straightening the kinks out of twisted segments around the angled LEDs. The computer should have done all this for me in an automatic last pass that might have taken a couple milliseconds.
Here are the final the numbers…
Not bad, and if I had not already seen the TopoR results I would have been very happy with this route and the amount of time it took to get there.
Conclusion: Considering it is free (either with Diptrace you buy or the free version) and so fast and easy, there is value here. While it took a little time to get a usable design and even more time to get a decent design, either way saved me many hours compared to manual routing and probably I ended up with a better result.
The real FreeRouting mysteriously disappeared from the web many years ago, but has recently resurfaced in many places and many forms. I tested this version that seems to have been well cared for recently.
The real promise of FreeRouting is that it is open source, so if you don’t like something about it, you can fix it. Let’s see if it offers a good starting base for that!
It looks like this while routing…
After letting it do it thing all night, we ended up with this hot mess…
Hundreds of rule violations and lots of unrouted nets. Hmmm. This is not promising.
Conclusion: Unless I picked a really wrong fork, or I am doing something else something terribly wrong then this autorouter is not useful.
What I Really Really Want
While TopoR and (to a lesser extent) DipTrace are useful and time saving tools, what I really want is an autorouter that always does a better job than the best human router and takes no human time to do it.
We need to give the router more freedom.
Freedom of location. In this design, I only care where the LEDs and button are placed. All the other parts could be moved to pretty much anywhere they will fit. There is currently no way to tell this to the autorouter.
Freedom of rotation. The RGB LEDs could be rotated to any angle as long as the centroid stays in the same place. Imagine how much better the router could do if it was not locked in to these arbitrary fixed angles!
Freedom of connection. In this example, each LED pin could have been connected to almost any GPIO pin on the chip. Big EDA systems like Altium have limited pin swapping abilities, but I want more. I should be able to state my connection constraints like this…
Which means “You can connect either pin of IR3 to any of the following pins on U1: 1-23, 26, or 29”.
Now I’d also add…
IR3-1.endPoint != IR3-2.endPoint
Which means “…but the two pins of IR3 must be connected to different pins on U1.”
Now designing a circuit board becomes more like writing a program, and the autorouter is more like a compiler/constraint solver than an interactive CAD tool. Besides spitting out the board design files, it would also give me header files to include in my firmware so it would know which pins ended up connected to what.
Next I’d want the autorouter to be able to run headless from a command line so I could launch hundreds of parallel instances on a cloud computing platform like AWS or AppEngine. I’d enter my circuit constraints, hit “compile” and then watch as all the instances spun up and started delivering better and better routes until one met all my constraints.
How would this crazy complicated, highly dimensional topological multi-constraint solver actually work?
I have no fricken idea. I’m not smart enough to write it. Maybe no one is. But that’s ok.
Computers have recently gotten very good at teaching themselves how to find solution paths though astronomically huge search spaces defined by geometry and arbitrary rule sets. Amazingly good at it.
We can let our autorouter teach itself how to do autorouting and it will likely come up with strategies we could could have never imagined (and we might not even understand when we see them).
With all this freedom and smarts, we should see much much better boards than possible now. Imagine today’s standard 4 layer boards routinely being fit into 2 layers without any human effort. Think how much time and money that will save!
How to make $100,000,000
- Write the kernel of the above self-learning, constraint solving autorouter.
- Train it long enough that it is an order of magnitude better than any human.
- Use your new autorouter to re-process a few famous open-source boards. Publish (and even start selling) a single sided Arduino and 4-layer Raspberry Pi. People will notice. Bask in the Hack-a-day & Slashdot glory.
- Start offering a cloud-based service were anyone can upload their Electra DSN files. Let them optionally click on some parts to indicate they can be moved or rotated if they want an even better result. Then do a smash-up job autorouting the board and tell the person about the results… but don’t give them the actual output files until they pay up. “Congratulations! We were able to reroute your board from 12 layers down to 8! Click here to pay $25,000 and download your SES file!”.
- Sleep well at night knowing that you never ever let your magic IP free in the wild. People only download their output files, your software and weights never leave the safety of your cozy servers.
- Wait for the phone to ring. It is Autodesk/Google/Apple/Amazon. They want to buy you for $100,000,000.
- Agree, sign the paper work, fly to NYC (private) and buy me a cup of coffee.
So this is happening…
I submitted the above PCB to their service but got back only a partial route, with a promise that it will do better after they fix an internal error.
I will report back any news here!
Q: So what’s this article about?
People say autorouters will never be better than humans, and only wimps use autorouters and they get crappy layouts. Those people are wrong. Using TopoR, I got a much better layout than I could have done by hand and saved probably a dozen hours of work. Soon, autorouters will always do a better than humans on all routes – and I have some ideas on how to make that happen better.
Q: What versions of software did you use?
- TopoR 8 Layer 6.3.17786 (x64)
- DipTrace 3.1 (May 29, 2017)
- Electra Demo Version 6.30
- /freerouting release 1.3.0
Q: Do you work for Emerex or something?
No, and they won’t even seem to let me register for an account on their website so I can buy the damn program. I never even heard of TopoR up until recently – I found it by lucky google search. But I have been looking for (waiting for?) it for a long time. I am going to buy it as soon as I figure out how.
Q: I am trying to follow your instructions to make $100,000,000, but I can not afford the compute time on AWS to do the enforcement phase training since I am only 12 years old and am living in eastern Europe.
Just do the same thing you did last time.
Q: My mother said I am not allowed to write GPU cycle stealing worms anymore. She also made me give the Corvette to my uncle. :(
If you can really convince me that you are on the right track to training up a neural network to do first class autorouting, get in touch and I will make sure you have access to whatever resources you need to take the next steps. Note that this means that you will only make $75,000,000 because I will take 25% of the company, so try really hard to do it yourself first.
Q: Why didn’t you try [tool x]?
Either because (1) [tool x] is Eagle and I hate getting punched in the face, (2) [tool x] costs more than a car and doesn’t have a trial version, so I don’t have it, or (3) I don’t know about [tool x].
If you have access to [tool x], please run the DSN file for this board here and send me the SES file so I can report back on how awesome/awful [tool x] is!
Q: You set all the settings wrong when testing [tool x], no wonder it sucked for you.
See above question. Please rerun the file with your favorite settings and LMK how it does!
Q: I could have done such a better manual route than your stupid program.
I don’t think you can, but even if you can- why would you?
Q: I’ll only ever buy “Designed By Humans” products, and you should too or they’ll come for your job next!
You will need to get used to buying inferior and more expensive stuff soon, and eventually you will only be able to be crappy old stuff on ebay.
And they will definitely come for your job first.
Q: If you let a computer layout your circuits, then anyone can copy your boards and you can’t stop them.
This is actually a real and absolutely fascinating issue that I never even thought about before I met Ari.
Q: Every time I did like you said and got TopoR and let it run for like 20 hours and it made a great route, but now when I try to import the SES file back into DipTrace, it just kinda blinks… and then nothing. I am ready to kill myself.
A: Yea, the “DipTrace” profile on the TopoR export settings turns out to not make files liked by DipTrace, and DipTrace’s way of puking on those files is completely unhelpful. Here are the settings that actually work…
I got back the first batch of the TopoR routed boards… and they work perfectly!
I may have manually routed my last board ever, folks – and I have no nostalgia for all those countless hours I’ve wasted in the past!
I know almost nothing about what’s involved in designing layouts for PCBs, nor that autorouting was even a thing, but found this post really interesting.
Out of curiosity, what kind of cost / time savings are involved with reducing the number of layers on a PCB? Is it a matter of little difference for a single board but millions of dollars when you’re dealing in 1000s, 100Ks or millions of boards?
There was a product called NeuroCAD. It was bought in the mid-late 90s by ??? http://semiengineering.com/kc/entity.php?eid=22284
They claimed it used a neural net to do the routing. They killed it. It was awesome. At the time we were working on round boards for explosion proof instruments. The enclosure is round, so the explosion won’t blow it out. It would follow a round outline. Every other product at the time squared the circle. Arrrrggg.
You may want to revisit freerouting…It actually works quite well (for me). My guess is the rules aren’t setup correctly (not necessarily your fault, could be a .ses issue.) I use KiCad and go direct to freerouting without needing to change my design rules, but you can double check what the design rules are seen as in freerouting to confirm they’re setup correctly for your board.
I was disappointed in how poorly FreeRouting fared, but quickly admit that I did not dig in deep to make sure I used the best release or setting. The DSN file for the board is here…
Please run it though your FreeRouting setup and report back if you are able to do better than I did!
FreeRouting at 0deg is abysmal. 45deg is quick and effective.
I was able to acquire the following in mere minutes of FreeRouting:
Via costs: 50
Start pass: 1
Ripup start cost: 100
In/against preferred, both layers: 1
Routing 45deg, no restriction on pin exit
Curiously, the 4 incompletes are all LED+ pins. This is consistent between successive runs of the autorouter. Perhaps some condition of these nets is confusing the router?
That is certainly much better than I made out with FreeRouting… but not particularly good. I can’t think of anything special about the IR LED anode nets – they are the same class as all the other non-power nets. Hmmm…
Perhaps Freerouting doesn’t like the 45deg pads, since the other IR anodes were fine.
For example, being able to drop a 100mmx100mm board from 4 layers to 2 layers drops the price from $225 to $150 for 1K units at 3 week delivery. Savings are similar across the board (oops, pun).
The board is routed in a Freerouter with less gaps than before.
The previous screenshots show that the wire does not pass between the pads U1.
I think I prefer the original TopoR route to this new one because there are less traces squeezed around the edges. But both meet design rules and look nice!
By the way we have limited free version of TopoR. Here is the link: https://www.eremex.com/downloads/7/43
General limits of light version are up to 125 nets in project and up to 8 layers.
If you are interested for commercial version just click the link https://www.eremex.com/howtobuy. Or just email me on firstname.lastname@example.org
How about also letting the router add bridges as arbitrary extra components? Maybe there exists a component which is essentially a bunch of small bridges in parallel which could really open up the routers options?
Great post. I like autorouters a bit less than I enjoy routing manually which I find quite zen (until its not)
Yes, it would be great if the autorouter would automatically compute and add the minimal set of jumpers to connect all nets. This would be especially nice for single sided boards.
I even just wish the autorouter would use the jumpers that are already there for free! I’m talking about components that happen to have internal connections between pins, like the button and battery clip used on the example board. The “built-in” jumpers shown here in red…
…which would have opened up these long and orthogonal extra routing paths on the board…
None of the schematic packages I’ve used give even you a good way to even represent these internal connections so you don’t get net violations when you try to use them manually. Has anyone come up with a way to handle his elegantly? (PS: I don’t consider adding phantom layers to be elegant! :) )
I tried topor also because if your tutorial. It seems to have worked it works with the layer pair selected so if I select a pair route rip up the ones I don’t like select a different layer for the layer pair then run again it would route 3 then 4 layer pair 1,2 then 1,3 then 1,4?
I have a single via I’d like attached to layer 3 shield and a single via to bottom layer antenna. I am seeing top bottom and all as pad options will that let me route them together?
Hi, i tested TopoR with a single sided board i have succesfully routed with Auto-Router. TopoR failed with my board complettly. This was suprising for me and my conclusion is, it could hardly depend on the concrete board design, which Router is the best. Anyway, thanks for bringing my attention also to other routers.
Did you turn on TopoR’s “single layer” mode?
Hi Stefan! Hi Josh!
can I ask you to send us your project (pcb file)? I represent Eremex company. We will be glad try to help you.
Here is my email: email@example.com
Great article thanks, I’m going to go and try TopoR