Using KiCAD - RespiraWorks/Ventilator GitHub Wiki

Installing KiCAD

  1. Download and install KiCAD for Linux, Mac, and Windows here: https://www.kicad.org/download/
  2. Here's a useful playlist of KiCAD tutorials on youtube: https://www.youtube.com/watch?v=vaCVh2SAZY4&list=PL3bNyZYHcRSUhUXUt51W6nKvxx2ORvUQB

Recommended keyboard shortcuts

Configure your own if there's a set of shortcuts you're already familiar with and prefer, but these have worked very well for me.

Installation

  1. Download the *.hotkeys files from the KiCAD Library repo.
  2. Open the KiCAD schematic editor, go to Preferences→Preferences, choose Hotkeys on the left, press the Import button, and choose the eeschema.hotkeys file. Press OK.
  3. Open the KiCAD layout editor, go to Preferences→Preferences, choose Hotkeys on the left, press the Import button, and choose the pcbnew.hotkeys file. Press OK.

Use

You can see the full list from the Hotkeys section in Preferences, but these are the most important keys to know.
Both schematic and layout:
'W' starts a wire or trace
'X' moves an object (breaking any connections it may have), while 'G' drags an object or trace instead (attempting to keep its connections intact)
'C' shows properties of an object
'R' rotates, 'F' flips
'D' deletes
'Q' duplicates
'Shift-G' shows a prompt for moving an object by an exact amount
'Ctrl-F' shows a search
'T' places text
Schematic only:
'A' adds a part from the library - you can then immediately start typing to search
Layout only:
'A' summons a part by reference
'V' places a via
'S' and 'Shift-S' increment or decrement the trace size
'Space' changes trace orientation

Recommended plugins

  • KiBOM: Generates much better BOMs than the export scripts that come with KiCAD; place bom.ini in your project directory for a proven-good configuration which handles a lot of the subtleties correctly.
  • KiCAD action plugins: All plugins here are useful, but replicate_layout is the essential one for copying a layout between multiple identical copies of a schematic section.
  • Interactive HTML BOM: Generates a local HTML file which highlights part locations; very useful for debugging and/or soldering.

Directory setup

