How to route sine/cosine patterns for an angle sensor?

image

This is the type of routing required for an IPS22xx angle sensor - how can you best do this in KiCAD? Does it work best as a footprint? Or?

Any pointers? TIA.

I think the footprint is the only way to go. Your situation looks similar to KiCon 2019 talk here where a speaker on 11:29 says that for KiCad 5.1 the footprint is the only way to use curvy traces.

1 Like

What sort of accuracy do you need?
This somehow reminds me of the Zettlex encoders. These have absurd resolutions, but the PCB tracks do not look very sinusoidal at all.

KiCad is not very good in drawing complex shapes. It’s perfectly fine for making PCB outlines with a few cutouts and rounded corners, but for something like this another approach is probably better fit.

One way is to design a single curve (one of either the red or green “half-sines”) in an external CAD program, export it as a .DXF file and then import it in the footprint editor (First create a footprint for it) with Footprint Editor / File / Import outlines from DXF file …. Once you have the segments of the curve in the footprint editor, you can add a THT pad (I would use the via location) and then select both the pad and the graphics, then a right click and select "Create Pad from selected Shapes**. The pad becomes the attachment point for tracks. Such a shape can have only one pad (attachment point). Connecting to the the other side of the curved line probably does not work well. You may have to disable DRC for that ( Pcbnew / Route / Interactive Router Settings / Mode / Highlight Collisions and this enables: Options / Allow DRC Violations in the same dialog box.)
Using a bunch of such footprints and placing them in a circular array is also quite cumbersome in KiCad.

Another approach is to use scripting in Pcbnew.
I do not have experience with this myself, but you can find a pretty neat example for this in: Python Scripting Example: Studio Clock

It is possible to use arc segments in KiCad V5.1.x on copper, but KiCad just has no method to draw these directly as tracks on copper. You can first draw an arc on a graphical layer, and then edit it’s properties to put it on a copper layer, but it still remains a graphical object, which is treated differently from a track.

Personally I like Bi-arcs, because they go through their control points (unlike bezier curves) and this makes curve-fitting a lot easier, and you can usually fit them nicely to curves with relatively few control points. Bi-Arc’s also fit good with Gerber files, G-code and other stuff that supports arc’s. But I digress. Support for arcs as real copper tracks is coming (slowly) in KiCad-nightly V5.99, but at the moment it is probably simpler to use straight line segment approximations, and then just use more line segments. It also does not matter much for a script. Once you can draw a sine mapped around circle, then it’s just a loop variable for how big your steps are.

1 Like

I am not sure if @HiGreg is still working on KiCommand, but he was doing pretty cool stuff for adding curves and text in a programmatical way:

Have you noticed that Renesas has some “Inductive Coil Design Tool Software” for designing the PCB sine curves?

Source:
https://www.renesas.com/us/en/products/sensor-products/position-sensors/ips2200-inductive-position-sensor-high-speed-motor-commutation

KiCad-nightly V5.99 has an importer for altium files, but it’s hidden in some way because it’s not ready yet. However, if that software can generate Gerber files, then you can back-import them into a regular KiCad project with KiCad’s own gerber viewer (GerbView).

1 Like

I haven’tworked on KiCommand (or kicad, for that matter) in a while, but am open to suggestions. If you chose to use KiCommand, probably would want to approximate sine cures with better. Bezier curves are implemented natively in KiCAD.

Edit: this might be useful.

This may be helpful…

Say you want to draw some Math-Based curves, such as Sin/Cos. You can generate them with various tools (spreadsheets, Mathlab…etc). But, perhaps a simplier approach is to use a Graphics program that contains Tweak-able math curves.

If you know the curve details (period/amplitude…etc) then, tweaking is simplified.

I used EZdraw (very old version) - it contains many useful tools, example of list below.

Simply drop the desired curve into the drawing area and tweak it by either dragging handles or by using the input fields (example below)

Save as PNG, use Kicad’s Bitmap Tool to export it as .mod (for PCBnew). Then, either Edit the Footprint in the Footprint Editor or, place the footprint and edit the placed footprint (change to desired layer).

Example and Images below shows:
• List of EZdraw’s curves
• Selected/placed curve with it’s Info panel (Rotated it for fun)
• Kicad’s Bitmap Tool with curve loaded and exported as .mod
• The footprint editor with curve loaded and layer changed to B.Cu
• Result on PCB in the 3D-viewer

Showing original .mod and edited .mod

1 Like

I’m not sure if this suggestion is much different that @BlackCoffee s method but:

Cannot the pattern brought in as a “logo” type pattern?

Just a thought, I’ve never brought in a logo type clad but I’ve seen posts showing them.

It’s even better. They will actually “design” the optimized artwork for me if I give a few key parameters. They output Altium or Gerber format.
Looks like that is the best way in this case - the other options may be useful in the more general case.
Thanks a lot, guys - I am impressed with the response here :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.