PCB layout strategy

(Ultra noob!)
Having designed a schematic, I’m ready to start laying out components for a PCB.
When I switch to PCB editor and update from the schematic, the components are, initially, mostly grouped by type. So all the resistors are lined up together, as are all the caps, transistors and ICs etc.

On some levels, it would be easy to just try to follow the schematic and place everything in roughly the same place on the PCB, but that doesn’t necessarily make sense for any number of reasons.
And when pins on (eg) and opamp schematic might be (counter-clockwise) 1-4-2-3-6-7-5-8, rather than 1-2-3-4-5-6-7-8 on the actual IC, it’s challenging to use the schematic as template for PCB component placement.

So are there easier or harder strategies to start laying out the PCB? Is it (typically) good to drop ICs in the middle of the board and work outwards, or place buttons and input connections where it makes sense for users first?

Despite considerable searching, I can find plenty of advice on topics like trace width and 90deg bends or placing decoupling capacitors etc, but nothing on strategies for laying out a board and de-tangling rats-nests.

I would definitely place any components whose positions are important (like, they need to match up with a faceplate) first. Then place the ICs, allowing plenty of space around them, and placing them to avoid crossing traces (or running traces from the “wrong” side of an IC). Then place the passives, so as to minimize trace length and number of vias. The Ratsnest is your friend. Use it to “untangle” the traces before you start routing.

Well, if you created the whole schematic and then updated the pcb, you have a big pile of components in no real order. It can be handy to update periodically as you are working so you can move little groups of parts into different corners of the pcb.

One thing that may help you get started in sorting that out is to select a section in the schematic, then go to pcb and you see they are highlighted there too – drag one of the parts and the whole selection will follow. An example (an already routed board, but just to show):

This way you can at least pull some part groups out of the pile into work areas away from final pcb area. I like to route little sections I call nuggets (eg: an opamp circuit or adc and related parts) off to the side somewhere and get that all compacted/routed and tidied up. A little micro section here, regulator there… Don’t worry about power and ground yet, just drop vias for them and figure that out later. Two-layer boards need some planning to get everything to work and keeping top traces going horiz and bot layer vertical (or vice-versa) lets you have channels to route around the board, but power also needs to fit in the scheme, and then ground plane is minimal fill-in space whatever you can get.

If you treat yourself to a 4-layer board (it’s not that much more) you can put much stuff on the top (footprints and signals), leave layer 2 as a solid ground plane, do more signal routing on bottom (small jumpers on layer 3 as needed) power distribution on layer 3 (and bot as needed). Or something like that.

Post your schematic and let’s have a peek. And welcome to the kicad forum!

1 Like

There is an action available under Place > Auto-Place Footprints > Place Selected Footprints that places the footprints in a somewhat more usable layout that a tightly squashed block.

In order to use it, the board outline needs to be created on Edge Cuts first. After that select all footprints with Ctrl-A or drawing a selection box around everything, then run the action.

First you can divide footprints into logical groups by schematic. It was already said but when you have PCB and schematic opened together and select some elements at schematic you can use M hotkey at PCB to move these elements and there is also other hotkey (I think P, but I have not used it a lot and have a half year break in using KiCad so not 100% sure, and can’t check it now) that at once pushes selected footprints together.
Then the strategy depends on how many layers you use.
For 2 layer PCBs I design them having full continuous GND at bottom (because of EMC). So I switch GND connection lines visibility off as I need not to design these connections - I have everywhere GND one via from me. Then I go with VCC under the main microcontroller and I spread it radially through this IC corners and VCC pins.
You can see effect of this strategy here:

Yes, P is for Pack and move footprints. Also available from the context menu under the right mouse button:

