Designing my first circuit - Page 1
Forum section: electronics / beginners

author: trilerian
author_rank: Regular Contributor
timestamp: June 13, 2023, 03:52:50 pm
content: If you have read some of my threads, you may know what I am trying to do. If not, I am attempting to get telemetry data for current, voltage, rpm, sensor angles, for a bldc motor driven by an ESC. I have connected components on a bread board and used an arduino nano and have my proof of concept. Now I want to get this into something usable and have everything run off a 2s lipo battery. I have drawn up a schematic, please forgive me, this is my first attempt at doing so and I haven't found a good tool yet. I just found some online tool where I was mainly drawing box's and lines. The atmega 328p pins are not correct, but I labeled what pins I am using and what they are. I will have to make sure these are correct before I make the board.The layout will be powered by the 2s lipo, which will have a current sensor in series to the ESC. Then I am hoping I can branch off the main line to an l7805 to drop the voltage to 5v for the component vcc. Also another branch goes to a voltage divider that will input to an anaolog pin on the controller so I can calculate voltage. Sensor pins from the motor will go to digital input pins on the controller where I will get the rpm info, and some day the hall sensor angles.My initial concerns are the current from the battery to the ESC can get high, I have a 50 amp sensor and may hit 30 amps loads, but I don't know how this affects the l7805 or the voltage divider. I also need help with capacitor values for the low pass filter on the current sensor. I have no idea what frequency cutoff I should use... And capacitor values for the l7805. Also in some diagrams for the l7805 I saw resistors connected from vcc to gnd, not sure why. And any other suggestions for components needed. I am attaching my drawing, again, my first attempt at a schematic.Thanks

author: CountChocula
author_rank: Unknown
timestamp: June 13, 2023, 07:34:30 pm
content: Howdy! A few suggestions… first, I think you should consider using proper EDA software to lay out your schematic.KiCADis free and easy to use, and it will help you bring greater clarity to your drawings. Like this, it's a bit hard to tell how some of the components are connected to each other (which means that it will be hard to design a PCB, or even to assemble the circuit on a breadboard).Second, I wouldn't connect your regulator after the current sensor, but rather branch it directly off the battery. It's not so much that I think the two are going to interfere with each other, but if the current sensor generates any noise on the VCC line, you'd be making the 7805's life that much harder for no obvious gain. Speaking of the 7805, theminimumcapacitance required is specified in the datasheet: 330nF on input, and 100nF on the output. There probably isn't any harm in making them larger than that, and in fact I think it would be a good idea to do so; I've used 10µF ceramics on both sides, because it's typically what I have on hand, and they have always worked fine, so there's plenty of flexibility—just don't use electrolytic caps. Don't worry about the schematics with the resistors from the datasheet—those are for variable-voltage 78xx models, in which you use a voltage divider to program the output voltage.One thing to keep in mind is that the 7805 drops ~2V to regulate properly, and that means that, with a full battery, you only really have around 1.5V of headroom in your circuit, and that's only going to get worse as the battery discharges, or as the voltage sags when the motor draws a lot of current. I don't know how big of a deal this is going to be for you, tbh—the ATMEGA is pretty easy when it comes to voltage, so perhaps it's not going to be a problem, but that's why I was suggesting adding a bit more bulk capacitance to your circuit. At a minimum, I would also add a 100nF decoupling capacitor between VCC and GND on the microprocessor.The voltage divider you use to monitor battery voltage could use higher-value resistors; as it is, you're wasting around ~3mA of current, but you could use 11k and 15k instead.As far as the low-pass filter on the output of the current sensor goes, that's there to suppress noise, and I think the best way to go about figuring out the values is to look at what the noise looks like experimentally. From first principles, the only thing that's likely to dump noise into your circuit is the motor, so the filter, if needed, will probably depend on the speed at which the motor turns.One thing to keep in mind is that the current sensor will produce a voltage that's proportional to theinstantaneouscurrent that curses through it. Unless you want to sample its output at a very high frequency, if the load is very spiky, you probably want some kind of value averaged over time. In this case, you can also use a low-pass filter to smooth out the signal and get a more realistic reading.One final note: The 328p has an internal oscillator that can run the CPU up to 8MHz without the need for an external crystal. Something to consider if you don't need the extra speed, since it means three fewer components to worry about.—CC

author: trilerian
author_rank: Regular Contributor
timestamp: June 13, 2023, 08:42:57 pm
content: Quote from: CountChocula on June 13, 2023, 07:34:30 pmThank you very much for your comments! As to the voltage issue, that should be fine as this is for testing and will not run the battery down below 8v although it may get close to 7v under load, the battery being used will be a 2s 4400 mah lipo. Thanks for the capacitor values!Why don't use electrolytic caps on the l7805? To the frequency? I'm not sure if I need the full 16mhz or not. But there are 3 digital pins that I am reading and would like to figure out how to compare them to each other to get the sensor angles. Not sure how I am going to do that yet, but that is the goal. Currently they are just reading the frequency for rpm. The current I am averaging over 300 reads, and there is a thread on herehttps://www.eevblog.com/forum/beginners/understanding-allegro-current-sensor-output/that has scope output. Again, I don't know what I should be trying to filter. Motor rpm could be as high as 60krpm, but most motors that I will test will max out between 20-30krpm.To the EDA software. I downloaded and tried to use KiCAD, that was a bit difficult. I have Fusion 360 (personal use free license) for 3d printing and I think you can do schematics and board design on it as well. But regardless, I need to learn how to use those features still. It is on my list, lol.I will update my design with the capacitor values for the l7805 and the resistor values for the voltage divider.

