Help me improve my PCB

Started by fryingpan, November 08, 2023, 06:18:50 AM

Previous topic - Next topic

fryingpan

So, I designed the PCB to this project of mine: https://www.diystompboxes.com/smfforum/index.php?topic=131110.0

I made a few changes here and there, but essentially the audio circuit is the same.

This is the PCB (dual-layer):

https://docdro.id/ehqKtUL

Almost the entirety of the signal processing circuit + grounding is on one layer, and almost the entirety of the power supply is on the other. The switching circuit for the clipping indicators is below, as far as I could place it from the signal processing, and it is "isolated" from VCC + GND through the use of two small-value resistors.

I've been advised to add in some ground planes, but I've read that for analog circuits (especially in the audio realm) they can make more harm than good, but on the other hand, if well designed they should be beneficial. How would you go about this?

ElectricDruid

Some comments:

1) Wow, it's huge! Can't you get it a bit smaller/tighter? PCBs are priced per cm squared, you know!

2) Make the skinny tracks fatter. It'll make them more robust, less likely to peel off the board if heated and reheated a few times.

3) Flood the power layer with a Ground plane if you want. Why not? It won't do any harm.

4) Some of the tracks on the bottom green layer could actually go on the red layer without too much effort. I can see you've used the other layer when you had to cross an existing track or tracks, but there's places where you could just sneak around instead. That only really matters much if you find it's breaking your ground plane up into lots of unconnected areas (at which point it isn't a 'plane' any more!).

In general, I think it looks good. It's clear and the tracks are tidy and don't snake around all over the place. Nice one.

fryingpan

Quote from: ElectricDruid on November 08, 2023, 07:44:37 AMSome comments:

1) Wow, it's huge! Can't you get it a bit smaller/tighter? PCBs are priced per cm squared, you know!
Yes, I could probably (there is lots of empty areas) but I wanted to keep each amp stage sort of separate to minimise interactions.
Quote2) Make the skinny tracks fatter. It'll make them more robust, less likely to peel off the board if heated and reheated a few times.
I followed Madbean Pedals' recommendations as per track width (0.25mm for signal lines, 0.65mm for power lines).
Quote3) Flood the power layer with a Ground plane if you want. Why not? It won't do any harm.
I suppose I could.
Quote4) Some of the tracks on the bottom green layer could actually go on the red layer without too much effort. I can see you've used the other layer when you had to cross an existing track or tracks, but there's places where you could just sneak around instead. That only really matters much if you find it's breaking your ground plane up into lots of unconnected areas (at which point it isn't a 'plane' any more!).
I'll try flooding the bottom layer and see if there are any unconnected areas.
QuoteIn general, I think it looks good. It's clear and the tracks are tidy and don't snake around all over the place. Nice one.
Thanks!

drdn0

Quote from: fryingpan on November 08, 2023, 07:52:53 AM
Quote from: ElectricDruid on November 08, 2023, 07:44:37 AMSome comments:

1) Wow, it's huge! Can't you get it a bit smaller/tighter? PCBs are priced per cm squared, you know!
Yes, I could probably (there is lots of empty areas) but I wanted to keep each amp stage sort of separate to minimise interactions.
Quote2) Make the skinny tracks fatte
Quote from: fryingpan on November 08, 2023, 07:52:53 AM
Quote from: ElectricDruid on November 08, 2023, 07:44:37 AMSome comments:

