How to define a custom trench in the PCB between different layers?

Blind/buried or normal vias that give you the freedom during layout. If you do it in the footprint then you will need to change the footprint if you decide you want other layers which is unnecessary extra work.

Unless i completely misunderstood your showcase

that is a possible solution but building the footprint exactly as needed for your design is for sure less flexible, but will solve the problem with a very little effort to be reached/implemented. ATM it can already be done tricking pcbnew, but it could be easy added allowing footprint editor to work on internal layers…
Moreover you could add a semi-manual pad stack editor creating i.e. pads with different sizes on different layers… adding new features with a little cost.

The thing is if such a hack is added then it needs to be supported in future and might get in the way for the more powerful solution (see the use of hidden power input pins as an example how this can go very wrong).

I am not in a position to make this decision but i would not be surprised if the core team will want to keep their options open until they have a design idea for the fully featured final implementation.

why do you call the ability to create footprints with pad on inner layers a hack?
It reminds me the issue raised with the option to have EdgeCuts on footprints, that luckily now are allowed on kicad v6.

1 Like

Hack might have been a poor choice of a word on my end.

What i intended to convey is that we should keep in mind that some fast solutions might negatively impact a more generic solution that we might want to have in KiCad sometime in the future.

So if we write a proposal then it might make sense to also include the ideal fully generic option such that the devs can take it into account for their planning.


Thank you for your suggestion.
When editing the footprint file in the text editor, which line I should edit? For example, just the one I highlighted like in the image below?

@ compuser:
When you want to edit KiCad files with a text editor, use the documentation of file formats to learn how they work:

Fully agree. Having good descriptions of wanted behavior is a very important part of software development.

Just recently there was a way to simply copy one layer to another or swap them, and it included all layers, though you could not copy a graphics layer to a copper layer. Now this dialog seems to be severely simplified, and only copper layers can be swapped.

Searching some more cause I thought I may have missed something. and I stumbled into (and experimented a bit with) **Pcbnew / Edit / Edit track & Graphics properties". As an experiment I set “scope” to “Footprint graphic items” and for “action” choose to set the “Layer” to “Edge.Cuts”. And KiCad V5.1.5 does it.

You can also apply filters.
My next test was to take 2 footprints of DIP packages, and place them into Pcbnew. Then hover over them and press [Ctrl + e] to edit them in the Footprint editor. On both I drew a little rectangle on the “Dwgs.User” layer. It looks like:

Then again back to **Edit Text and Graphic Properties" in an attempt to move the rectangle from U101 from Dwgs.User to Edge.Cuts, with these settings:

And it works as expected. The rectangle in U101 turns yellow, while the rectangle in U102 stays white. Tuning layers on/off in the Layers Manager confirms the rectangle is now on the Edge.Cuts layer.

For Compuser101 it seems a step in the right direction, Stuff on Edge.Cuts goes all through the PCB. For milling features to a certain depth, you want to use an exclusive layer for that. Any of the “User” layers can be used I think. Just make sure that this custom milling is all that is on that layer when you make Gerbers.

@Compuser101 Also, if this works for your board manufacturer, don’t forget that milling holes in the boards (well… milling into any material) can’t have 90° corners. So when contacting your vendor to find out how to document this process to them, find out the minimum and nominal drill diameters that they would use, and include the radiuses in your drawing. (Try to keep to their nominal diameter/radius as much as you can instead of going for the minimum diameter/radius everywhere.)


I should clarify the board house normally builds a PCB with cores and prepeg layers that they adhere together, with these style boards before gluing certain parts together they can run them through extra milling / drilling / plating processes to customize 1 layer from the rest, at a cost

So for your design you could have it so layers 1-3 have a slot, and 4 is solid with plated pads. it costs extra for the extra steps, but it should be cheaper than trying to pull of controlled depth milling, while also allowing you to have the pads for the components in the slot if you wish.

For them its the same as making blind and buried vias.

you need to edit pad’s layer(s), not the layer of the footprint…
here a kicad file format