author: CountChocula
author_rank: Unknown
timestamp: June 13, 2023, 09:04:29 pm
content: Quote from: trilerian on June 13, 2023, 08:42:57 pmElectrolytic caps have a lot of parasitic characteristics that tend to become problematic—they have higher ESR, leakage current, and so on; their main advantage is that they have a very high capacitance/cost ratio. It would probably be OK to have them here if you put them in parallel with ceramic caps… but, to be honest, the 7805 is such a workhorse that it might just work even without any caps. Do keep in mind that datasheets are written for engineers who need to build systems at scale… for a one-off, as long as the thing you build works under the conditions you need it to work in, it doesn't matter as much, IMO.QuoteUnderstood—again, it was just a suggestion. Ultimately, I think your best bet is to try things out and see if they work. This is a pretty simple circuit, so there's no need to overthink it ;-)QuoteI hear you… it was really hard to figure out how to use these tools (I started with Eagle) at the beginning; once you get used to having one, however, they become lifesavers. Good luck!

author: trilerian
author_rank: Regular Contributor
timestamp: June 20, 2023, 02:07:20 pm
content: I made my schematic in Kicad and designed a board. Well, sort of lol. I am getting errors on the drc check for front solder aperture bridges items with different nets. It is because of the 6 pin jst zh connectors that I had to make custom footprints for. The solder masks seem fine, but there is a circle around them that overlaps with the next pins. I think I can ignore this, but not sure. I am attaching a pic.Thanks

author: sparkydog
author_rank: Regular Contributor
timestamp: June 20, 2023, 07:24:42 pm
content: Your ground plane should cover the whole board, or at least it should fully cover your components. (Maybe you're trying to keep it away from U1.{4,5}, which isn't unreasonable... but if that's the case, use a non-rectangular fill. Or a keep-out.) One of the reasons to use a plane, as I understand it (although keep in mind I am also a total n00b) is so that your ground return can follow the signal traces as closely as possible, which means it needs to cover the entire area where those traces are present.The whole board is taller than it needs to be. Moving the MCU closer to the lower edge of the board will let you make the whole thing shorter. Alternatively, unless you have a really good reason why the edge pads need to bebesidethe mounting holes rather than above, shifting those up a bit (and moving J6 down a bit) would let you move those closer and make the board less wide. I'd probably do the latter.It looks like you're still using the Nano, and not the bare ATMEGA shown in the schematic? (That's fine, just noting the discrepancy...). If height permits, consider snagging some header blocks, maybeTE 6-534237-3, so the MCU board is swappable. For clarity's sake, I'd also encourage labeling, at least with F.Fab text labels if not on the silkscreen, thefunctionsof the MCU pins you're using. (D2, D3, D4, A0, A1, SDA and SCL, if I'm not mistaken. Also, VIN, 5V and GND, although those are more obvious.) You might also want to slap an "I2C" on the silkscreen near J6,and for heaven's sake, add silkscreen labels to the battery pads!Seriously, always,alwaysinclude silkscreen labels on external connections if there is any possibility of connecting them wrongly. And, related, consider adding a board identifier and version number somewhere on the silkscreen. (And consider keeping your designs in a git or other VCS repository. Yes, I am dead serious about this.)Why does the trace to A1.30 overshoot and curve back, rather than just going directly to the pin? (Someone is also wincing at that right angle in the trace. That may not be an actual issue for you, but since I don't see any reason to have it...) You can also probably move it down a bit, as well as the trace above it. Similarly, why does the U1-C1 trace not take a more direct route? (It can't be "clearance", because it gets much closer to U1.5 later.) I would also move R6 in order to improve those traces, probably lining up its hole with that of R5. I'd also rotate R5 to shorten the trace from C1. I might also rotate R{2,3,4} in order to shorten the traces by taking advantage of the components themselves. I'd also put R{2,3,4}muchcloser together.Also, please move J6 down a smidge so that 5v trace is a straight horizontal run. (And consider making your power trace(s) thicker.)Extending your ground plane will also allow you to replace several GND traces connecting components with very short traces to vias, which I would encourage. (The one between C1 and C2 is short enough I'd probably connect those traces directly and drop 1-2 vias in the middle. And lose the connection to U2.2.) You can also move C3 closer to U1, maybe rotate it so its GND pad lines up with U1.2 and do the same trick of a very short trace. In that instance you can probably omit the via since U1.2 is a PTH.I'm curious why you went with a flat mount for U2 rather than vertical. Is it because of height constraints? (But you have several vertical connectors that are going to have very smashed wires if vertical space is that tight.) I'm not sure if there's a thermal benefit when it's insulated as in your design, but it takes up an enormous amount of board space. Even assuming you don't want that U2-C3 trace running under the U2 package, it looks like there's enough room under U2's legs to run that trace much shorter.The connections from the left pair of pads to U1 are... odd. I would consider using a pour instead of traces there. I'd probably also add at least another pair of vias to the GND pads, and another pair on the bit connecting the two pads. Even better would be to move those pads to the back, but that may not be possible. Or use some of that empty board space to extend the connected copper and fill it with vias.Overall, there seems to be a lot of wasted space that could be trimmed, especially if you replace the TH resistors with SMD. Also, it looks like you have room that you could rotate the MCU and significantly shorten most of your traces. (Almost surely you can do so if you replace the resistors with SMDs.Another tip: so far as I know, unless you know parasitic capacitance is an issue, you ought to make your traces, at least the J2/J3 ones, wider. You have plenty of room with this design that you might as well take the lower resistance.Quote from: trilerian on June 20, 2023, 02:07:20 pmI would encourage fixing that. First, check if your holes need to be as big as they are, as they areveryclose together. Second, check if you can reduce the clearance so that the clearance zone doesn't overlap with adjacent pins. Youmayneed to use oval pads.If you posted the.kicad_pcbor even just the footprint list, I would probably amuse myself by fiddling around with it. 🙂 (For future reference, it's helpful to also post your schematic, and some folks will also critique your BOM if you include one, or if your schematic includes part identifiers.)

