Designing my first board, how does it look? - Page 1
Forum section: electronics / projects

author: Rx7man
author_rank: Regular Contributor
timestamp: September 15, 2023, 10:08:00 pm
content: Here's an automotive control board I'm making, it'll have a bunch of inputs and drive 3 FETS along the top right (something like an IRF540 or better), I'm thinking of a switching frequency around 2-5khz. They're supposed to handle a peak load of about 10-15A, but that will be rare and short spurts, probably hang out around 5A or so.. I'll solder something like a 14ga wire directly to the board for all 3, and there will be current sensing on 2 of the outputs, the ground for them is isolated from the rest of the boards' ground (GND-ISO) and will have it's own fat wire to a separate ground.. FET drivers are in the top middleBelow the FETS is the current sense amplifier (OPA2328 based) with a couple low pass R/C filters.. I can play with the values later to fine tune it.. potentiometers are for the gain control (Bourns 3339P 4 turn trimpots)Bottom right is the 3v3 and 5v0 voltage regulatorsI have every input/output from the ESP32 going to a test point, I can either probe it to see what's happening, or it's a handy spot to bodge a wire in if I bungle the pin requirementsThere's one DAC output that'll run at about 50-60khz, it'll go to a high output drive op amp, resistor, and capacitor (DC offset removal) into a coil to sense the resonant frequency (this is the really tricky part), another op amp will read the peaks of the sine wave and amplify and smooth them, and send them back to the processorDown on the bottom left there's a variable reluctance sensor chip, a connector to show the onboard LED to some place visible on the outside of the box, and an NTC thermistor that i'll glue to the FET heat sink so I can see if things are getting hot. Lastly it has CAN bus and a few I2C terminals so I can connect a little display, perhaps an atmospheric sensor like a BME280 or somethingI think I did a decent job of routing things.. once I get the schematic cleaned up a bit I'll post it as well

author: Benta
author_rank: Super Contributor
timestamp: September 15, 2023, 10:24:07 pm
content: From a layout point of view it looks fine.I have difficulty identifying the pads for the IRF540s.

author: JustMeHere
author_rank: Frequent Contributor
timestamp: September 16, 2023, 03:17:17 am
content: You want to keep the antenna away from things, see:https://www.espressif.com/sites/default/files/documentation/esp32_hardware_design_guidelines_en.pdf#page=20

author: Rx7man
author_rank: Regular Contributor
timestamp: September 16, 2023, 07:16:37 am
content: I really don't think I'll be using the wireless features, but good catch!For the pads for the Mosfet, I made them a sideways oval, and bent the center leg outward, this gave me much better room for fat traces and copper pours

