Pcbnew chap12 JA
ModEdit - Creating and Editing Modules
ModEdit overview
ModEdit is used for editing and creating PCB modules. This includes:
- Adding and removing pads.
- Changing pad properties (shape, layer), for individual pads or for all pads in a module.
- Adding and editing graphic elements (contours, text).
- Editing fields (value, reference, etc.).
- Editing the associated documentation (description, keywords).
Module elements
A module is the physical representation (footprint) of the part to be inserted in the PCB and it must be linked to the relative component in your schematic. Each module includes three different elements:
- The pads.
- Graphical contours and text.
- Fields.
In addition, a number of other parameters must be correctly defined if the auto-placement function will be used. The same holds for the generation of auto-insertion files.
Pads
Two pad properties are important:
- Geometry (shape, layers, drill holes).
- The pad number, which is constituted by up to four alphanumeric characters. Thus, the following are all valid pad numbers: 1, 45 and 9999, but also AA56 and ANOD. The pad number must be identical to that of the corresponding pin number in the schematic, because it defines the matching pin and pad numbers that Pcbnew links pins and pads with.
Contours
Graphical contours are used to draw the physical shape of the module. Several different types of contour are available: lines, circles, arcs, and text. Contours have no electrical significance, they are simply graphical aids.
Fields
These are text elements associated with a module. Two are obligatory and always present: the reference field and the value field. These are automatically read and updated by Pcbnew when a netlist is read during the loading of modules into your board. The reference is replaced by the appropriate schematic reference (U1, IC3, etc.). The value is replaced by the value of the corresponding part in the schematic (47K, 74LS02, etc.). Other fields can be added and these will behave like graphical text.
Starting ModEdit and selecting a module to edit
ModEdit can be started in two ways:
- Directly via the [[Image:]] icon from the main toolbar of Pcbnew. This allows creation or modification of a module in the library.
- Double-clicking a module will launch the 'Module Properties' menu, which offers a 'Go to Module Editor' button. If this option is used, the module from the board will be loaded into the editor, for modification or for saving.
Module Editor Toolbars
Calling ModEdit will launch a new window that looks like this.
Edit toolbar
This toolbar contains tools for:
|
The specific functions are the following:
[[Image:]] | No tool. |
[[Image:]] | Add pads. |
[[Image:]] | Draw line segments and polygons. |
[[Image:]] | Draw circles. |
[[Image:]] | Draw circular arcs. |
[[Image:]] | Add graphical text (fields are not managed by this tool). |
[[Image:]] | Position the module anchor. |
[[Image:]] | Delete elements. |
[[Image:]] | Grid origin. (grid offset). Useful for placement of pads.
The grid origin can be put on a given location (the first pad to place), and after the grid size can be set to the pad pitch. Placing pads is therefore very easy |
Display toolbar
[[Image:]] | These tools manage the display options in ModEdit |
---|
These options are active when the button is pressed:
[[Image:]] | Display the grid. |
[[Image:]] | Display polar coordinates. |
[[Image:]] | Use units of mm (update: now mm/inches are toggled via two buttons). |
[[Image:]] | Crosshair cursor. |
[[Image:]] | Display pad in outline mode. |
[[Image:]] | Display text in outline mode. |
[[Image:]] | Display contours in outline mode. |
Context Menus
The right mouse button calls up menus that depend upon the element beneath the cursor.
[[Image:]] | The context menu for editing module parameters. |
[[Image:]] | The context menu for editing pads. |
[[Image:]] | The context menu for editing graphic elements. |
Module properties dialog
This dialog can be launched when the cursor is over a module by clicking on the right mouse button and then selecting 'Edit Module'.
The dialog can be used to define the main module parameters.
Creating a new module
A new module can be created via the button [[Image:]]. The name of the new module will be requested. This will be the name by which the module will be identified in the library.
This text also serves as the module reference, which is ultimately replaced by the real reference (U1, IC3...).
The new module will require:
- Contours (and possibly graphic text).
- Pads.
- A value (hidden text that is replaced by the true value when used).
Alternative method:
When a new module is similar to an existing module in a library or a circuit board, an alternative and quicker method of creating the new module is as follows:
- Load the similar module ([[Image:]], [[Image:]], or [[Image:]])
- Modify the reference field in order to generate a new identifier (name).
- Edit and save the new module.
Adding and editing pads
Once a module has been created, pads can be added, deleted or modified. Modification of pads can be local, affecting only the pad under the cursor, or global, affecting all pads of the module.
Adding pads
Select the [[Image:]] icon from the right hand toolbar. Pads can be added by clicking in the desired position with the left mouse button. Pad properties are predefined in the pad properties menu.
Do not forget to enter the pad number.
Setting pad properties
This can be done in three different ways:
- Selecting the [[Image:]] icon from the horizontal toolbar.
- Clicking on an existing pad and selecting 'Edit Pad'. The pad's settings can then be edited.
- Clicking on an existing pad and selecting 'Export Pad Settings'. In this case, the geometrical properties of the selected pad will become the default pad properties.
In the first two cases, the following dialog window will be displayed:
Care should be taken to define correctly the layers to which the pad will belong. In particular, although copper layers are easy to define, the management of non-copper layers (solder mask, solder pads...) is equally important for circuit manufacture and documentation.
The Pad Type selector triggers an automatic selection of layers that is generally sufficient.
Rectangular pads
For SMD modules of the VQFP/PQFP type which have rectangular pads on all four sides (both horizontal and vertical) it is recommended to use just one shape (for example, a horizontal rectangle) and to place it with different orientations (0 for horizontal and 90 degrees for vertical). Global resizing of pads can then be done in a single operation.
Rotate pads
Rotations of -90 or -180 are only required for trapezoidal pads used in microwave modules.
Not plated through hole pads
- Pads can be defined as Not Plated Through Hole pads (NPTH pads).
- These pads must be defined on one or all copper layers (obviously, the hole exists on all copper layers).
- This requirement allows you to define specific clearance parameters ( for instance clearance for a screw).
- When the pad hole size is the same as the pad size, for a round or oval pad, this pad is NOT plotted on copper layers in GERBER files.
- These pads are used for mechanical purposes, therefore no pad name or net name is allowed. A connection to a net is not possible.
Pads not on copper layers
These are unusual pads. This option can be used to create fiducials or masks on technical layers.
Offset Parameter
Pad 3 has an offset Y = 15 mils.
Delta Parameter (trapezoidal pads)
Pad 1 has its parameter Delta X = 10 mils
Setting clearance for solder mask and solder paste mask layers
Setting clearance can be made at 3 levels:
- Global level.
- Footprint level.
- Pad level.
Pcbnew uses to calculate clearance:
- Pad settings.If null
- Footprint settings.If null
- Global settings.
Remarks
The solder mask pad shape is usually bigger than the pad itself. So the clearance value is positive. The solder paste mask pad shape is usually smaller than the pad itself. So the clearance value is negative.
Solder paste mask parameters
For solder paste mask there are two parameters:
- A fixed value.
- A percentage of the pad size.
The real value is the sum of these 2 values.
Footprint level settings
Pad level settings:
Fields Properties
There are at least two fields: reference and value.
Their parameters (attribute, size, width) must be updated. You can access the dialog box from the pop-up menu, by double clicking on the champ, or by the footprint properties dialog box.
Automatic placement of a module
If the user wishes to exploit the the full capabilities of the auto-placement functions, it is necessary to define the allowed orientations of the module (Module Properties dialog).
Usually, rotation of 180 degrees is permitted for resistors, non-polarized capacitors and other symmetrical elements.
Some modules (small transistors, for example) are often permitted to rotate by +/- 90 or 180 degrees. By default, a new module will have its rotation permissions set to zero. This can be adjusted according to the following rule:
A value of 0 makes rotation impossible, 10 allows it completely, and any intermediate value represents a limited rotation. For example, a resistor might have a permission of 10 to rotate 180 degrees (unrestrained) and a permission of 5 for a +/- 90 degree rotation (allowed, but discouraged).
Attributes
The attributes window is the following:
- Normal is the standard attribute.
- Normal+Insert indicates that the module must appear in the automatic insertion file (for automatic insertion machines). This attribute is most useful for surface mount components (SMDs).
- Virtual indicates that a component is directly formed by the circuit board. Examples would be edge connectors or inductors created by a particular track shape (as sometimes seen in microwave modules).
Documenting modules in a library
It is strongly recommended to document newly created modules, in order to facilitate their rapid and accurate retrieval. Who is able to recall the multiple pin-out variants of a TO92 module?
The Module Properties dialog offers a simple and yet powerful mean for documentation generation.
This menu allows:
- The entry of a comment line (description).
- Multiple keywords.
The comment line is displayed with the component list in CVPCB and in the module selection menus in PCBNEW. The keywords can be used to restrict searches to those parts possessing the given keywords.
Thus, while using the load module command (icon [[Image:]] in the right-hand toolbar in Pcbnew), it is possible to type the text =TO220 into the dialog box to have PCBNEW display a list of the modules possessing the keyword TO220.
3-dimensional visualisation
A module may have been associated with a file containing a three-dimensional representation of itself. In order to associate such a file with a module, select the 3D Settings tab. The options panel is the following:
The data information should be provided:
- The file containing the 3D representation (created by the 3D modeler wings3d, in vrml format, via the export to vrml command).The default path is kicad/modules/package3d. In the example, the file name is discret/to_220horiz.wrl, using the default path)
- The x, y and z scales.
- The offset with respect to the anchor point of the module (usually zero).
- The initial rotation in degrees about each axis (usually zero).
Setting scale allows:
- To use the same 3D file for footprints which have similar shapes but different sizes (resistors, capacitors, SMD components...)
- For small (or very large) packages, a better use of the wings3D grid.
If such a file has been specified, it is possible to view the component in 3D.
The 3D model will automatically appear in the 3D representation of the printed circuit board.
Saving a module into the active library
The save command (modification of the file of the active library) is activated by the [[Image:]] button.
If a module of the same name exists (an older version), it will be overwritten. Because it is important to be able to have confidence in the library modules, it is worth double-checking the module for errors before saving.
Before saving, it is also recommended to change the reference or value of the module to be equal to the library name of the module.
Saving a module to the board
If the edited footprint comes from the current board, the button [[Image:]] will update this footprint on the board.