author: james_s
author_rank: Super Contributor
timestamp: June 20, 2023, 07:33:55 pm
content: That PCB looks pretty good for a first attempt, but there is some room for improvement. Most of those traces could be significantly thicker, there's no sense in making them thinner than necessary. Also be mindful of the clearance between things like traces and screw holes or unrelated pins, no point in putting things closer than they need to be. I would also suggest electrolytic or tantalum capacitors at the regulator, there are some problems with multilayer ceramic caps, one of which is the ESR can be too low and cause the regulator to oscillate, many 3 terminal regulators, especially older designs like the 78xx rely on having some ESR there. The other issue is that with most dielectrics the capacitance drops considerably when there is a DC voltage across them, so for example a 10uF capacitor may in reality only be around 2uF at the operating voltage and this effect is greater with physically smaller capacitors. It looks like you have loads of room there so there's no need to use tiny parts.

author: sparkydog
author_rank: Regular Contributor
timestamp: June 20, 2023, 07:47:55 pm
content: Quote from: james_s on June 20, 2023, 07:33:55 pmRight. There's one trace that looks uncomfortably close to the top right mounting hole. Scooching J6 down a bit would help, though on further thought, you might want to flip it. That will avoid the SDA/SCL traces needing to cross and let you run them straight to the connector, rather than needing to run one around back. (You'll need to run the 5V around back, still.) However, if I'm interpreting that footprint correctly, italsomight make it easier to unplug the connector, which is the real win. OTOH, I might have that backwards, in which case,don'tdo that.What connector are you using?

author: trilerian
author_rank: Regular Contributor
timestamp: June 20, 2023, 08:59:14 pm
content: Quote from: sparkydog on June 20, 2023, 07:24:42 pmThanks for the comments, I really appreciate you taking the time to write all that out.Ground plane, yep, I was trying to keep it away from the current sensor, just didn't know. I will make it cover pins 1-3 though.Using the Nano as a prototype and my first design. I will use the bare 328p chip later. Header block is a good idea though.Overshoot on A1.30. Missed it, that was me thinking the outline of the nano was impervious, lol. Even though I ran another trace through it.Overshoot U1.C1 - Now this was me not wanting to run it directly under the bare metal of the ACS772. Why, I don't know. And a question, will these traces be covered or be bare copper?Flat mount on the 7805 because I was not thinking how high the nano would be.Traces for the U1 4, 5. Originally I tried to do a power plane there, but got thermal errors on the drc check. So I went with 9mm traces. This is, I am sure, a matter of me having no idea what I am doing. I have watched so many videos in the past week, lol.The JST ZH connectors, according to the data sheet, need holes at 0.7mm and they are spaced 1.5mm apart. I think the pins are actually 0.5mm, so maybe I can resize to 0.6mm.I will go through this and try to make some of these changes, and when I am done, I'll post the kicad files too. Just not knowing on my part. I didn't draw up a BOM, hadn't go there yet.Mainly this is just to be able to test with my setup and stop using the breadboard. I plan on future revisions to make this even better. I know I will eventually use the ACS724 and smd resistors. At that point I may try to replace the regulator with something else as well.To be quite honest, I have had to stop myself from posting on, how do I do this, or how do I do that. Instead I have read a lot and watched a lot of videos. But there are still things that I would like to be able to do on this board that I haven't quite figured out yet.Thanks again, these are great comments!