author: mariush
author_rank: Super Contributor
timestamp: September 16, 2023, 08:12:09 am
content: It looks nice to me.The first question that popped to mind was : where's the input power connector because I see V_BATT on the left (is that battery power) and I see the 5v and 3.3v regulators all the way to the right and I don't see any other test points or anythingSecond is... are those regulators gonna be heatsinked? They look like linear regulators to me, keep in mind you're gonna have 10-14v in from battery, and you're gonna have 3.3v out - that's 7-11v differential. The ESP32 will consume maybe 80-100mA, +100-200mA when transmitting wireless (if you do it) ... so just (13v - 3.3v) x 0.1A = 1 watt of heat. Without a heatsink, that to-220 3.3v regulator is gonna sit at around 80-90c, not good.May be better off using a switching regulator to produce something like 5.25v then use a LDO to produce 5v if you want some extra filtering on 5v, and a regular linear regulator for 3.3v. Then you could use DPAK/D2PAK versions or SOT-223 and solder the tab to some wide copper area on the circuit board.Don't quite get why you had to have U2 so much to the left, ending up with those looong traces from ESP to itThe board is small enough that moving to a 4 layer design would not cost you significantly more, maybe 5-10$ extra? You could have 12v (on WIDER traces) and signals on top , 5v and 3.3v "islands" in a middle layer and you connect everything through vias to 5v and 3.3v, signals and ground on the bottom layer. .. 4th layer don't know, ground, maybe signals.It may be more convenient to rotate the ESP32 90 degrees, just so you could have the antenna on the edge and remove the ground and traces under the antenna part, just in case you'll decide to use wireless.I don't see component values but sometimes it's convenient to use resistor arrays (ex use a 1K or 10kOhm resistor array with 7 resistors in 0805 or 1216 package to reduce amount of space used by components.I'd suggest using through hole capacitors instead of those surface mount for the linear regulators - you're using through hole components in other places so it's not like you don't have choices for capacitors. surface mount capacitors are historically proven to be less reliable and you risk to have the pads ripped off, a through hole capacitor has much sturdier connections. (even so considering it's in a car you may want to add some electronic grade silicon around it or worst case some hot glue)maybe move that section with the vr2 and vr3 and the chip more to the left to leave more copper for those resistor pads, if you're using them to measure current or something and don't want them heating up to affect things, more copper would help cool them.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 16, 2023, 11:34:26 am
content: As a general rule, it's always better to all interruptions of the GND plane as small as possible. Especially in the north west corner of the PCB, there are some pretty long slots in the GND plane caused by interruptions by just a few tracks. And similar near the ESP32. usually it's better to have some long serpentine tracks on the top side if it can help keeping the GND plane intact. If it can not be helped, then popping the offending track to the front of the PCB for a short while will allow the GND plane to connect to itself, so there are two smaller interruptions instead of a big one. There is a lot said, written and videoed about GND planes and how they influence PCB integrity. Especially the video from Rick Hartley is very enlightening. (Get some popcorn first, it's a two hour video, but it really is worth watching).How are your TO220 packages being handled? Are the screwed to the side wall of the box or something? Especially for automotive, the pins can break over time if the body of the TO220 itself is not supported.For the heavy wires. Soldering them directly to the PCB is a bit of a nuisance. It's easier to solder them if yo can poke them though a hole first. (this will keep loose strands of multi stranded wire together). Also, the copper is not connected all too strong to the FR4 base material, especially during soldering you can tear it loose easily. It helps a lot if you put a handful of via's through the solder pads. The via's form a quite strong connection to keep the copper foil to the PCB. Have a look at how those ESC (Electronic Speed Controller) things for BLDC motors are made. Those hobby guys work on small PCB's with high currents and they use lots of via's though the pads. You also have a big PCB, and putting those pads so close together makes soldering more difficult. Just rotating the pads for the heavy wires 90 degrees makes soldering already easier.What is that round hole just north of the "Fuel Gain" potentiometer, and why is there a track running though it? (Similar for those other 3 holes in a rectangle, including one beneath a MOSfet).You have put a lot of via's under SMT resistors, and also a lot of SMT parts under your ESP32. In themselves those are not problems, but it does make it a bit more difficult to inspect and repair the PCB if needed.I'm guessing R56 is a PPTC or other protection device, and that's good, but I always like to see some ferrite beads or inductors in power supplies for microcontrollers.How is the Gate voltage for your FET's handled? It looks like you switch the GND wire and have shunt resistors in GND for measuring the current. This needs an external connection to connect the GND's and that needs to be handled carefully, but It looks like you put some thought into that.

author: Rx7man
author_rank: Regular Contributor
timestamp: September 16, 2023, 07:49:06 pm
content: The TO220's will all be on heatsinks, the FETS will be on quite a large one and they'll all be fastened to the side of the boxThe ESP32 doesn't fit nicely sideways if you want to be able to plug into the USB on it, the long traces to the top left is a little bit of a thorn in my side as well honestly, but at least for the prototype version I wanted to keep all the resistors and caps in 0802 and leave enough room a clutz like me can work with them and change them out for different values.. Tried to have them all at 200 mils horizontal spacing and 150 mil vertical. I'll probably do a top ground plane copper pour and stitch it through with vias...Part of the reason I want to keep it a 2 layer board for now is I can access all the traces, and cut/solder to them if I have to. Except for where they meet a small chip, I currently have all the traces at 16 mil and might be able to reasonably go up to 24 milFor soldering the heavy gauge wires to the board, there is a hole in the pad to insert them through first, and I can actually bend the end of the wire over right to the FET so the board doesn't have to carry the current (except on the drain side, where I might remove the solder mask and put a bunch of solder on, or solder some used solder wick to it.On the GND-ISO connection I do have a whole bunch of vias placed around the padI guess I can use through hole caps as well.. could probably just add some through hole pads and have either optionThe round hole with a trace running through it is a standoff in the project box that doesn't have a screw mount (B-restrict), trace is on the top side so it's OK.. below the mosfet I'm real tight, I will probably shift something around just a bit yetGate drivers (top middle) are IRS44273L chips, on the top right is the common connection for the drainsI do have a bunch of zener diodes under the ESP32, the ESP32 will be on a socket so I can pull it out, not all of them will be populated, but I wanted the option to be able to put a zener or perhaps a capacitor on any pin, a bit of a bodge but you could even stack them and do both if neededR56 is a polyfuse.. not really sure what spec to go with, the one I have listed there now is 3 amp hold, 5 amp trip Littlefuse RGEF300As far as copper thickness, I'm thinking 2oz coppper should be fine, my heavy traces I can leave bare and add solder toAlso the ESP32 has it's own 3.3v regulator, is there any issue connecting the board's 3.3v power to the same pin? I have the cut trace option at the bottom of the board to be able to disable it (3.3v vfeed, bottom center)I will check out that Rick Hartley video, I like long vids, though I fall asleep to them.. and it takes about 4 tries to get through them.. I've been watching a number of channels like that recently... I've been watching a bunch of Robert Feranec videos like this oneEdit: Seems like I've already watched at least part of Rick Hartley's vid on grounding!.. will make sure I watch the whole thing.I hope I covered all the comments

author: Rx7man
author_rank: Regular Contributor
timestamp: September 16, 2023, 08:36:38 pm
content: I did a few modifications, surface mount electrolytics now have a footprint for a 10mm through hole option, and I found a way to make the two traces to the top left mostly on top which kept the ground plane more intact.. I'll probably do a few minor tweaks to it

author: zapta
author_rank: Super Contributor
timestamp: September 17, 2023, 04:00:37 pm
content: I would put more effort into minimizing the length of the traces on the bottom layer, to improve the ground plan. Also, preferring a few bottom layer short traces over a long one.

author: zapta
author_rank: Super Contributor
timestamp: September 17, 2023, 04:10:30 pm
content: If you are using a module with an internal antenna you may want to look at the antenna position guide lines in Figure 16 in the doc below. There is a preference for a corner near the 'upper right' corner of the module. You may want also to revisit the ground plan below the antenna.https://www.espressif.com/sites/default/files/documentation/esp32_hardware_design_guidelines_en.pdf

author: Rx7man
author_rank: Regular Contributor
timestamp: September 17, 2023, 05:58:53 pm
content: that's exactly what I've spent the last day doing.. I think I improved it a fair bit..

author: MarkS
author_rank: Unknown
timestamp: September 17, 2023, 08:05:49 pm
content: I have two issues and one question.The issue I see immediately is that you're routing 3.3v to ground under the connector. The second issue is the routing of the 5v and 3.3v lines to the connector. Route the 5v line above the connector and then you can move the short piece of 3.3v trace breaking your ground plane to the top layer. The question I have has to do with those four holes you have in your ground plane that have traces across them in the top layer. Obviously they're not mounting holes, but what are they for and can you remove them? They wont break anything, but don't break your ground plane unnecessarily as a good practice.Minor issues, but they stand out to me.

author: Infraviolet
author_rank: Super Contributor
timestamp: September 17, 2023, 09:51:47 pm
content: 1. If this is the first SMD board you've designed, I'd recommend moving the passives which are close to the ends of the IC chips a little further away. Gives you more room to get in with a soldering iron tip to access (if you need to swap for example, or if you assemble in a different order) the passives without hitting the IC's casing. For exmaple, thos passives justright of the IC chip which is right of VR1. Even for decoupling caps, you'll probably get away with an extra mm or two of distance given that this board is or stuff at <10KHz.2. A personal preference, others may feel the other way round, but I like to put component values on a board's silkscreen rather than component names. This makes hand placing quicker as you can look at the board and know what value goes where, rather than need to constantly refer back and forth to a spreadsheet which converts between component name (R25) and value (3.14159K). If this board is being assembled by your PCB manufacturer this is irreevant ofcourse.

author: Rx7man
author_rank: Regular Contributor
timestamp: September 18, 2023, 01:57:11 am
content: I have some preliminary values for things my Spice tests, but at this point I wouldn't want them on the silkscreen. I have pushed some of the passives a little bit further away from the IC's.. not a whole lot but anything might help. Is there a way in Eagle to renumber parts by their order on the board? Seems whenever I try it, it orders them by how they're laid out in the schematicThe output of the DAC is actually at a moderate frequency, 50-60khz pure sine wave.Those holes are just support bumps in the project box so I avoid putting through hole stuff there.. On one of the FETS I'm really stuck on real estate and I'll probably just grind off the bump if it gets in the way... I don't need to remove the copper pour there so before I send the job out I'll change the footprint in the library and get rid of it, or change it to a different layerI've also just added a top layer copper ground pour and stitched it to the bottom layer

author: Rx7man
author_rank: Regular Contributor
timestamp: September 18, 2023, 07:31:29 am
content: I just got a bit a bigger enclosure with a hinged, clear lid (current one is screw on lid).. i'll maybe give myself a little more board room and shuffle things around a bit.. make it so I don't have to fight the cable glands to get the board out.. This box has a removable subfloor in it which will help with that too, and give me more mounting options.. I'll see when it gets here!

author: temperance
author_rank: Super Contributor
timestamp: September 18, 2023, 08:48:58 am
content: I don't see how the MOSFET drivers and the current sensing will work.-The drivers use the controller GND.-The current sensing and the MOSFET's are referenced to ISO_GND.

author: Rx7man
author_rank: Regular Contributor
timestamp: September 19, 2023, 02:48:10 am
content: it's just a separate wire to chassis ground to not couple the noise into the controller/analog circuitry.. maybe a dozen millivolts or so difference, which the op amps should get rid of the common mode voltage from and just sense/amplify the drop across the shunt resistor

author: Infraviolet
author_rank: Super Contributor
timestamp: September 19, 2023, 03:02:29 pm
content: Most PCB software won't stop you running traces under screw heads, it doesn't know you'lll put a screw in that hole, and it won't always turn out badly, but it is risky.In theory the solder mask stops the screw head ever contacting your traces, but it can easily wear away if th screw is lossened and retightened, if you're unlucky it might even wear away at a point the first time you tighten.So now your screw is "live" with whatever is on the trace.Does this matter, if its two traces under the same screw head that's a short between them. But if it is only one trace under a screw head maybe not?Unless the screw goes in to something metal, and another screw on the board also goes to the same metal thing, and now the trace which shorted to one screw, and the trace which shorted to the other screw short to each other via the metal object to which the board is mounted.Definitely there are times you can get away with single traces under screw heads, I've broken this "rule" sometimes without harm, but you have to be very clearly planned about exactly where your board will be mounted.If you can't guarantee you'll never mount with multiple scews to something metal*, then put a ring of anti-copper "restrict" layer at the boundary of the screw head's radius, a little wider than the head to account for variation in exctly where the screw sits in its hole.And if you can't guarantee you'll only ever screw it from one direction, not mount it backwards on to some object with the right shaped cavities to let top sise components fit, I'd recommend avoiding letting traces go within the same radius on the other side of the the board within the screw head radius too.*perhaps you can guarantee for a specific purpose board (sized to fit the cavity in this machine, read that weird protocol input and run this particular stepper motor 5cm away to the left hand side) for a specific system, but you usually can't for a board you design as a "module" (a sensor, a connector breakout...) for various uses in multiple future projects.

author: temperance
author_rank: Super Contributor
timestamp: September 19, 2023, 07:39:14 pm
content: "it's just a separate wire to chassis ground to not couple the noise into the controller/analog circuitry.. maybe a dozen millivolts or so difference, which the op amps should get rid of the common mode voltage from and just sense/amplify the drop across the shunt resistor"If that's the case, you might consider to put two anti parallel diodes between those two GND's on the printed circuit board to limit the potential difference between those two GND's in case of failure and to limit transients caused by switching a load with the MOSFET's. (But I have no idea how fast those MOSFET's switch, the load and the length of the chassis GND wire)But, connecting the load's to chassis GND creates a loop of unknown length. Are you sure this is what you want? The loop area of the load's connected to the MOSFET's should be as small as possible. (length wise and area wise) especially if the load's are valves with anti parallel diodes.-Routing the 5V and 12V trace close to the power stage is also not a good idea. Switching noise will now couple into the 5V and 12V rail. The 12V rail can run along the other edge of the PCB and the 5V should be kept "internal" to the PCB where the GND plane acts as a shield. (You will need some VIA's to connect the other NET's now. But that's not a big deal and better than coupling noise into the power rails)-Decoupling of the long power supply traces combined with high Q ceramic capacitors can cause oscillations on the power rails. Consider placing 1 or 2 regular aluminum electrolytic 10µF capacitors along the power supply traces to kill the high Q circuits. (The ESR of the aluminum capacitors will act as a load for the otherwise high Q circuit)