1) Wow, it's huge! Can't you get it a bit smaller/tighter? PCBs are priced per cm squared, you know!
Yes, I could probably (there is lots of empty areas) but I wanted to keep each amp stage sort of separate to minimise interactions.
Quote2) Make the skinny tracks fatter. It'll make them more robust, less likely to peel off the board if heated and reheated a few times.
I followed Madbean Pedals' recommendations as per track width (0.25mm for signal lines, 0.65mm for power lines).
Quote3) Flood the power layer with a Ground plane if you want. Why not? It won't do any harm.
I suppose I could.
Quote4) Some of the tracks on the bottom green layer could actually go on the red layer without too much effort. I can see you've used the other layer when you had to cross an existing track or tracks, but there's places where you could just sneak around instead. That only really matters much if you find it's breaking your ground plane up into lots of unconnected areas (at which point it isn't a 'plane' any more!).
I'll try flooding the bottom layer and see if there are any unconnected areas.
QuoteIn general, I think it looks good. It's clear and the tracks are tidy and don't snake around all over the place. Nice one.
Thanks!
r. It'll make them more robust, less likely to peel off the board if heated and reheated a few times.
I followed Madbean Pedals' recommendations as per track width (0.25mm for signal lines, 0.65mm for power lines).
Quote3) Flood the power layer with a Ground plane if you want. Why not? It won't do any harm.
I suppose I could.
Quote4) Some of the tracks on the bottom green layer could actually go on the red layer without too much effort. I can see you've used the other layer when you had to cross an existing track or tracks, but there's places where you could just sneak around instead. That only really matters much if you find it's breaking your ground plane up into lots of unconnected areas (at which point it isn't a 'plane' any more!).
I'll try flooding the bottom layer and see if there are any unconnected areas.
QuoteIn general, I think it looks good. It's clear and the tracks are tidy and don't snake around all over the place. Nice one.
Thanks!

Going 0.4 or up for signal lines is fine - it doesn't cost you anything, makes it much less likely you'll peel tracks and should be small enough that you can navigate around tight footprints with enough clearance.

I use 0.5 on my sparsely populated PCBs, 0.4 on my more dense ones, and aim for.0.8 or higher for power pins (which can get silly after a while)

fryingpan

#4
So... what about this?

https://docdro.id/GiRV8bF

Wider tracks (respectively 0.4 and 0.8mm), a ground plane for power around the signal processing area and a ground plane (on the opposite layer) for the switching circuit, tied to the following node:



Maybe I should remove the corresponding "ground" connections in the switching circuit from the green layer since they are all connected through the ground plane?

fryingpan


GGBB

  • SUPPORTER

PRR

#7
Quote from: ElectricDruid on November 08, 2023, 07:44:37 AMWow, it's huge!

I've never seriously regretted super-sizing a circuit, especially prototype-grade needing probing and changes. I *have* regretted building too small.

Quote from: GGBB on November 08, 2023, 07:33:45 PMRound your trace corners.

With respect, IMHO: has no effect at audio. Unless you like the look.

Even 45 degree corners is overkill, IMHO.

Yes, GHz signals will shoot-out of hard turns. Or if not, they bounce-back and confuse the source. But not audio, 'specially 5kHz guitar.
  • SUPPORTER

GGBB

Quote from: PRR on November 08, 2023, 10:49:13 PMWith respect, IMHO: has no effect at audio. Unless you like the look.

Even 45 degree corners is overkill, IMHO.

Yes, GHz signals will shoot-out of hard turns. Or if not, they bounce-back and confuse the source. But not audio, 'specially 5kHz guitar.

It shortens the total length of the trace - always a wise practice.
  • SUPPORTER

ElectricDruid

Quote from: PRR on November 08, 2023, 10:49:13 PMI've never seriously regretted super-sizing a circuit, especially prototype-grade needing probing and changes. I *have* regretted building too small.

Yeah, fair point.

R.G.