author: trilerian
author_rank: Regular Contributor
timestamp: June 21, 2023, 02:00:24 pm
content: I made some changes to the board. I couldn't find a quick way to upload the KiCAD files since the forum doesn't like the filetype. So I changed the extension to a txt file and have included them. I'll also post a screenshot.Couple of notes:1. I changed the capacitance of the ceramic capacitors for the 7805 to the capacitance listed in the data sheet, then added a 10uf electrolytic to each side in parallel. This seemed to be what some others did in my searching. And I think it was suggested earlier as well.2. I realized I was routing power to the Vin on the nano, which is for 7-9v and has a regulator on that pin, so I changed my routing to the 5v pin. The ERC in the schematic doesn't like having a v out pin attached to the 5v pin on the arduino. I assume I can ignore this error, since that is the suggested way to power it with 5v. Another question, should I just use Vin and get rid of the 7805 since I will be powering this with 8.4v?EDIT:I made a change adding power plane to the top and bottom where the Batt+ and ESC+ attach to the sensor pads. I choose solid fill, had to change some other spoke settings as well. Then added a lot of vias. Does this work the way I think it should? IE, provide the connection to the sensor pads? And will it be good for 20 amps?

author: sparkydog
author_rank: Regular Contributor
timestamp: June 21, 2023, 06:53:15 pm
content: Quote from: trilerian on June 20, 2023, 08:59:14 pmYou're welcome! As a mostly-n00b myself, I tried to write the reviewIwould want. 🙂Quote from: trilerian on June 20, 2023, 08:59:14 pmHeh, I had a feeling that's what happened with A1.Tracesare generally covered. Pads, obviously, must not be. (Tip:check thisbefore sending your board to be manufactured!) In KiCAD,Alt-3opens a 3D view of your board. Besides being able to visualize the actual 3D-ness if you have models of your components, it's useful for being able to see where the copper is exposed and where it isn't, since that's not always obvious from the normal 2D view. (TandSin that view toggle visibility of THT and SMD components so you can look at the bare PCB.)While it's possible for the insulation layer to be damaged, it'susuallyallowed to run traces underneath components, especially components that are insulate in their own right. This is also an acceptable technique for crossing traces, and you'll sometimes even encounter"0Ω" resistorsused for the express purpose of bridging a trace. (In THT boards, these sometimes manifest as bare wires.)That said, I would consider it reasonable or even desirable to avoid traces under bare-metal components (aside from such bridge wires) pressed directly against the board. IOW, not running traces under the metal back of U1 is sensible.Quote from: trilerian on June 20, 2023, 08:59:14 pmIt can berelativelyflat if you mount it directly with male header pins (soldered to both your PCB and the Nano carrier board). For prototyping, however, being able to easily pull and reuse the Nano when you're done is probably preferable. OTOH, there's an argument to be made for being as close to the final design as possible, if you're hoping for the final version using a bare ATMega to be as thin as possible. (That said, if you're looking for super-thin, you might want to consider right-angle connectors.)Quote from: trilerian on June 20, 2023, 08:59:14 pmThat's... cozy, yeah. Looking around online, other footprints do seem to have extremely small clearance. I probably wouldn't make the holes smaller than the data sheet recommends, but make sure your pads aren't larger than needed. If it were me, I'd probably also go with oval pads.Quote from: trilerian on June 20, 2023, 08:59:14 pmNo worries, I actually don't think I've seen the raw files posted that often. (Although, come to think of it, it probablywouldbe useful if folks tended to post them.) That's more my own itching to fiddle with it. 🙂 You'll definitelywanta BOM, if only for your own use, at some point. It can be useful to post it if someone wants to critique your component selection or just try to recreate your design (again, fiddling itch), but IMHO if your schematic includes part numbers, there's no need to post a separate BOMhere.Quote from: trilerian on June 20, 2023, 08:59:14 pmMeh, I say, just ask. Not everyone learns best from videos, and if you ask here, other people have the opportunity to learn as well.Quote from: trilerian on June 21, 2023, 02:00:24 pmRight; "don't feed VIN less than ~7V" is my understanding as well. I think you can feed it 12V, maybe even more, but the on-board regulator isn't very efficient and it isn't recommended. My understanding is you can feed 5Vtothe 5V pin, but it should be fairly "clean", e.g. what you'd get from USB.Quote from: trilerian on June 21, 2023, 02:00:24 pm🤷 For prototyping, that's probably fine. Since IIUC you plan on eventually using a bare ATMega, which doesn't have a built-in regulator AFAIK, you'lleventuallyneed a regulator, so I'd say it's up to you. Do you prefer to delay having to cross that bridge, or do you want to be as close as possible to the final design earlier in the process?Quote from: trilerian on June 21, 2023, 02:00:24 pmA random trace-width calculator I consulted recommended 15mm traces. Running them top and bottom as you've done is a good way to halve that; I've done similar myself. I'm not sure the viasabovethe pads are useful. (Obviously, the onesinthe pads are how you take advantage of the extra copper on the back, but the U1 PTHs, and the vias that are part of said PTHs, should be plenty for that end.) I'd make the gap between the fills a little smaller; there's little-to-no reason not to go up to the edge of the PTHs. (It looks like you need to learn how to change the grid settings. 🙂Alt-1andAlt-2will toggle between your two configured grids, though I don't recall if the secondary grid is by default finer than the primary.)Overall, though, this is looking MUCH better! Give yourself a pat on the back!

