KiCAD custom board shape  - Page 1
Forum section: electronics / general

author: VEGETA
author_rank: Super Contributor
timestamp: September 11, 2018, 04:55:30 pm
content: Dear friends,I have made my schematic in KiCAD v.4 but now updated to v.5 and need to start doing the PCB. I plan to use an already made plastic enclosure... and settled for now at this one:https://www.aliexpress.com/store/product/junction-box-plastic-enclosure-plastic-box-electronic-plastic-case-desktop-electric-meter-panel-120-80-40mm/1182327_1909719876.htmlThe heatsink will be from outside so no worries.Anyway, how can I define the board shape to be suitable to this enclosure with all screw holes properly set in it?

author: saike
author_rank: Regular Contributor
timestamp: September 11, 2018, 06:13:26 pm
content: Kicad can import dxf files so, draw the outline with a cad program such as, Librecad, Draftsight, Freecad etc, save as dxf and import into kicad.

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: September 11, 2018, 06:39:25 pm
content: For such a simple outline it is hardly worth using DXF. It would be easy to do directly in KiCad.

author: Bassman59
author_rank: Super Contributor
timestamp: September 12, 2018, 09:45:07 pm
content: Quote from: VEGETA on September 11, 2018, 04:55:30 pmDraw the shape on the Edge.Cuts layer using the available tools. The screw holes aren't part of the board outline, so you'll have to place non-plated-through holes on the board.

author: VEGETA
author_rank: Super Contributor
timestamp: September 13, 2018, 08:12:29 am
content: Quote from: Bassman59 on September 12, 2018, 09:45:07 pmI still didn't try PCB in KiCAD but how can I draw in certain dimension like autoCAD for example where you input the length of the line?I never used any of the free tools and even autocad I used it 10 years ago.QuoteI read that many people say this one is better than autocad itself, I don't know if they are certain or just over-confident.I need a simple way to achieve the simple task that I want

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 13, 2018, 01:50:30 pm
content: Quote from: VEGETA on September 13, 2018, 08:12:29 amI don't know if it's really better since I haven't used Autocad in ages, but I do use Draftsight and it's certainly more than adequate for designing PCB outlines, front panels, etc.The added benefit is that you can be pretty confident about the DXF import and export in Draftsight, whereas in some other free tools that have a much smaller user base, there can be occasional bugs.

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: September 13, 2018, 07:07:32 pm
content: Quote from: VEGETA on September 13, 2018, 08:12:29 amYou haven't said exactly what you want, but I'll assume it's a rectangular board with 8 holes. There are a few tips to make things easier:- pick a grid appropriate to the dimensions- use the relative coordinate display (bottom right on status bar). Press spacebar to reset the position to zero at the current mouse cursor- right click on a line and you can set the position, size and width exactlyTo place the holes, I calculate the center point of the board, and reset the coordinate at that position.If you use the outline a lot, consider making it a footprint.

author: Bassman59
author_rank: Super Contributor
timestamp: September 13, 2018, 07:53:54 pm
content: Quote from: donotdespisethesnake on September 13, 2018, 07:07:32 pmAlso, you can draw lines and then use the Edit feature (select the line and hit the E key) and you can enter the endpoints of the line directly.For the holes, do the same thing.

author: VEGETA
author_rank: Super Contributor
timestamp: September 14, 2018, 07:03:08 pm
content: I have made a screen shot after adding all components. Now I highlighted the margin layer because I thought it is the one which defines board shape. Please correct me.Also, kindly tell me how to visually verify the total board shape? like 3D view for example. I am still a noob in PCB design.

author: VEGETA
author_rank: Super Contributor
timestamp: September 15, 2018, 01:11:20 am
content: As an update, I switched to this one:https://www.aliexpress.com/item/Black-Extruded-Aluminum-Enclosures-PCB-Instrument-Electronic-Project-Box-Case-100x76x35mm/32813597400.htmlIt is 100x76x35mm so my board is going to be 90x70mm. Kindly check the enclosure, it is difficult to know if 90x70 is gonna fit inside the slot and I don't know how to make sure.I ended up with a rectangle board in KiCAD which is what I wanted. Thanks for the explanation, it is really simple in KiCAD without any draft software.

