Switching between grids. How would you solve this problem?

Hello!
I have the following problem, and I’m sure many other designers may have it as well.
I’m working in metric units, but it happens almost daily that I have to use a non-metric connector. Most of the time 1.27mm pitch. However, when routing lines between pins, the manual routing tool puts the traces on the grid (most of the time 0.25mm). NB: I would never route like this, it’s just an example of the trace which is routed on the grid.

Screenshot from 2021-03-08 13-55-25

By the way, I’m using 5.99 on Ubuntu 10.10

As you can see, I have tried to place the origine on the device anchor, exactly in the middle. So I thought that setting the 0 here and then changing the grid would set me into a local 0.127mm grid. It doesn’t, as you can see in the following picture. The new 0.127 mm grid has the right pitch (you can notice that the space between 2 pads is exactly 10 grids). But the grid does not coincide with the new origin.

How do you solve that kind of problem?
The ideal solution would be that my local grid coincides with the origin I want to set.
What I can do:

  1. Set the grid to 0.005mm (so that it’s a multiple of 0.635, which allows me to draw a trace exactly at the center.
  2. Use an excel sheet, calculate all the coordinates, and place small exactly at the center of 2 pads, then connect with the router. Once the position is defined, the router does it well.
  3. Set the connector position at a common multiple of both grids. Not easy for 0.635 and 0.25.

Other suggestions?

You are trying to use an origin which is used for exporting files. Use the Grid Origin instead. (Place -> Grid Origin, which is also in the right hand toolbar in v5.1.) It’s also in the Grid Settings dialog.

1 Like

Hello!
It works! Thanks!
Again, 10 minutes after my question. It took me more to write the question (screenshots, etc) than to get the reply.

I normally use (127mm, 127mm) as some reference location on the PCB. It can be a corner, but it can also be the center of a mouning hole, pin1 of some important connector, or even just a fiducial and then draw the PCB around it. The goal is to have a common reference for both metric and that other grid. Then I place all THT connectors on a 2.54mm grid. I do this for matrix board compatibily and it makes it easier to make modifications if needed. Outline of the PCB and mounting holes are preferably placed on a whole mm grid, and I also lend towards even values. Unless of course it has to fit in some pre-existing cabinet with mandated hole pattern.

Then make sure this is selected:
Pcbnew / Preferences / Preferences / PCB Editor / Editing Options / Magnetic pads / Snap to Pads: When creating tracks This lets you easily start and end a track on a pad that is not on a grid point.

That was easy, now comes the most difficult part.
Be warned.

You write:

And the answer is …
Ignore it.

It is just not relevant in most components which have an imperial grid. On top of that, your tracks do not stay where you put them, because the interactive router pushes them around a bit every time you are routing another track. The important part is that you set up your design rules properly, so clearances are adequate.

Do you have any rational reason why such tracks should be right in the middle between pads?

There are a lot of metric components these days on a 0.5mm or even 0.4mm or smaller grid. If you want to route tracks between that, tough luck.
Some time ago I routed a TQFP-48 with a 0.5mm pitch between the pins, and it was rotated 45 degree for easier breakout on the pins on a 2 layer PCB. That was a bit annoying, because KiCad wants to break-out tracks horizontally and vertically and with a 0.5mm pitch I’m not sure if there will be any soldermask left between the pads, and even parts of the tracks near the pads may become exposed copper when the PCB is made in some random chinese cheap fab, and therefore any extra clearance reduces the risk of solder bridges and therefore improves solderability.

With such coarse components with a 1.27mm pitch there is plenty of room for solder mask between the pads, and when your tracks are covered by solder mask it really does not matter at all whether your track is exactly in the middle between two pads or not.

As I wrote before, I tend to put mounting holes and PCB outline on a whole mm grid, and those non-metric components on a 2.54mm grid, but all else is moot. If you insist on wanting the tracks smack in the middle between the pads, then one way to do so is to use a non-metric grid that fits the routing around that connector and use a metric grid for other parts of the PCB. KiCad even has shortcut keys defined to switch between pre-defined grids quickly. Another way is to first measure the distance between two of the connector pads, and then set up the design rules so that the current track width plus two clearances is just slightly smaller then the room available. (“Slightly smaller” to leave some room for rounding errors, even a few micrometers is enough. KiCad works internally with 32bit integers on a nanometer grid (So max PCB from around +2meter to -2meter)).

Hello!

Do you have any rational reason why such tracks should be right in the middle between pads?

I have a few rules in order to improve the defect ratio:

  • Never put a via under a component if you can put it outside
  • Never pull a trace between 2 pads if there is another route
  • In any other case (if there is no other solution), stay as far as possible from the pads.

This latter reason tells me that the best solution between 2 pads is to pull the trace exactly between 2 pads.

and therefore any extra clearance reduces the risk of solder bridges

Yes, that’s a good reason to stay as far as possible from pads, and the optimal solution is the middle line.

  • For large BGA (e.g. FPGAs), never put 2 traces between pads if you can have only one.
  • Last reason: it looks simply better.

By the way, thanks for the hint: alt-1, alt-2 for switching between grids is really handy. For those who may wonder: right click the grid button on the left, and choose grid properties (you can’t miss it, it’s the only option on this right-click menu). And you can configure the grids corresponding to alt-1 and alt-2.

This is a very valid rule for automated assembly. A via that is placed in a pad sucks up most of the (fixed amount) of solder from the solder stencil, which leads to unreliable soldering.

As long as your tracks are covered by solder mask (An there is plenty of room for that with 1.27mm pitch connectors) This is just not important at all. This may be an old habit left over from home etching without a soldermask, or from a PCB manufacturer with unreliable soldermasks. Normally production quality of solder masks is good enough to just ignore / unlearn this rule.

KiCad has lots of shotcut keys that lets you do all kind of things quickly. It may be well worth it to spend some effort in reading through the list of shortcut keys in … / Preferences / Preferences / Hotkeys and trying some out, and make notes of the shotcuts that are useful to you. There are 400+ Hotkeys, and about half of them do not even have any key assigned by default.

1 Like

Hello!

This is a very valid rule for automated assembly. A via that is placed in a pad sucks up most of the (fixed amount) of solder from the solder stencil, which leads to unreliable soldering.

I’m talking about vias under a component, but not in a pad. And beside this, the vias can be covered with soldermask, so there isn’t any difference with tracks.
Anyway, these may be old rules, but just in case, if you have a Japanes customer one of these days, my advice is that you observe these rules.

By the way, I initiated this thread, but my problem is solved. Now I know how to setup a local grid which is “synchronous” with the current component I’m taking care of. And this can also be used for chips with a pitch of 0.95 like some SOTs.

The be far most important thing we should do: Choose components with Metric grids whenever we can. Use 2 mm or 2.5 mm grid connectors when there is a choice.
This is not only relevant for footprints, use metric components everywhere, it makes everything much simpler.

Do not fall into the pitfall of using a fine grid to place the footprints themself. This can become a nightmare to adjust offsets for routing such footprints. It is possible to do so but just keeping track of which offset you use for which footprint is no fun, and neither is changing offsets for each footprint.

Also beware of where you grab a footprint when you want to place it on a grid. There are magnet points for each pad, but also for the center of the footprint, so make sure you have the right magnet point. This is often a reason for footprints not lining up even when placed on a grid.

I would also like to see a feature that automatically sets the track width to the same size as the narrowest dimension of the pad of which the track is being started from. In other words, click to create a track from a smd pad that is 0.5mm wide, and the track is automatically set at 0.5mm width itself.

Why would you want 0.5mm wide tracks from an SMD pad?
0.5mm is very wide for copper tracks. Such a track can handle well over an ampere.

KiCad does not have a built-in option to set track width depending on pad, but you can (And should!) set up net classes and design rules to something that fits your PCB.

As a work around to get close to what you need, you can use KiCad’s built in function to continue a track with the same with as the with of the track you start from with:

But it only works with tracks, not with pads.
So make a bunch of tracks:

  1. Press X to start a track. Draw a small track segment.
  2. Hover over it and press e for Edit.
  3. Set it’s width to what you want, & confirm.
  4. Right Mouse button, and create an array of those tracks. (Make sure the pitch is right), and you have more then you need (deleting is easy).
  5. Copy or block move those segments to a footprint of your choice.

In KiCad you do not have to draw tracks one-by-one.
I once did an experiment in using block copy & duplicate functions as much as I could to make a schematic and PCB, and it worked quite well. A track segment can only belong to a single net, but if it is moved to another net, then it just changes it’s identity to that net.
I made good use of that in:

I also used it for a PCB that was back-imported from Gerbview.
If you then have a schematic and footprints and place a footprint on the back-imported tracks, then all the connected copper gets the name of the nets connected to your footprint. This way I caught 4 or 5 errors I made in reverse-engineering the schematic, because the netlist disagreed with the copper from the PCB.

Hello!

Do not fall into the pitfall of using a fine grid to place the footprints themself.

That’s precisely why I was asking this question. Usually (when possible), I set the connectors positions in whole millimeters, align most components on a 1mm grid. But I had that problem for non-metric items. So I work almost constantly with a grid of 0.25, and as I use non-metric components, I set the grid to half of the component pitch for drawing traces between 2. I was mentioning 0.127, but most of the time I use 0.635.

By the way, talking of the magnet points, is there a way to make the value not selectable? Usually I write the value inside of the resistor for instance, because it’s better when inserting (the value is inside, therefore there is no way to miss it or take the next in case the string is between 2). But when I want to move the part, I often move the value. The trick is to select a pad and then when selecting move, it select the whole resistor. Where do you guys put the value strings on a PCB?

I hide F.SilkS, B.SilkS, F.Fab and B.Fab when i do most of the layout. This way i also don’t select text when i select the component. F.CrtYd gives enough information for placing resistors.
And there is the option to hide footprint text in Layer Manager -> Items -> Footprint Text Front on the right side.

Earlier this thread you wrote you use KiCad-nightly V5.99.
It has a lot of new features, and one of them is the “Selection filter” in the lower right corner of Pcbnew, just under the “Appearance Manager” (which was “Layers Manager” in KiCad V5.)
image

In KiCad V5 (and earlier) you get used to it. After some time you get experience in where you can select a footprint. Clicking on a graphic item (including courtyard boundary) usually works quite well, especially if you do it on black background, so no copper tracks get selected instead. Zones are tuned off during most of the layout.
And also turning a bunch of layers off as Johannespfister wrote is necessary to keep some overview.

Hello!

Ok, I didn’t notice the selection filter yet. So this means that I can select what can and cannot be selected by the mouse? But then what should I deselect?

In fact, I found a workaround. The value is apparently in F.fab. So if I disable the F.fab layer, I can’t select it. But then if I don’t want to select the value, what should I deselect in the selection filter?

Another question: I tried to play with it, and if I deselect “all items”, all the items disappear except the locked items. Isn’t it weird? The locked items only are selectable? If they are locked, it’s the last thing I want to be selectable.

Now proceeding in order, I want of course footprints to be selectable, then tracks, pads, zones
text, vias to be selectable

Remaining is dimensions, which I don’t care about, graphics (is it the logos, for example?),
rule areas, none of them seems to correspond to values.
I have also tried to re enable F.fab and unselect other items, but when I hover the value and press M, it moves.

Could you tell me how to disable value move using the selection filter?

The “All items” and the “Locked items” are a sort of header / general options for the selection filters and this may have been clearer if there was some background color difference or a horizontal line to separate them.

The values are part of “Text”. Just keep on clicking until you find something that works.

There are also three tabs in the “Appearance Manager”. You can set the visibility of just the values (probably regardless on what layer they are) with:

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