author: sparkydog
author_rank: Regular Contributor
timestamp: June 21, 2023, 10:05:40 pm
content: Loading your PCB was slightly interesting, as you seem to have a newer (unreleased?) version of KiCAD than I do. 🙂It's also an interesting exercise in spotting the absence of good habits. That's not to say you're doing itwrong, just that folks with more experience know tricks for doing thingsbetter. For example; take advantage of value labels on footprints, and don't be afraid to move them to the silkscreen layer if you want them to be visible on the final product. (Personally, I don't bother with componentvalueson my silkscreen, instead relying on the reference identifiers and cross-checking against my BOM, but if it makes you happy, go for it.) Don't forget, also, you can edit footprints on your PCB without changing the library. Do those things instead of adding free-floating text; that way when you move components, the associated text goes along for the ride.Mind your grid and your component alignment. You still have some components that are needlessly unaligned (J6 is particularly "bad"), and there are a lot of tiny traces floating around. On a related note, I like to avoid traces leaving pads at "strange" angles, even if that means running a trace e.g. vertical, then diagonal, then vertical again. (This mainly applies to non-circular pads and when you'd have traces leaving a pad at a 45° angle to each other.)You've probably noticed some of the thermal-relief spokes are... not so good, but probably don't know what to do about them. You can fix them by rotating the pads 45° or changing them to "ovals". (If you make the pad type 'oval' but leave the dimensions the same, they're still effectively circles, but KiCAD will put the spokes horizontal/vertical rather than diagonal. Rotating a circle just changes where KiCAD puts the spokes, since, y'know, it's a circle. 🙂)Several of your Jx identifiers appear to be using 0.1 thickness rather than 0.15. Either make sure your PCB manufacturer supports this, or use 0.15, which seems to be the standard. (Related: I wouldn't bother with identifiers on things that arejustpads, meant to have external wires soldered to them. The semantic labels are what matters for those.)Also, note that fills are trimmed to the edge cuts. I've noticed a number of designs that deliberately make their fill boundaries much larger than the actual board. You usually want the fills to cover as much area as possible. Use design rules to enforce enough fill-to-edge clearance. This way you don't have to worry so much about the fill edges if your board shape changes.It looks like 0.35 clearance is the best you can reasonably hope to attain on a lot of components. That should be fine for prototyping, but if you move to production, check what Pollution Group you need to deal with, and be aware you may need to add conformal coating.This is what I did with a little fiddling but without substantially changing your layout. I'm still playing with doing the latter. This version doesn't include some of the changes suggested, in particular, using text that's part of the footprints.

author: sparkydog
author_rank: Regular Contributor
timestamp: June 22, 2023, 12:55:42 am
content: ...and here is the boardIwould design. 🙂The main thing you'll notice, besides that I rotated A1, is thatthis board is much smaller. Sure, for a prototype you're probably going to get made for a flat-rate introductory price, that may not be a big deal, but it's good to start good habits early. I did have to give up silkscreened capacitor values, however, as there simply wasn't room for that much text.The positive terminals are neatly isolated at the edge of the board. This results in the mounting holes being not at the outermost edges, but that's unlikely to be a serious problem. I also deliberately swapped Battery- and ESC- so the wires wouldn't be alternating, but that's purely a personal preference which, AFAIK, could be swapped back with no harm. I also very deliberately moved the positive pads to thesidesof U1, as this provides much more trace width between the terminals and the pads of U1. (The other way, you get a more direct line to about a third of the pads, but the other two thirds see very little trace width. This way, something like five sixths of the pads see ~3mm of trace per front/back.)None of the traces are particularly long or circuitous. That's a combination of planning, unconscious skill, and dumb luck. 🙂 Therewassome deliberate use made of R5 in particular to allow the 5V and Volt Sense lines to cross. (Similar with R1.)The JSC traces could be thinner, I suppose. On the one hand, I don't think it hurts anything having them wider, but mostly I just didn't bother changing their size. The arrangement of those headers and their associated resistors is my least favorite bit, but there wasn't a lot to be done with the space available. It's okay, but not amazing.After looking at the 3D model, I did end up flipping J6. Ithinkit should be easier to plug and unplug in this orientation. (And the SDA/SCL traces don't need to meander.)I rearranged the caps to be between the battery and the regulator, and between the regulator and the MCU/J6. I'm not sure if that's better or worse, but... 🤷I find myself wondering if C3 is redundant with C2...DANGER, WILL ROBINSON!While fiddling with this, I noticed that the outlines on your big pads and JST headers, that are almost certainly supposed to be F.Courtyard,were F.Mask. Besides not helping KiCAD know how to not overlap components, this was resulting in strips of bare copper being exposed in places you almost certainly don't want that. If you make no other changes to your PCB, you probably want to fix that!All in all, this was a lot of fun, and I hope, if nothing else, you'll be inspired and maybe pick up a few tricks. Thanks for sharing!p.s. If you select the F.Silkscreen layer before taking a screen shot, it rendersaboveF.Cu, which tends to be more readable. Also, there are some small tweaks in the.kicad_pcbthat aren't in the screenshot. (Also on the subject of 'things I didn't bother to do'; if you use this, don't forget to bump the version number!)

author: ArdWar
author_rank: Frequent Contributor
timestamp: June 22, 2023, 03:04:02 am
content: I think duplicating both polygon pour on both top and bottom layer will help a bit with current carrying capacity here. I don't see any conflict at least and it doesn't hurt to do .Don't put screw mounting hole near large solder pad, especially one designed for large cable entry. Or at least put more distance. You'll thank me laterIt also seems the hole to be too small if it's supposed to be for M3 screws. My usual design is a 3.2mm hole surrounded by 6.4mm of keepout zone (if I want isolation) or GND pad (if I wand grounding) around it.Also, while it's not wrong per se, it's weird to see 0603 MLCC cap among what mostly thruhole component selection

author: sparkydog
author_rank: Regular Contributor
timestamp: June 22, 2023, 03:07:12 pm
content: Quote from: ArdWar on June 22, 2023, 03:04:02 amAssuming you're talking about the battery/ESC terminals, that's excellent advice... and the more recent designs (both mine and trilerian's) already do that. 🙂 Note the mess of vias. (Well, the GND net ones "technically" don't, but that's because the front pads are via'd to themuch largerGND pour.)Quote from: ArdWar on June 22, 2023, 03:04:02 amFWIW, my assumption was that the leads stick out away from the board, and that, whileboardsize is to be minimized, there is some room for cable management. In which case the mounting holes in any of the designs in this thread might be "snug", but not, I think, unmanageable.Depending how actually-necessary it is for the caps to be as close as possible to U2, one could get more clearance without increasing the board size by moving C6 to be next to C3, moving C5 to where C6 was (with a little creative routing of the 5V traces to go around it) and pulling its trace from R5, and moving the mounting holes and GND pads to the right. Alternatively, just make the board a smidge wider and keep the positions of U1, C3 and the positive pads relative to the edge. (Or, if you justreallydon't care about board size, move those same componentsrightand move the mounting holes to other side. You end up with a big section of empty board that way, though.)I admit I didn't check trilerian's mounting holes, just assumed he was okay with them as-is. Theyare3.2mm holes, though, so I take it you either didn't load the actual KiCAD file and are getting caught by optical illusion, or are referring to the keep-out? (Personally, I use 6/32 mounts which are 3.7mm with a 6.25mm keep-out. My footprint includes a model of the actual screw, and eyeballing it, the clearance looks "fine". Maybe M3 screws have proportionately wider heads? Or you're just more conservative than me. 🙂)

author: DavidAlfa
author_rank: Super Contributor
timestamp: June 22, 2023, 06:04:05 pm
content: The 7805 is ancient tech, it's not a LDO and will waste about 1.5V, so you'll need at least 6.5V in for 5V out.Unless absolutely required for some reason, I'm pretty sure a smaller SOT89 smd regulator will work, you could easily fit everything under the mcu board going SMD.

author: trilerian
author_rank: Regular Contributor
timestamp: June 22, 2023, 06:28:22 pm
content: Quote from: sparkydog on June 21, 2023, 10:05:40 pmVersion 7.0.2QuoteI'll keep this in mindQuoteI'll have to look into this a bit more. Sounds like good advice, but I am not quite sure how to implement that yet. Still have lots to learn...QuoteKnow you really lost me, lolQuote from: sparkydog on June 22, 2023, 12:55:42 amThis is pretty cool, and I do like some of the ideas here. However I need to keep the +/- terminals close to each other. I have another design I did with the BATT on one side and ESC on the other. I'll post a pic.QuoteTHANK YOU! I have fixed that on my footprint, but I already ordered some from jlcpcb (they approved it without issues). I sent them an email hoping to be able to fix this before they actually make it.QuoteYeah, this is getting addictive. Definitely more fun than sudoku!QuoteThanks!

author: trilerian
author_rank: Regular Contributor
timestamp: June 22, 2023, 06:36:54 pm
content: So I decided to start designing the 328p by itself. Here is what I have so far... Also as suggested I will replace the 7805 with an smd component. But for this revision, it is still in there. Since this is getting smaller I had to go to 0.5mm traces. Should I design around 1mm traces, or is it fine to go smaller?I don't know if the negative terminals are sufficient, I removed the top layer trace between them to make room. Also went to the ACS724 instead of the bulky ACS772. But I need to keep that around as I will need one of these to measure current up to around 200 amps. That won't be sustained though, less than a second, and the entire run will be around 5 seconds. But the board in general needs to be able to handle 20 amps continuously for a few minutes.

author: DavidAlfa
author_rank: Super Contributor
timestamp: June 22, 2023, 07:53:18 pm
content: Signal traces not carring more than few ma can go down to 8th just fine, try 0.25mm/10th.Why not get the atmega in tqfp32?Also, 0805 resistors/capacitors should be easy even for a beginner, just practice soldering a bit.You can make that in 1/5th of that board space!Use ground planes for both sides, then join them using small vias every 5mm or, 0.4mm vias will be fine.This is called via stitching, provides better shielding and more robust ground.You can use the bottom layer too! Some traces would be a lot shorter.

author: sparkydog
author_rank: Regular Contributor
timestamp: June 22, 2023, 10:46:10 pm
content: Quote from: trilerian on June 22, 2023, 06:28:22 pmHehe, yup. 6.0.11-3.fc37. I'd need to update the whole machine to Fedora 38. 😛 Anyway, looks like 7 has only been out (at least on Fedora) since February.Quote from: trilerian on June 22, 2023, 06:28:22 pmBoard Setup > Design Rules > Constraints > Copper to Edge Clearance. Note that KiCAD's default is effectively "zero", and most manufacturers want more, so finding this, and figuring out from your manufacturer what itshouldbe, is a good idea. Setting it properly, DRC will also flag if you have traces too close to the edge. If you look at thefileI uploaded (not just the screen shot), it should be obvious where I have fills extending beyond the board edges.Quote from: trilerian on June 22, 2023, 06:28:22 pmHeh. Do you know the basics of creepage and clearance, at least? If not, you have more studying to do. 🙂"Pollution Group" deals with the environment to which your board is going to be exposed, e.g. is it in a hermetically sealed enclosure, or sitting in a metal shop where it might get covered with metal shavings? A board that's going to be exposed to outdoor air needs greater clearances than one that's only used indoors. IOW, don't forget to consider the environment in which your production board is going to live and whether you care about meeting the relevant standards. If it's just for your personal use, you're going to be nice to it, and failure isn't a big deal, this isn't very important. If you plan on using it in a shop or farm building and failure could cost five or more figures (US dollars, or equivalent in other currencies), or hurt someone, or if you plan on selling it, then knowing and following the standards is more important.Quote from: trilerian on June 22, 2023, 06:28:22 pmTotally understandable, though of course it limits how you can arrange things.BTW, am I understanding correctly that you have a 20A current path, battery > BAT+ > U1 > ESC+ > the ESC > ESC - > BAT - > the battery? If I followed that correctly, you may want to keep ESC - and BAT - as close together as possible, and avoid if possible other traces or components near (or opposite!) that direct current path. I'd almost be tempted to put BAT - and ESC - at the extremity of the board, with BAT + / ESC +inisidethose, with enough clearance to run a single trace to a low-current ground plane. To save space, I'd probably go with a single mounting hole in between the negative terminals, making sure to connect said terminals on both sides of the board. (I'd then also run the positive trace from BAT + to the regulator as close to directly atop the GND trace as possible.)However, I'd also want to solicit other opinions whether this is a good or terrible idea. 🙂Anyway, I'm attaching a screen shot to clarify. This was quick-n-dirty and only covers the big pads, U1 (your original chungus component, but that shouldn't matter to get the idea across), and the ground trace / ground plane for the low current side of the board. I don't even have the connection between the negative pads. (One plus, however, is that this meets your criteria of minimizing how much you need to pull apart the battery and ESC wire pairs.) If you can separate the pads alittlebit more, you could shift the negative pads to the middle, closer to each other, and probably have room for mounting holes on the outside, but then you'll be trying to access themthroughthe battery / ESC wires, which, as ArdWar noted, may be challenging.Quote from: trilerian on June 22, 2023, 06:28:22 pmYou'll probably need to send them updated Gerber files, if you didn't already.Quote from: trilerian on June 22, 2023, 06:36:54 pmNice! The compactness is a marked improvement over your earlier version. Before getting into (hopefully constructive) criticism, give yourself (another) pat on the back; you earned it.Now... one thing I notice is that you still have a lot of traces that aren't centered on the PTHs / pads to which they connect (especially the PTHs of U1), and a few components that could be nudged just a bit. R4 jumps out; there's no reason that top pad shouldn't line up with R5. Similarly, I'd probably nudge C11/C12 up to line up with U3.5. (And move that ground-tie via onto the trace between U3 and C12.)I'm suspecting you haven't yet stumbled upon how to line up components? If you grab apad(not a footprint) and move it, moving it temporarily on top of another element will snap it into lining up with that element. You can then carefully move it where you actually want while keeping the alignment. If you're having trouble, an easier way is to temporarily move itdirectlyon top of what you want it to line up with and "set it down". Then, move it a second time; any time you move a component, KiCAD has snaps to constrain the move to only-horizontal or only-vertical. (Some times this gets in the way if I'm trying to line something up to the grid, and I have to move a component off to the side, then back to where I actually want it.)Imighttry to rotate one of the JST headers and move it to the right edge of the board, just so there's more room to get your fingers on it, but I'm not sure it's necessary, especially if you're soldering U1 directly to the board. Also, those JST PTHs lookverytiny. You have the clearance to make them a little bit bigger on the sides, and quite a bit bigger front/back (by making them oval), which will give you a larger solder area.Also, extend that ground fill to cover the area under the JST traces. Don't be afraid to run the fill over the mounting holes! (Or over the edges of the board.) KiCAD will carve out a gap for those, just as with any other through-hole.Last, you need some vias around the U3 current-measuring pads; otherwise, the pours on the back aren't doing you any good. If it were me, I'd be reading the data sheet very closely to see if they have any suggestions as to how to run 50 A though those tiny contact pads.Quote from: trilerian on June 22, 2023, 06:36:54 pmSee earlier comment. That said, youdohave a pretty big fill connecting them, but IIUC you're also tossing a lot of amps onto that plane which are going to be running past a number of low-current logic components. The (lack of) clearance between the ESC - pad and the R6 trace is also concerning. If nothing else, you could move the labels to the sides of the negative pads and shift them closer to the edge of the board.

author: Infraviolet
author_rank: Super Contributor
timestamp: June 22, 2023, 10:48:13 pm
content: trilerian, reply #17,Just a warning about the 328p, if you don't have some to hand then you're notlikely to have much luck getting one. That chip still seems in short supply, its one I like using and I've been having to work solely with those I got a while back*.Also a thought about the oscillator, given that style of oscillator has a metal case I always feel more comfortable not routing any top layer traces directly under it, just incase the soldermask were damaged in that area, if one trace shorted to the metal case it might be fine but if the solder mask were damaged in two places under it then two traces could short to it and therefore also to each other. I'd put its two traces on the bottom layer where they go under its area, then either bring them up in vias to the right hand side of it beside the two 22pF C9 and C10 caps, or keep the traces below and put those caps on the bottom layer.For ease of use of the finished board I'd also recommend putting text labels beside each pin on the header connectors that run in/out from this board. Especially the 2.54mm pitch headersthat you might put individual jumper wires in to while debugging.Unless you're going to solder a chip socket to the board and plug the 328p in after programming it in an arduino board, then you'll also want to break out all the pins needed for ICSP bootloading it. That would let you solder the 328p directly to this board without need for a socket.And the 328p needs a 10K resistor up to 5V from its reset pin.*The 328p was still available fine when chip crisis reports staretd to appear, it was 2021 before I couldn't get more, but since then it's been impossible to find in stock

author: trilerian
author_rank: Regular Contributor
timestamp: June 23, 2023, 01:12:59 am
content: Quote from: sparkydog on June 22, 2023, 10:46:10 pmI've only been at this for a few months, lol. I have a lot of studying yet to do.QuoteThanks, that makes perfect sense!QuoteYes, you have that correct, 20 amp continuous current. Needs to be able to withstand that for a minute or so. But like I said, the design itself I want to be able to handle 200 amps, for maybe a second.Here is a link to the allegro demo board.https://www.digikey.com/en/products/detail/allegro-microsystems/ASEK758LCB-050U-T-DK/4867629?utm_adgroup=Evaluation%20Boards%20-%20Sensors&utm_source=google&utm_medium=cpc&utm_campaign=Shopping_Product_Development%20Boards%2C%20Kits%2C%20Programmers&utm_term=&utm_content=Evaluation%20Boards%20-%20Sensors&gclid=Cj0KCQjw4s-kBhDqARIsAN-ipH03REs59d229gbiKXMRGYTYQKUtNI_tmk4rtC2y8pWN_1LibDJyyRUaAjtVEALw_wcBQuoteI hope they get back to me so I can send them in.And again, thanks a lot. I am learning from this and that is great!Quote from: Infraviolet on June 22, 2023, 10:48:13 pmUnless I am buying the wrong chip, Mouser has 25,000 in stock. I have about 10 on hand.And my intention was to burn the bootloader and program them in an Uno then solder them into the board. I wasn't worried about external pins. But I will take care of the pullup resistor. Thanks!While I fully plan on selling some of these when I am finished, the number that will be sold will be extremely low. More what I am after is the learning experience because I would like to build an esc that has all the onboard telemetry and use if for my flywheel dyno. That will probably take me down a different path for the mcu, but hey, three months ago I didn't even know what an arduino was...

author: Infraviolet
author_rank: Super Contributor
timestamp: June 23, 2023, 03:02:40 pm
content: " Mouser has 25,000 in stock"Seems they're suddenly back in stock everywhere now,a few months ago everywhere was still saying none until december. Good to know, thanks.