author: VEGETA
author_rank: Super Contributor
timestamp: September 15, 2018, 02:37:39 am
content: By using this one:https://www.aliexpress.com/store/product/Split-Body-Black-Extruded-Aluminum-Enclosure-Instrument-Box-Mayitr-DIY-Amplifiers-Electronic-Project-Case-Shell-120/3094039_32821097426.htmAnd making the board 110x95 mm this was the result (without routing yet).. in attachments.

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: September 15, 2018, 10:19:13 am
content: Quote from: VEGETA on September 14, 2018, 07:03:08 pmUse the Edge Cuts layer for the board outline.A 3d view is available via View->3d Viewer.

author: VEGETA
author_rank: Super Contributor
timestamp: September 15, 2018, 12:16:01 pm
content: Quote from: donotdespisethesnake on September 15, 2018, 10:19:13 amI did as you can see in my recent posts.However, I asked other questions.

author: Rerouter
author_rank: Super Contributor
timestamp: September 15, 2018, 12:41:31 pm
content: As I cannot tell exactly what question your referring to in your latest post.how can I define the board shape to be suitable to this enclosure with all screw holes properly set in it?You either draw it in a dxf file if its a hard shape, or manually with the graphical lines / arcs on the edge cuts layer. This gives you the outside edge of the board,Next for your mounting holes, as a beginner to the software I would recommend just placing graphical circles on the edge cuts layer in the correct locations,For Kicad V5, you can use tricks to get everything in the right place, e.g. you know 1 mounting hole needs to be 45mm away from your first one, you can type + or -XXX into the positions for both components or graphical items, for example you might place 1 mounting hole, then duplicate it in the same location and in the Y position type +45mm at the end, and it will do the offset for you.For the edge cuts layer, the main one is that it should be seamless or the 3D veiwer gets unhappy.how can I draw in certain dimension like autoCAD for example where you input the length of the line?At present you cannot type the length and angle of the line in Kicad, but as you draw a graphical line, on the bottom left of the window it will display the angle and the length of the line.And finally, if it will fit in the enclosure,As it doesnt give any solid dimensions, your best bet would be to ask the manufacturer for a dimensioned datasheet for the enclosure, as even the spacing between mounting holes appears to be a guessing game at this point.

author: VEGETA
author_rank: Super Contributor
timestamp: September 15, 2018, 02:41:17 pm
content: This is the correct link:https://www.aliexpress.com/store/product/Split-Body-Black-Extruded-Aluminum-Enclosure-Instrument-Box-Mayitr-DIY-Amplifiers-Electronic-Project-Case-Shell-120/3094039_32821097426.htmlas you can see, there is no mounting holes. The PCB should slip in the slot then maybe you glue it in? I don't know. Getting the dimensions is a hard task without manufacturer so I will ask him.