4.6.12 - Description of a module (footprint)
Here is an example:
(module R3 (layer top_side.Cu) (tedit 4E4C0E65) (tstamp 5127A136)
(at 66.04 33.3502)
(descr “Resitance 3 pas”)
(tags R)
(path /5127A011)
(autoplace_cost180 10)
(fp_text reference R1 (at 0 0.127) (layer F.SilkS) hide
(effects (font (size 1.397 1.27) (thickness 0.2032)))
(fp_text value 330K (at 0 0.127) (layer F.SilkS)
(effects (font (size 1.397 1.27) (thickness 0.2032)))
(fp_line (start -3.81 0) (end -3.302 0) (layer F.SilkS) (width 0.2032))
(fp_line (start 3.81 0) (end 3.302 0) (layer F.SilkS) (width 0.2032))
(fp_line (start 3.302 0) (end 3.302 -1.016) (layer F.SilkS) (width 0.2032))
(fp_line (start 3.302 -1.016) (end -3.302 -1.016) (layer F.SilkS) (width 0.2032))
(fp_line (start -3.302 -1.016) (end -3.302 1.016) (layer F.SilkS) (width 0.2032))
(fp_line (start -3.302 1.016) (end 3.302 1.016) (layer F.SilkS) (width 0.2032))
(fp_line (start 3.302 1.016) (end 3.302 0) (layer F.SilkS) (width 0.2032))
(fp_line (start -3.302 -0.508) (end -2.794 -1.016) (layer F.SilkS) (width 0.2032))
(pad 1 thru_hole circle (at -3.81 0) (size 1.397 1.397) (drill 0.812799)
(layers *.Cu *.Mask F.SilkS)
(net 1 /SIGNAL)
(pad 2 thru_hole circle (at 3.81 0) (size 1.397 1.397) (drill 0.812799)
(layers *.Cu *.Mask F.SilkS)
(net 2 GND)
(model discret/resistor.wrl
(at (xyz 0 0 0))
(scale (xyz 0.3 0.3 0.3))
(rotate (xyz 0 0 0))
A module has:
• a reference
• a layer (Front or Back layer)
• a last edition time stamp (for user info)
• a time stamp from the schematic
• a position.
Its description includes:
• Text (at least reference and value)
• Graphic outlines
• Pads (with pad type, pad layers, pad size and position, net)
• A link to a 3D model, if exists, for the 3D viewer.

It took me a few days to get around to reading the datasheet. Rather than discuss the features of KiCad, I’d like to talk about the application.

The sensor, with a trace under the device, will detect the magnetic field caused by current through the trace. Depending on the current direction, you will get a voltage out. Is this your intent? Do you plan to detect an external magnetic field?

Note that this is not a linear device. There are only 2 states so if there is no current, it may just give you noise (rapid switching) on the output. You may want to bleed a small current through the sense trace to bias the device to a quiescent state.

I would recommend a large Gnd plane around and on the layer under the sensor to keep other circulating currents from being sensed. If the device is on L4, have L3 under the device be Gnd. Similarly, consider a steel shield over the circuit if this is near a motor.

It is still unclear why you need the trench under the device. The FR4 material isn’t magnetic!
Have I missed something in the datasheet?

My application is very specific and in order to understand it fully, you would need advanced knowledge in micromagnetic sensors, superparamagnetic particles detection and biosensors. This pcb is part of a research project which may involve novel discovery and I do not wish to explain the mode of operation further. But iabarry, I will note that your supposition of the mode of operation is correct, however my intent is not to detect current with this device, the current trace will be used to improve the characteristics of the sensors.
I just wanted to find how to define components sinked into the pcb in Kicad as I have explained before, I gave up on the “trench” idea.

You may be overthinking this whole thing.

Why not simply glue your detector to whatever you want to detect (some tube?) and be done with it. It is a prototype, not a mass produced commercial thing (yet).

Some materials are hard to glue to. I have had success with wrapping thin yarn around objects and then gluing the strands of yarn together.
Prototyping with small electronic parts is relatively easy by soldering solid “enameled” wires to them. I use 0.2mm wire quite a lot for this.

1 Like

Compuser101 - ok. There lots of questions posted to the list which come from students and folks who just don’t understand enough about the problem or the devices. When you said you were going to use the bare die, I didn’t know if you really understood the implications. It sounds like you are up to the task!

Regarding the circuit, years ago I worked on a piezoresistive pressure sensor which became a baro altimeter for aircraft. There were lots of unusual steps in wafer fab. The wafer was polished to have VERY parallel front and back surfaces. Then we patterned the boron nitride onto p-channel silicon wafers and “toasted” them. The back side of the wafer was also coated with a pattern to allow us to etch the wafer to provide a VERY thin area directly under the bridge resistors. 2 resistors were radial, 2 tangential. External circuitry did PWM closed loop. The PWM gives you pressure. We could measure 1ft of alt change on the ground with good accuracy.

If you are simply counting flux changes of a rotating field, the sensor will work well directly. Other wise you can have a loop around the bridge to rebalance it. If you wish to discuss anything further, feel free to contact me off-list.

Everything is more complicated than the casual observer thinks :smiley:
Good luck!

Sorry for the late reply.
Thank you very much for your detailed explanation. It has proved insightful.
In the meantime, I changed manufacturers two times and have finally come to a finalized design.
I have decided to ditch the NPTH (trench) that I intended to be above the sensor entirely so I can keep the current trace. Further fabrication processes will involve growing microfluidic channels on the backside of the PCB (were also the sensors are located). The current trace will be used just to provide and AC excitation field on the hard axis of the sensor.

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