For PCB layout, footprint placement is a very important step. Sometimes it’s beneficial to start with a very big “fake” PCB by drawing Edge.Cuts as a big rectangle, then layout sections of parts that are connected to each other (Teletypeguy has a very good example of this. The section he selected only has two connections (and power) to the rest of the circuit). It is also an excellent example of a compact layout. Footprints are placed to function with short PCB tracks in between them (In most cases this does not matter much for signal integrity,(sometimes it does!) but tracks always occupy PCB area. In cases where track length does matter, it’s mostly in high impedance area’s and feedback circuits.

Footprint placement in such a way that tracks do not overlap is a big concern. You can use via’s, but those also take up PCB area. With THT parts, PCB tracks can easily be routed under footprints. With big SMT resistors and capacitors this is also still possible, but with the small SMT footprints this is no longer possible, and this is another complication.

After the initial sorting and mock layout you get a decent idea of the size of the PCB needed, and the real PCB outline can be drawn. Also consider mounting holes, texts for revision numbers, project name / date KiCad logo :slight_smile:

But overall, how to do a good PCB layout is a very big topic. Too big for a forum such as this. There are also very different types of PCB’s (analog and digital circuits) and lots of PCB’s need special considerations for their layout. (SMPS circuits, GND return currents just to name a few).

1 Like

<random_thoughts>
Another thing I find handy sometimes is just pencil and paper. Many, many years ago, I started pcb layout on a light table with sticky tape and donut pads, so it was not as easy to rip up and re-route – a bit of planning was vital. Sketching is still a good technique today: scribble and think and visualize connections in your head. Various little chunks of the circuit can just be sketched circles with some lines going in and out – figure out a general floor plan before you drag/rotate/position those chunks into the board area. Sometimes a lower-level sketch of a chip and associated parts is insightful before you start positioning parts in the pcb window. And if you start to get stuck solving some routing problem, take a break and come back to it tomorrow. Your brain does more background processing than you realize.
</random_thoughts>

2 Likes

My PCBs are small, and used for audio. For example, I have one board that contains 8 DIP relays… so they get lined up on one side of the board in a way that lets me have nice short tracks out to connectors, placed at the edge of the PCB. Then I have things like USB sockets or USB daughter-boards, then need to be by a different edge of the board. After that, I know in my mind what’s going to need to be around the small number of ICs, so I get these roughly in place, and work out how I can place the (NON-SMT) resistors & capacitors.

If I have a dual or quad component (eg an op-amp) then I may spot during the layout that swapping them around make the board layout simpler, so I go back to the schematic, and make those changes, then back to the PCB.

For some specific circuits, layout can be crucial, so you need to understand the requirements.

Having placed the components (if you are not going beyond 2 layers) then you need to think about how you intend the distribute the power… that may affect the component placement (for example, op-amps typically need +ve and -ve to the chip, so that’s two reasonably-sized tracks, and capacitors adjacent)

The image shows a 4" x 4" PCB, RCA phonos at the bottom. Power in top left, 5v to +/-12v DC converter top middle, the dual op-amps in the middle. This is a really trivial audio circuit, but you can see that I don’t believe in thin PCB tracks! Oh, you’ll see that I have TWO grounds: the small one at the top is the one related to the incoming 5v, the lower one is isolated (via that DC:DC converter) and is an “analogue ground”.

I love putting Power LEDs on my boards. You don’t have to fit them, but (especially when doing initial testing) gives you a feel-good that yes, you DO have incoming power!

1 Like

Thanks everyone. That’s all really useful input.

Critique of my first board would be appreciated.
For reference, it’s single sided, THT, and an audio amp (not my design) that I plan to fabricated with CNC.
With hindsight, I could have placed the components closer, but I hadn’t figured out the significance of the fabrication layer and was making room for that text. (The fab layer is hidden on this screenshot.)

Schematic?
You probably should go with track through C9 like you go through C10.
From Pot1 center point I would go directly down jumping with C3 over the track.

If U1 is an LM386 it will benefit from a decoupling capacitor (C11?) right next to pin 6. The LM386 is prone to motor-boating without it.

It appears Pot3 is intended to vary the gain of the LM386? There is usually a 10uF or so capacitor in series with the resistive elements (R16, Pot3) so that only the AC signal is adjusted.

If U1 is something else then ignore.
Speculative guesses these are.

@idris

Have you made any test runs with your CNC machine?
Sometimes milling will tear the copper. Are your pads big enough to survive possible edge damage?

Maybe try a test run on a scrap board with a couple of U1, Qs, small electro. type footprints and pads with thermal reliefs, to make sure the results for your Amp. board will be reasonable?

Not a bad looking layout. Maybe bigger pads as @jmk mentioned. The TO-92 pads can be spread and made larger (spread the leads). Schematic would be useful. Is this an effects pedal? Are those neutrik jacks on upper left?

I am guessing that bottom right is a 9V battery holder and bottom left is a coaxial dc jack that appears to point toward the inside of the board, not the outside. The ground plane is connecting to what? Are you splitting the supply?

@idris Not knowing your experience with CNC-Milling a PCB, I post two links YouTube and Kicad-Post only to show that I Mill large Pads and wider Tracks to accommodate Milling ‘Hysteresis’ that can result in narrower/wider Tracks and Pads.

The 1st Video was done on a low-cost CNC as a Demo. Pads get milled at around 2-minutes into the First Video (Video also contains a view of Milling Parameters/Info at about 1-Minute)

The second link contains some Tip’s, Video and Results, milled on a different machine…

2 Likes

Thanks all. Really useful feedback.

@Piotr
C9 / C10 - what difference does that make?

@tryitagain
Yes, it’s a LM386. I wondered about a decoupling capacitor, but figured the (open source) circuit’s designer knew better. What do you mean by “motor boating”?

@jmk
No, I’ve not done tests yet, but I was planning to do some once I had a PCB I actually wanted to machine.
What size pads would you recommend as a starting point?

@teletypeguy
Thanks - I was quite pleased with it for a first attempt.
I did think the pads looked perilously close for machining. Is there a way to move pads in the PCB editor (I can’t see a way to drag’n’drop pads like you can labels), or do you have to do it through the footprint eiditor?
It’s just a guitar amp from Electro Smash, not a pedal, and yes, the jacks are Neutriks.
Re the coax power - ha ha - you spotted my deliberate mistake then. :rofl:
Re the ground plane - ah yes … The battery -ve should be connected to that. The idea is that when there’s nothing plugged into J1, the normaling powers down the circuit. Whilst I like the idea in principal, I can see issues with that and may just swap in a switch. (And I was probably getting a little gung ho when I go to the lower part of the board.)
I’ll need to read up on splitting the power supply - is this about reducing noise?

@BlackCoffee
Usefule videos. Thanks.
I’m familiar with the concept of hysteresis, but I’ve not heard of “milling hysteresis” before. Is this about the direction of rotation wrt linear movement or play in the lead screws etc?

I’ve never milled PCBs. My comments were the result of seeing milled boards. Depending on the cutter, you may need more space between electrolytic and transistor pads, and your thermal reliefs may need altering.

@BlackCoffee is your best guide to milling. He knows stuff, including milling PCBs. :grinning:

1 Like

Me neither. I wouldn’t have the space for it here, and I avoided mechanical engineering at uni because they had scary stuff like lathes and mills. Volts I can handle, newtons no thanks.

Besides I can get PCBs made in satanic mills, er, PCB fabs, for very cheap. Shipping for 5 boards these days is as low as $1.50, the boards themselves as cheap as ever. How can the couriers make any money that way? And they arrive within 2 weeks which is good enough for me and the delay makes me check very thoroughly before submission.

Growling sound due to oscillation of the LM386. I note that the PCB layout shown in the provided Electro Smash link shows an electrolytic decoupling/bypass capacitor somewhat close to the LM386 power input pin.

I don’t play guitar but my understanding with these guitar amplifiers is that distortion and other noise is often desirable so perhaps the way you have it is the way it should be.

1 Like

Typically electrolytic capacitors are used to filter out disturbances/noise from DC supply.
Each track has small inductance. Just simulate how effective is C if you have L from source to it and then L from it to load. Then compare it with the same connection but when you add L in serie with capacitor.
It is the difference between going with tracks through C pin and going near with the track to the side.

1 Like