author: sokoloff
author_rank: Super Contributor
timestamp: September 15, 2018, 03:01:36 pm
content: Unless you have a sample on hand, I’d probably leave the first prototypes a little large (with generous “keep outs” along the side and plan to belt sand the edge down to finished size and use that information for the production run.

author: Bassman59
author_rank: Super Contributor
timestamp: September 15, 2018, 09:34:54 pm
content: Quote from: VEGETA on September 14, 2018, 07:03:08 pmDraw the board outline on the Edge.Cuts layer, not the margin layer. The margin layer is informational — you put keepouts and the like on it. For example, if your board fits into one of those nifty Hammond extrusions, you can draw boxes on the margin layer to show where the enclosure’s slots cover the board.QuoteIf you draw the outline on the Edge.Cuts layer, it will automagically show up in the 3D view.You should probably read the fine Kicad manual.

author: bson
author_rank: Unknown
timestamp: September 16, 2018, 02:35:46 am
content: You need the actual inside, board dimensions. Approximate external dimensions are useless. So either make the PCB oversize and then trim it, as suggested, or wait for the enclosure to arrive and actually measure it. You also need to know the thickness of the board slot so your board will fit properly.

author: VEGETA
author_rank: Super Contributor
timestamp: September 16, 2018, 05:25:23 am
content: Making more research I found this one (with others):https://www.aliexpress.com/item/145-68-300mm-Aluminium-Extruded-Electronic-Enclosure-Solar-Junction-Box-metal-box-enclosure-black-color/32763604744.htmlIt shows the dimension up to the start of the slot as 135.7mm but to the inside wall of the slot as 140mm, so should I use 140mm as board width? while board length is of many options like 200mm or so. Not important, but I will choose a smaller one.what do you think?EDIT: this one seems enough:https://www.aliexpress.com/item/YGS-005-88-38-120mm-WxH-L-anodized-aluminum-small-aluminium-extruded-project-electronic-enclosure-pcb/32826456213.html

author: Rerouter
author_rank: Super Contributor
timestamp: September 16, 2018, 06:35:49 am
content: 140mm is the width of the board is can accomodate, however I would recommend you knock that down to 139.5 as it can be very hard to get boards in and out if your too tight. also as the slot is 2mm high I would recommend a 1.6mm PCB for the same reason (past experiences, its not nice having to file down the edges of your board to fit the slot due to cheap extrusion tolerances and warpage. (the really dirt cheap extrusions will generally have a weak curve to them as they will be from the start or end of extrusion where the flow rate wasn't quite right.)The only other recommendation is chamfer off your corners to make it easier to insert the board,As to retaining the board, if your device is not the full length of the enclosure, then you will generally use mounting screws to hold it to one end, either built in to your connectors or using through hole solder on mounting studs,

author: VEGETA
author_rank: Super Contributor
timestamp: September 16, 2018, 11:26:02 am
content: Quote from: Rerouter on September 16, 2018, 06:35:49 amThen I will probably make it 1mm off (139mm instead of 140mm) due to bad tolerances acknowledged by the manufacturer himself.I will use 1.6mm as it is the default. I don't know why you mention it.by chamfering off you mean make a round edge of the board instead of a 90 degree one?I will make around 5-10 cm off from the front but it will be nearly close to the end. I cannot visually imagine how the mounting screws will be attached in this case, so you are welcome to visually explain it.There are no mounting holes of any kind so I don't know how to do it properly.

author: sokoloff
author_rank: Super Contributor
timestamp: September 16, 2018, 12:17:17 pm
content: This drawing will probably make it clear. The end plates screw into part of the horizontal extrusion.Your PCB then (obviously) doesn’t need any holes for the mounting screws.

author: VEGETA
author_rank: Super Contributor
timestamp: September 16, 2018, 12:54:56 pm
content: I know that the front and end plates will be screwed (or the pcb front\back panels) but then if we put the main pcb in the slot, it can still move freely if there is some space like I pointed. you mentioned mounting screws but I found none other than the original ones for back and front panels which won't do us any good here.

author: sokoloff
author_rank: Super Contributor
timestamp: September 16, 2018, 01:49:14 pm
content: Ah. Make it the full depth of the box and there's nowhere for it to move once the end plates are screwed on.Your original post made me think you thought you had to put screw holes in the PCB.

author: 3roomlab
author_rank: Frequent Contributor
timestamp: September 16, 2018, 08:21:28 pm
content: i would suggest searching for a vendor that give some kind of "shop dimensions", which you can "borrow the pictures"ie :ie :or copy the "picture" to scale, but i did not try in kicadhttps://www.eevblog.com/forum/eagle/creating-pcbbox-templates/so i turn it into a "component" i can click and flip. likely doable in KICAD i think.

author: Rerouter
author_rank: Super Contributor
timestamp: September 17, 2018, 12:46:35 am
content: I mentioned a 1.6mm board because some people see a 2mm slot and think a 2mm thick pcb is the best choice.A chamfer is a straight line cut off corner. Making 2x 45 vs just 1x90. But rounding off gets a similar effectIn these enclosures you will likely be making holes in the end plates for your connectors to the outside world. So drilling mounting holes through an end plate is not uncommon. The studs I mentioned are essentially a solder on nut. Generally to suit a 2-3mm machine thread screw that secures your pcb to an end cap.The other way is to just make the board fit the enclosure length. Then it cannot really go anywhere

author: VEGETA
author_rank: Super Contributor
timestamp: September 17, 2018, 06:58:13 am
content: Since I am firm believer in hard fixing everything, I tried to think about more solutions. Here is what I got:1- using spacershttps://www.banggood.com/300pcs-M3-Nylon-White-Hex-Screw-Nut-Spacer-Stand-off-Varied-Length-Assortment-Kit-Box-p-984548.htmlAnother option:https://www.aliexpress.com/item/50Pcs-M2-5-M3-M4-Hex-Nylon-Standoff-Spacer-Column-Flat-Head-Double-Pass-Nylon-Plastic/32817236078.htmlBut now I have to buy these sets from aliexpress, which is mendoksai!Using this kit I can put 2-4 spacers under the board on the bottom part of the enclosure and glue them there... then put holes in PCB and use screw with a nut to secure it. It won't be precise but kinda will do the job.2- Soldering jointput 2 soldering pads (no connection) at the end of the PCB near the back plate, and make 2 pads on the back plate (which is a pcb)... stack then next to each other and solder them.I am looking forward to your opinion. I wonder how professionals do it.

author: bson
author_rank: Unknown
timestamp: September 17, 2018, 07:02:43 am
content: Quote from: VEGETA on September 16, 2018, 11:26:02 amBecause as a rule it's better to repeat something someone already knows than to fail to mention something they don't.1.6mm isn't a universal norm anymore, especially for two layer boards. I just ordered a bunch of 4 layer boards, and the default for them was 1.2mm from JLCPCB. That's a bit thin for my uses, so I upped it to 1.6, but 1.6mm is a pretty thick board these days. I think it added 2 days to the turnaround, so 1.2mm would have been a little quicker and I would have gone with that if I didn't need something that can be manhandled.

author: Rerouter
author_rank: Super Contributor
timestamp: September 17, 2018, 08:24:24 am
content: On previous boards, I have just has a T shape routed in the board edge. Dropped in a 4mm nut in the top of the T. Solder it to the board and left the down stroje of the T for the screw to come throug. If I can find the design files I'll try and upload a render of what I am talking about. Made for dirt cheap mounting hardware.Just have to be aware the routing bit of choice at fabs will be 2-3.2mm in diameter. So for inside corners I made my edge cuts dig in a bit deeper at those corners so they could fabricate something that the nut would friction fit in.

author: VEGETA
author_rank: Super Contributor
timestamp: September 17, 2018, 10:41:46 am
content: Quote from: Rerouter on September 17, 2018, 08:24:24 amI tried to imagine this but failed miserably.Do you mean the nut sits inside the T pointing towards the end of the board? meaning, if screw is attached to it then it would be perpendicular to the back panel?then you would need to attach the screw to that panel or even if it is perpendicular on the bottom part of the enclosure you would still need to attach it somehow which returns to the first problem.

author: sokoloff
author_rank: Super Contributor
timestamp: September 17, 2018, 11:03:11 am
content: Rerouter's idea is slick.Imagine you wanted to use a screw through the back panel to fix the board front to rear. Near the back of the PCB, create an east-west slot (along a line from side-slot to side-slot on the enclosure). This slot will hold the nut vertically. Now, create a north-south slot from the back edge of the PCB to the slot you created above and a little beyond (towards the front of the device). This will allow the screw to come through the back panel, engage the nut in the east-west slot (fixing the PCB mechanically), and then a little extra space so you can have the thread come fully through the nut and have a little space for full engagement and to allow you to buy screws with slight variance in length during production.

author: Rerouter
author_rank: Super Contributor
timestamp: September 17, 2018, 11:32:41 am
content: I was not able to find the design files for the final version, but this should give you an idea on what I meant.Later on i set it back 1.5mm away from the pcb edge, leaving a 3mm gap for the screw so the board did the supporting, not just the solder,

author: VEGETA
author_rank: Super Contributor
timestamp: September 17, 2018, 12:09:53 pm
content: nice idea!However, how should I attach it to the back panel?I don't want to make anything visible from the outside, thus I need something neat from the inside without making holes in back panel.One idea is to have a solder pad on back panel which gets soldered to this nut, but I think you already rejected this idea.

author: Rerouter
author_rank: Super Contributor
timestamp: September 17, 2018, 12:26:42 pm
content: Well now your just making things hardMy first suggestion would just be countersunk holes and live with flush, but visible.Be aware the case will have 4 countersunk holes per end that hold the case togetherThe other is much more crafty. use a folded spring battery terminal on the edge of the PCB, it can take up 1.5mm of slack,But seriously, you have no connectors on the top or bottom??

author: VEGETA
author_rank: Super Contributor
timestamp: September 17, 2018, 12:38:59 pm
content: Quote from: Rerouter on September 17, 2018, 12:26:42 pmTop or bottom what? the PCB? it is through hole components.As for front panel, it is gonna be drilled to fit a panel meter and input plugs and possibly an on\off switch.As for back panel, I will fix the heatsink on it. Maybe use the provided screw holes to fix the heatsink and back panel together and also with enclosure as a whole. Or drill 2 holes for the heatsink (but then the original screw holes will be unable to be used.).BTW, can I use nylon\plastic screws to fix the heatsink to this aluminum enclosure? the mosfets are in an isolated package but if one item is not isolated then it will be shorted to the whole enclosure. I wonder if there is anything to isolate the metal\ss screws or any form of screws that are isolated but still withstand heat. this is important.the mosfets will be fixed to the heatsink by cutting a rectangular hole on the back panel to let the cabling reach them... so basically all our suggestions are not valid in this case simply because I forgot to mention how heatsink will be mounted.but it is a nice addition to my knowledge for the next project. looks like more questions emerged in this post.

author: PartialDischarge
author_rank: Super Contributor
timestamp: September 19, 2018, 12:04:55 pm
content: I'm having trouble importing a dxf file into kicad to create a board outlineIn inkscape I design a rectangle as follows,Then after converting the object into a path, exporting to dxf and loading into kicad gives me this,DFX file is attached, corners are not imported. Is it because kicad will only import straight lines?

author: Rerouter
author_rank: Super Contributor
timestamp: September 19, 2018, 12:09:08 pm
content: V5 currently only supports segment based DXF, if you have splines, which your arcs are probably encoded as it gets unhappy,Picking an older DXF specification is the fix.

author: PartialDischarge
author_rank: Super Contributor
timestamp: September 19, 2018, 01:52:41 pm
content: The thing is, it is not trivial to close two lines with an arc in kicad, it seems to be very picky about where the lines cross. In 3d view then it gives error messages about it...

author: Clear as mud
author_rank: Regular Contributor
timestamp: September 19, 2018, 04:03:38 pm
content: Quote from: MasterTech on September 19, 2018, 01:52:41 pmIt was easy in the July 2013 version (the one that for more than two years was the most widely available version for Windows). I haven't worked with KiCAD in three years or so, but I used to make edge cuts with arcs at the corners all the time, and I don't remember if I did anything special to make the ends exactly line up. I think as long as they got close that was fine. Either that or there was some easy way to make them line up.Now that I'm thinking about it, I think what I usually did was work in "snap to grid" mode and set my grid at an acceptable size, then create a 1/4 circle snapped to the grid at the ends at each corner of the board, then join the 1/4 circles with lines.

author: PartialDischarge
author_rank: Super Contributor
timestamp: September 19, 2018, 04:49:34 pm
content: Quote from: Clear as mud on September 19, 2018, 04:03:38 pmThat was it, I was using a grid too fine, and the start and endpoints of each segment have to be 'exactly' the same

author: VEGETA
author_rank: Super Contributor
timestamp: September 22, 2018, 07:32:55 pm
content: I think I am settled on this one:https://www.aliexpress.com/item/YGS-005-88-38-120mm-WxH-L-anodized-aluminum-small-aluminium-extruded-project-electronic-enclosure-pcb/32826456213.htmlI will choose 82mm to be the board width and 100mm to be the length, as heatsink will be mounted outside. I will try using freecad or something similar to create the outline then import it to kicad since this is the easiest way.I could draw it inside kicad but no way I can verify if it is correct or not, or can I?

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: September 22, 2018, 08:47:56 pm
content: Of course you can, click on the line and look at the properties, use the relative coordinates, or the measure tool.In the 10 days since you first asked, you still haven't tried it in KiCad? It would take a few seconds to draw the outline...

author: VEGETA
author_rank: Super Contributor
timestamp: September 22, 2018, 11:02:08 pm
content: Quote from: donotdespisethesnake on September 22, 2018, 08:47:56 pmI drew a rectangle and yes it worked with me but I didn't know such a tool exist. In the coming days I will begin to do the PCB, as I decided the enclosure.

author: VEGETA
author_rank: Super Contributor
timestamp: November 03, 2018, 07:15:36 pm
content: After changing the panel meter, I needed a taller enclosure... then I found this:https://www.aliexpress.com/item/Plastic-Electronic-Project-Box-Enclosure-Instrument-Shell-Case-DIY-130x170x55MM/32869861591.htmlAs you can see, the problem is that they don't specify the drawing for this thing! I don't know where the holes will be! So I guess the only solution is to get them then measure stuff to determine it.... after that make the PCBs.The other solution is this:https://www.aliexpress.com/item/1pc-Aluminum-Enclosure-Case-Silver-DIY-Electronic-Project-PCB-Instrument-Box-Mayitr-100x100x50mm/32818002759.htmlHere no measurement to be taken except for the board itself. I guess making it something like 95x80mm is gonna be enough, right?I think going for the 2nd option is better overall. What do you think?

author: VEGETA
author_rank: Super Contributor
timestamp: November 03, 2018, 08:09:26 pm
content: latest version PCB is in attachments.I didn't start the layout yet.