As an exercise in PCB skills, not criticism:
It seems like you may have skipped the first step in laying out any PCB other than a single-time bench prototype, that being deciding on (1) the box that it will go into and (2) the locations of the controls, box clearances, anything about actually mounting, enclosing and using the PCB once it's done and tested. I can't tell from just the PCB. Doing the PCB first and picking a box, controls, switches, etc later will mean that you'll have to get a relatively huge box and run the controls, etc. on flying wires.
Always, always, always pick the enclosure and controls/switches/jacks/etc first, then do the PCB. Sure, you'll pick some boxes too small for your skills in layout to fit it all, but this will build PCB skills faster than huge boxes.
As Paul says, a bigger-than-needed PCB is good for one-off testing of an unproven circuit. But putting stuff onto a pedal board will eventually require getting the circuit into a typical-practice sized box. It's good practice to completely test your circuit for function and tuning before you try to put it into a reliable, long-use box for the real world. These are really two different steps in the design process. I am guilty of violating this two-step process, but I have spent most of my adult life at this, and have learned through painful experience what can be skipped and done only mentally.
Trace width: I typically use 0.010"/0.25mm for everything as a start. In your layout, 0.25mm traces are fine, but I think 0.5 to 0.7mm traces might work too. Selecting trace width really requires trading off several things: the actual capability of your pcb etching process; the current carrying needs of the signals flowing on the traces; whether you need to snake one, two or more traces between the pads of an IC or connector; and for power circuits, the voltages between traces.
Actually, trace width is not enough. You need to include a specification of the minimum spacing between traces. Most PCB processes can achieve the same accuracy/reliability for traces and spaces, so a process is typically specified as trace width/space width. The units are often in mils (1/1000th of an inch), so you might use 10/10 rules: 10 mils (0.25mm) trace width minimum and 10 mil minimum spacing between any copper features. If you have and use a PCB layout design suite, you can set the design rules to illustrate an error for spacing less than a given number. 
There is another issue with trace width. Pads on ICs are usually in the range of 50 mils (~1.25mm) to 62 mils (~1.6mm). If you run a 10mil/0.25mm trace to this size pad, the junction of the pad and trace is two closely-spaced right-angle connections across a thin trace. Thermal effects can lead to cracks across the line between the trace-to-pad junction. Thin traces and wide pads are more reliable if you construct "teardrops" at pad-to-trace junctions for thin traces. These are a pain to add manually. Most PCB layout software suites have an automatic teardrop adder. This is probably an unnecessary issue for one, two or a few pedals, but a consideration for commercial production.
Another consideration in getting to improved layouts is to orient all components that have a direction in the same direction. You've done the first step at this, by ensuring that all components are oriented either vertically or horizontally. This is OK, works fine for one or a few pedals. But if you make more than a few, it's better, shading toward mandatory, that - for instance - all ICs are oriented the same direction, all diodes have their cathodes pointing the same way, all + leads on the electro caps pointing the same way, and all resistors/caps/etc oriented the same axis, ideally the same way as the ICs, diodes and electros. Again - this is optional for a few, where the majority of the work is to test out the circuit and get it to run. The more of them you build, the more you need assembly to be easy, cheap, and error-free. That last requires all the components to have consistent directions, and as few of those directions as possible.
Again, not criticism, just pointing toward better practices.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Chillums

I would also suggest changing the footprints of the TO-92 transistors to something with a 2.54mm (0.1") pin pitch instead of the 1.27mm (0.05") pitch you have now.  It will be harder to add sockets the way you have them now.  You will have to add the sockets one at a time instead of all three of them together which is a giant pain in the a$$.

R.G.

Quote from: Chillums on November 09, 2023, 11:06:13 AMI would also suggest changing the footprints of the TO-92 transistors to something with a 2.54mm (0.1") pin pitch instead of the 1.27mm (0.05") pitch you have now.  It will be harder to add sockets the way you have them now.  You will have to add the sockets one at a time instead of all three of them together which is a giant pain in the a$$.
Yes! I long ago just made my standard footprint for TO-92s be 2.54mm in line.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

fryingpan

#13
Quote from: R.G. on November 09, 2023, 11:02:30 AMAs an exercise in PCB skills, not criticism:
It seems like you may have skipped the first step in laying out any PCB other than a single-time bench prototype, that being deciding on (1) the box that it will go into and (2) the locations of the controls, box clearances, anything about actually mounting, enclosing and using the PCB once it's done and tested.

Oh, but I actually did. See (look for the white graphics):



Of course,

Quote[you] can't tell from just the PCB.

