← Back to team overview

kicad-developers team mailing list archive

Tweaks to curves for high voltage PCBs

 

Hi, a friend of mine who is one of the engineers working on the HAWC Gamma-ray Observatory ( http://www.hawc-observatory.org <http://www.hawc-observatory.org/> ) is designing a fairly high voltage (~5kV) circuit board to drive photomultiplier tubes that will be in an addition of over 1000 additional Cherenkov radiation detector tanks. He asked me if there was a way to create rounded pads in KiCad.  Not oval pads, which always have a maximum possible rounding radius, but beveled pads, which you can specify the radius of the corner rounding of.  I of course told them just use oval pads, but he actually needs beveled pads.  Rounded corners are vital for HV pcb layout, as any sharp angles will locally increase the electric field and an arc over is that much more likely.   

So what's the problem? Oval pads fit the bill perfectly.  There is a subtle problem, however: certain parts, such as 2225 size 6kV ceramic capacitors, require their entire termination be solidly soldered down, and these pads are very long and narrow.  Using oval pads that are the correct length will cause the corners of the termination to have no copper under them, which I guess isn't preferred.  Lengthening the oval pad enough to prevent this (which ultimately amounts to taking the length and width of a rectangular pad size you need, and making an oval pad with the same width, but width+length in length) creates significant over(under?)hang of the pad, and minimizing exposed bits of metal without solder mask slathered on top is highly desirable when those exposed bits of metal will have 5000V of potential on them.

Here is a screenshot illustrating what I mean, with the yellow box representing the desired termination soldering area for one end of a capacitor:
http://metacollin.com/screens/upshot_SGxPxMCJ.png <http://metacollin.com/screens/upshot_SGxPxMCJ.png>

Width could be increased to mitigate this in normal circumstances, but they need all the creepage they can get, so that really isn't an option.  

Also, for large circular copper pours, there are flat angles that are very visible.  If you have a perfectly circular edge cut, and fill a ground plane, you get a triacontadigon (32 sided regular polygon).  This is both in the rendering and the gerbers.  In fact, I have one of my own boards in hand that is circular that does, in fact, have visible angles around the edge in the ground pour, though to be frank I never noticed it until this was pointed out.

With that in mind, I've mostly finished a minor and probably most-niche branch of KiCad that has the following changes:

1. Increases the segment count used for arcs, circles, curves, text, everything (as well as the output geometry of the various plotting engines) to 2 or 4 times what it currently is, as decided by setting either KICAD_SMOOTH_CURVES or KICAD_SMOOTHER_CURVES.  These default to off, but the option is there.  The nice thing is that this is all applied to how geometry is generated, so, for example, refilling a pour and saving the .kicad_pcb file, then opening it in a stock version of KiCad will yield the same smoother geometry for some situations.  I think the gerbers would not though.  Regardless, there aren't any interoperability problems.

Also, I would argue that the last time it was appropriate to approximate a circle with 32 sides was around 1996, as my Nintendo 64 has several games for it (a soccer/football game, for example) that draw large circles (white paint on the field) and they are also 32 sides.  It's now 2016, I think we can manage maybe a *few* more sides than my 20 year old console with 4MB of ram and a 65MHz graphics coprocessor.     


2. Add a new pad type, beveled rectangle.  I would have preferred to not make it an entire 5th pad type, but I could not alter anything about the rectangular pad type without breaking compatibility with older KiCad versions.  Geometrically, a beveled pad is two rectangles drawn in a cross "+" formation, each one narrower/shorter in one dimension (x for one, y for the other) by the bevel radius.  This creates 4 square cutouts at the corner.  Then the GetRoundCorners function which handily already exists in KiCad finds the correct locations to draw the rounded corners.  4 circles are drawn, one at each corner, with a radius equal to the bevel radius.  This allows any desired amount of beveling to be applied to a pad.  

3. The needed GUI modifications for the above are added.

4. I have only added this 5th pad geometry to the gerber plotter, and am not sure if it is possible to also output them to the kicad_pcb files in a non-backwards compatibility destroying way. 


I mainly wrote this for my friend (took an afternoon, nothing huge) and their need is fairly niche.  They're using my modified build for this one project, and that's all.  I have no plans of completing or polishing it further at present, but I thought I'd ask if there was any interest in my changes (or some set of them) being used in the main branch, or reworked somehow to be fit for the main branch.  If so, I can push the code to launch pad and develop it further.  

Given the compatibility-breaking nature of the changes that aren't just a bunch of #defines added in the right spots, I am guessing there is no interest :).  In fact, I am 95% sure there is no interest, mainly because even I, the author, have a hard time justifying the changes in light of such a small and niche benefit.  It seems to me that nearly all of the time, one can manage just fine with oval pads.  But I wrote the code, so I figured I'd mention it on the mailing list just in case.  

The main point was to start getting more familiar with KiCad's innards, as well as help out a friend, and that goal was achieved, so it's all good :). 


"Violence is the last refuge of the incompetent." - Isaac Asimov


Follow ups