The library paths on the KiCAD project are currently set up so that they will work correctly when the "Ventilator" repository is checked out in the same directory as the "KiCAD-Library" repository. For example, my (Don's) GitHub folder contains "KiCAD-Library", "Ventilator", etc.

For 3D models to work correctly, after installing KiCAD open the footprint editor, go to Preferences->Configure Paths..., and in the "3D Search Paths" section add a new alias with the name "RespiraWorks". Set the path to the KiCad-Library\RespiraWorks.pretty\3d-models directory, inside wherever the local repositories are checked out.

Using KiCad with git

  • Where possible, try to limit each branch/PR to one feature or schematic page (unless you are doing integration).
  • Electrical engineers should follow the same branch-and-PR workflow as the rest of the organization. See: Git Basics
  • Branch naming should include your identifier (initials or username), the feature or issue you are working on, and some description. Examples: inceptionev/PCB-Rev-A-SysMonADC, smm_pcb_stepperdriver, dcs_issue735_addRTC
  • Check in only the files you are working on. KiCad will sometimes change and save files that you haven't touched updating dates or page counts on title blocks. Unless you are doing top level integration and connecting to those pages, don't include them in your commits. This will make rebasing much easier. In most cases this will only be the .sch file and the [ProjectName]-cache.lib file.
  • When your PR is ready for review, rebase the branch to master to make it easy to review just the changes vs. the most recent master.
  • When you PR is approved and ready for merging, if master has deviated, rebase again (thanks!) before merging to keep the history clean.

Schematic conventions

Net Naming

  • Try to avoid non-alphanumeric characters, except for dashes.
  • Names should be mixed-case, with sections separated by dashes. Examples: Aux-LED-Enable, Mix-Tank-Pressure
  • Inverted signal nets should be named with a leading 'n' on the "action" word. Examples: nCS, FPGA-nRst, 3V3-nEnable
  • Prefix positive power rails with PP, and negative with NN. Examples: PP3V3_ANALOG, PP5V, NN15V
  • When placing net names onto the ends of unterminated wires in the schematic, rotate the net name so that its connection point captures the wire endpoint so that it is clear that the wire has been connected.

Wiring

  • Note: these are guidelines, not hard-and-fast rules. If the symbols don't lend themselves well to these conventions, use your judgement and strike a balance between a clean schematic and convention.
  • Avoid cross junctions where 4 wires come in to a junction point at right angles. Instead, offset one of the wires so that they don't contact at a cross. This provides more visual contrast against wires that cross but don't connect.
  • No ground symbols pointing up. If needed, turn a corner with the wire to point them sideways, or better, downward.
  • Top to bottom: positive to negative.
    • Where possible, more positive wires should be above less positive ones on the schematic sheet.
    • Examples: 5V supply should be visually above the 3V3 supply. The GND nets in the supply design should be at the bottom of the circuit, while the positive rail is at the top. For connectors where pin 1 is GND, rotate and/or mirror it so that pin 1 is at the bottom visually.
  • Left to right: input to output
    • Example: for a level translator rotate and/or mirror the symbol so that inputs go towards the left of the page and outputs to the right. For a hierarchical sheet symbol, put input ports on the left and output ports on the right.

Connectors

  • If not otherwise constrained, the GND on a connector should be pin 1. If there is an obvious other reason for deviating this (say, for example, to match it 1-to-1 with the device that it connects to, feel free to deviate). Pro tip: to keep with the top to bottom: positive to negative convention, connectors can be rotated and mirrored to place pin 1 at the bottom.
  • To keep the schematic clean, connectors should go on the schematic page lowest in the hierarchy where all the signals are present. For example, the connector for a stepper driver to connect to the stepper can go on the stepper driver page itself. For the blower connector, which needs to take power from one sub-sheet and control signals from another, it can go on the sheet where both those hierarchical sheet symbols are present.
  • Use the Conn_x symbols (for example, 'Conn_01x03') instead of Conn_xmale or Connx_female for visual clarity. The 'Value' field should be a short few-word description of the connector's purpose. If it's a part of a group of connectors (connecting to a daughterboard, for example), the Value field instead can be hidden and separate text added to describe the connector group.

Component Parameter Fields

  • Do Not Populate
    • For parts that you want to specify as Do Not Populate, add a parameter with the name DNP and the value DNP, and make it visible.
    • If the part has a recommended value should the option be taken in the future to populate it, fill out the Value parameter. Same with the other parameters if needed.
  • Non-generic parts:
    • Schematic symbols in the library with unambiguous part numbers (an IC with one package option, for example, rather than a generic BJT or resistor) should have these fields created and filled in the library symbol itself.
    • Manufacturer information is kept in the custom "Manufacturer" and "Manufacturer PN" fields: these will be exported to the BOM with the 'bom.ini' KiBOM settings in the repository. You can add these fields to a part in the schematic editor from the part properties dialog ('C' key), or you can assign these in bulk in Tools->Edit Symbol Fields... For generic parts like resistors and caps, final part selection will be done at BOM clean up time. If, for example, you need a specific resistor with a special power rating and accuracy for a current sense, then you should treat this as a specific part, and fill out the Manufacturer and Manufacturer PN fields.
    • Optional but recommended: Datasheet and Supplier link fields.
  • Resistors:
    • Required: Value, in ohms, units not required, make the parameter visible. Examples: 10, 4.7k, 0.1
    • Required: Library selection for footprint size: Example: RespiraWorks_Std:R_0603_1608Metric
    • Optional: Tolerance, Examples: 1%, 5%, 0.1% If not specified, we will assume 1% at BOM clean up time.
    • Optional: Power, Either decimal or fractional are ok. Examples: 1W, 0.25W, 1/4W
  • Capacitors:
    • Required: Value, with units, and make the parameter visible. Examples: 100nF, 2.2uF
    • Required: Voltage, and make the parameter visible. Examples: 10V, 25V
    • Optional: Dielectric, Examples: X5R, Y5V, NP0
    • Optional: Tolerance, Example: 10%

PCB Conventions

Footprint Defaults

Before creating or editing any footprints, open the footprint editor, go to Preferences->Preferences..., select 'Default Values' at the left (underneath 'Footprint Editor'), and enter these values in the 'Default properties for new graphic items' table:

  • Silk layers: 0.12 mm line thickness, 0.7 mm text width, 0.7 mm text height
  • Courtyards: 0.05 mm line thickness
  • Other layers: 0.05 mm line thickness

Sizes and Limits

These are based on the minimums from the 'basic services' of SeeedStudio and JLCPCB.

  • Trace size/spacing (min.): 0.18 mm/7 mils
  • Via size (min.): 0.3 mm/12 mil hole diameter, 0.6 mm/24 mil pad diameter
  • Copper-to-board-edge distance (min).: 0.4 mm/16 mils
  • Minimum Annular Ring: 0.152 mm / 6 mils
  • Polygon-to-Other-Copper-Net Clearance: 0.254 mm / 10 mils