...but it's supposed to be a BBDD enclosure, with enclosure-mounted jacks, switches and pots (for flexibility).
I tried to fit all the tall capacitors away from the pots for clearance (it's 4cm tall, and the board will be on 6mm tall standoffs, and pots are less than 1cm deep, so I should have plenty of room).

QuoteDoing the PCB first and picking a box, controls, switches, etc later will mean that you'll have to get a relatively huge box and run the controls, etc. on flying wires.
Always, always, always pick the enclosure and controls/switches/jacks/etc first, then do the PCB. Sure, you'll pick some boxes too small for your skills in layout to fit it all, but this will build PCB skills faster than huge boxes.
As Paul says, a bigger-than-needed PCB is good for one-off testing of an unproven circuit. But putting stuff onto a pedal board will eventually require getting the circuit into a typical-practice sized box. It's good practice to completely test your circuit for function and tuning before you try to put it into a reliable, long-use box for the real world. These are really two different steps in the design process. I am guilty of violating this two-step process, but I have spent most of my adult life at this, and have learned through painful experience what can be skipped and done only mentally.

I am ready to waste money into this. I could have breadboarded the thing but I decided against it because in my experience breadboarding can be counterproductive for prototyping. I'd rather spend the money on iteratively perfecting PCBs. On the other hand, I'm still trying to waste the least amount of money (and time) possible :D

QuoteTrace width: I typically use 0.010"/0.25mm for everything as a start. In your layout, 0.25mm traces are fine, but I think 0.5 to 0.7mm traces might work too.

Following suggestions, I have increased widths to respectively 0.4mm (signal) and 0.8mm (power).

QuoteSelecting trace width really requires trading off several things: the actual capability of your pcb etching process; the current carrying needs of the signals flowing on the traces; whether you need to snake one, two or more traces between the pads of an IC or connector; and for power circuits, the voltages between traces.
Actually, trace width is not enough. You need to include a specification of the minimum spacing between traces. Most PCB processes can achieve the same accuracy/reliability for traces and spaces, so a process is typically specified as trace width/space width. The units are often in mils (1/1000th of an inch), so you might use 10/10 rules: 10 mils (0.25mm) trace width minimum and 10 mil minimum spacing between any copper features. If you have and use a PCB layout design suite, you can set the design rules to illustrate an error for spacing less than a given number.

Yeah, I suspected I would have to do something like this.
 
QuoteThere is another issue with trace width. Pads on ICs are usually in the range of 50 mils (~1.25mm) to 62 mils (~1.6mm). If you run a 10mil/0.25mm trace to this size pad, the junction of the pad and trace is two closely-spaced right-angle connections across a thin trace. Thermal effects can lead to cracks across the line between the trace-to-pad junction. Thin traces and wide pads are more reliable if you construct "teardrops" at pad-to-trace junctions for thin traces. These are a pain to add manually. Most PCB layout software suites have an automatic teardrop adder. This is probably an unnecessary issue for one, two or a few pedals, but a consideration for commercial production.

I'm not sure I get this passage.

QuoteAnother consideration in getting to improved layouts is to orient all components that have a direction in the same direction. You've done the first step at this, by ensuring that all components are oriented either vertically or horizontally. This is OK, works fine for one or a few pedals. But if you make more than a few, it's better, shading toward mandatory, that - for instance - all ICs are oriented the same direction, all diodes have their cathodes pointing the same way, all + leads on the electro caps pointing the same way, and all resistors/caps/etc oriented the same axis, ideally the same way as the ICs, diodes and electros. Again - this is optional for a few, where the majority of the work is to test out the circuit and get it to run. The more of them you build, the more you need assembly to be easy, cheap, and error-free. That last requires all the components to have consistent directions, and as few of those directions as possible.

Yes, this is a prototype and this is actually my first time designing a PCB. I... may not know what I'm doing  :icon_razz:  ;D

That said, the orientations have been chosen so as to minimise "snaking" and optimise the routes. I figured the silkscreen makes things clear.

QuoteAgain, not criticism, just pointing toward better practices.

Thanks, this is the kind of advice I actually need.

fryingpan

#14
Quote from: Chillums on November 09, 2023, 11:06:13 AMI would also suggest changing the footprints of the TO-92 transistors to something with a 2.54mm (0.1") pin pitch instead of the 1.27mm (0.05") pitch you have now.  It will be harder to add sockets the way you have them now.  You will have to add the sockets one at a time instead of all three of them together which is a giant pain in the a$$.
Yes, it makes perfect sense. Onto it. Although I had originally planned to directly solder the transistors onto the board.

ElectricDruid

Quote from: fryingpan on November 09, 2023, 01:16:53 PMI am ready to waste money into this. I could have breadboarded the thing but I decided against it because in my experience breadboarding can be counterproductive for prototyping. I'd rather spend the money on iteratively perfecting PCBs. On the other hand, I'm still trying to waste the least amount of money (and time) possible :D

I don't do much breadboarding these days either. I used to breadboard all sorts of crazy stuff including whole synth voices with processors, DACs, VCFs and VCAs, all on the one board. I got tired of debugging stuff that was just breadboard weirdness. Nowadays, I'm happier to spend *a little* bit more money and solder parts permanently onto stripboards for prototypes. Once I have a working stripboard prototype, *then* I move to a PCB design. Obviously the first version of that never works properly, because...well, because LIFE. So then there's a few revisions of the PCB. But at least I know the circuit is good.

It's also very true that the cost of PCBs has been falling and falling, so prototyping *entirely* on PCBs as you propose is a much more realistic project now than it has ever been. I certainly couldn't have justified the expense even ten years ago, but these days you can order a minimum order of five boards and then only use two of them and not worry about it.

Still, in many ways I like to keep the division between "circuit development" (the breadboard/stripboard phase) and "PCB development" (the later phase). It's less to think about at once. When I'm developing the circuit, I'm only thinking about that, not worrying about how the hell I'll lay the thing out! And vice versa - when I'm laying the thing out, at least I'm not worrying about whether it works or not!



Phend

#16
I haven't designed or used a PCB. As R.G. says it is important to start with a box. Using a cad layout helps, especially 3D. Put in the power, input, output jacks. Switch(s), led's and pot plus other hardware. These are there to bite you. One thing over looked is when using open switch craft type jacks is that the Connection Prongs Expand when the cable plug is inserted. Guess what, if it can hit something it will.


  • SUPPORTER+
Do you know what you're doing?

R.G.

Quote from: fryingpan on November 09, 2023, 01:16:53 PMOh, but I actually did. See (look for the white graphics):
Ah. I see now. Carry on.
Quote
QuoteThere is another issue with trace width. Pads on ICs are usually in the range of 50 mils (~1.25mm) to 62 mils (~1.6mm). If you run a 10mil/0.25mm trace to this size pad, the junction of the pad and trace is two closely-spaced right-angle connections across a thin trace. Thermal effects can lead to cracks across the line between the trace-to-pad junction. Thin traces and wide pads are more reliable if you construct "teardrops" at pad-to-trace junctions for thin traces. These are a pain to add manually. Most PCB layout software suites have an automatic teardrop adder. This is probably an unnecessary issue for one, two or a few pedals, but a consideration for commercial production.

I'm not sure I get this passage.
Expanding... our pcbs generally involve ICs with pins on 2.54 mm/ 0.1" spacings. These have to have a pad to solder to, and as a matter of common practice, the pads are 1.27mm to 1.6mm diameter, much larger than a 0.25mm trace. The junction of a 0.25mm trace touching a 1.27mm pad leaves sharp no-copper corners where they touch. The difference in size between the pad and trace and the sharp no-copper corners makes for mechanical stress at these corners. There is a higher instance of copper cracks forming across the trace right where it touches the pad. Doing slanted teardrop shapes for the pads leading gently into the thin pad makes the etching yield higher and makes the finished PCBs more reliable in practice.
QuoteYes, this is a prototype and this is actually my first time designing a PCB. I... may not know what I'm doing  :icon_razz:  ;D
That said, the orientations have been chosen so as to minimise "snaking" and optimise the routes. I figured the silkscreen makes things clear.
Yeah. Everything in PCB layout is a tradeoff, sometime a multiple-way tradeoff.  Every trace should be as short and direct as pos... er, practical, considering everything else. As I mentioned, there is a tension between the need to make short, direct traces (better for raw high frequency performance) and the need for aligning things all one/consistent way for cheap, easy assembly, and the need for small, tight, cost efficient PCBs. It's kind of one of those "pick any two of the three", only more of "pick your most needed mix of the percentages", taking into account your needs for how the PCB is to turn out.

On the philosophical level, PCB layout is one of those objective-driven things. If your number of pots and jacks and switches makes the top of the box too big for the PCB to be a problem, you don't need to worry about making it very small. If you absolutely have to cram everything in a too-small box, you're going to spend a lot of time "polishing" things to get it all stuck in there, and consider putting components on both sides of the PCB. If your boss is deciding whether you get a yearly bonus based on the cost of assembling 10,000 boards, you're going to align everything as well as asking the automated-insertion and manufacturing guys how to do this best for them.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

fryingpan

#18
OK, so I:

- switched footprints for the transistors to 2.54mm pitch sockets
- added teardrops (although some of the teardrops are a bit "unsightly", but I guess it doesn't matter...)
- truly separated signal ground and power ground (apparently, I needed to use a "net tie", due to a limitation in KiCAD)
- finalised ground planes for the power and clipping indicator circuits

Here is the end result: