What’s the best way to lay out a sine wave in metal in KiCad (application: inductive position sensing)?
I can create a lot of straight tracks; I can plot arcs; I can use the new splines. I can dial the error down as far as I want, but that will obviously generate a lot of elements and all of the attendant problems that go along with that.
Which one is likely to give me the best results when I have to generate Gerbers for JLCPCB?
With really complex geometries it might be easiest to draw the geometry in some other program that suits you best, export it as vector graphics file, then import that into KiCad through File->Import->Graphics.
It will be imported as graphical shape. You can choose to assign a net to this shape, or convert it to tracks or zones depending on your specific needs.
Inductive position sensing? TU Graz has a nice video about it:
CAUTION: There is a lot of “woo” around these things. You can use all manner of patterns and layouts to get ever more accuracy at the expense of vastly more complication. There are a lot of PhD theses about this stuff.
In addition, there is also a lot of weirdness in the layouts that results from using two layers (these things are heavily targeted at automotive) which causes a lot of imbalance because the separation between copper is 1.6mm or so. If you are willing to use 4 layers then your separation is only 0.2mm and a 6 layer board would only be 0.1mm and the layout is a lot less problematic.
Thank you!
This vidoe (only started to watch it) is most helpful. It also answered (the unasked) question about the sinusoidal tracks that puzzled me most.
I’m in the middle of developing a multi channel, multi protocol positional interface. And a sin/cos-interface is on the list to (IC-haus).
BTW: You can order 0.4 mm double sided PCBs. JLCPCB offers them at a small additional cost. 0.6 mm (IIRC) at no extra cost. Yes, still more than 0.1 mm.
That coil generator is for generic round inductors or chokes. It does not generate sinusoidal tracks such as needed for this type of sensors.
When scripting, sinusoids can be approximated with line segments, but you need quite a lot of line segments to keep deviations small. (the video above claims a resolution of around 0.1 degree, but that needs a proper design). 30 years ago I used a mechanical CAD program that had an option to generate curves on the basis of bi-arcs. Bi-arcs are wonderful, because (as their name implies) the output is arc segments, and these are compatible with many tools. From KiCad, to G-Code. Maybe KiCad also has some support for bezier curves (on import, no GUI to create them). Having a KiCad plugin to generate Bi-Arc curved based sinusoidals would be great, but developing such a plugin is quite involved. There is also quite a lot of math involved with bi-arcs.
Gosh, I completely forgot about the Renesas IC’s and design software I posted 4 years ago.
Edit / Oops, three months old, I should not have bumped it.
Where you get you Curve from doesn’t - many option’s as I’m sure you know.
I didn’t have any simple Curve’s hanging around so, I created Two simple one’s two ways: (LibreOffice and Inkscape). Yes, I do have Audio curves but they’re loaded with zillions of data points and will work but, I’m lazy so, not using them here.
Having the curve (SVG) available, I loaded into Kicad’s PCB. No problem.
Then, I loaded them into GerbView and Exported to PCB then, opened it in Kicad’s as usual…
Bingo…
ADDED:
Not shown in video:
Select the Imported Curve (if the Group Checkbox was checked when imported then, select it and Ungroup it so you can inspect each segment and/or get info. Scheenshot shows getting Inductance for the full Curve)
I am perfectly capable of writing Python code to generate whatever I need. Generating the sine is not terribly difficult whether I have to use line segments, quadratic beziers, cubic bezier, bi-arc, whatever.
What I still don’t immediately understand is how things are going to map to Gerbers and what the loss of precision will be after the mapping. There is no point in using a sophisticated bezier curve if the Gerber mapping is just going to be a bunch of line segments adding approximation error–I might as well generate the segments myself so I know what the error is (which is what I eventually did).
Line segments and arcs are gerber primitives so have the resolution of your Gerber format (down to the KiCad resolution of 1nm). Beziers in KiCad (which are all internally cubic) export as many small line segments, with an accuracy, I think, of about 5 microns.
Most likely any numerical inaccuracy down in the single-digit microns will be outweighed by manufacturing tolerances.
The only way to be 100% sure you can accept the Gerber outputs is to generate them and have a look yourself in a viewer (KiCad has one, there are others).
Extract from The Gerber X2 / X3 reference from Ucamco:
4.7.2.2 Valid Arcs
Mathematically, the distance from the center to the start point must be exactly equal to the distance to the end point. However, a Gerber file has a finite resolution. It is therefore generally not possible to position the center point exactly so that both distances – radii - are indeed exactly equal. Furthermore, …
The Gerber X2/X3 reference document is freely downloadable from the Ucamco website, and it has quite a lot of text about resolution, tolerances and similar.
Resolution of Gerbers can be set in: PCB Editor / File / Fabrication Outputs / Gerber / Gerber Options / Coordinate format, and the default is 4.6, unit mm.
Gerber files are also human readable ASCII (or whatever it’s called these days). I had a short peek into an F_Cu layer and most coordinates apperently don’t have a decimal dot, but end with lots of zero’s. Resolution appears to have 6 decimal places, so that is nanometer, same as KiCad’s native format. I have not put in the time to completely verify this.
I guess the first limitation you bump into is the actual manufacturing. PCB manufacturing machines have a finite resolution, and FR4 also deforms during curing.