The electrical type is used by the electrical rule check (ERC) to determine if you made an obvious mistake. ERC is really quite limited. All it does is read all electrical types of pins connected to a particular net and check their combination against the error matrix.
Example: by default connecting two output pins together will result in an error. (Makes sense as one output can be high and one can be low resulting in a short circuit between the positive supply and ground.)
To make ERC as useful as possible one needs to take care which electrical types to assign to pins.
The datasheet of your component is a good start for this.
- Pins through which your component is supplied (vcc, gnd, vss, …) are power inputs.
- Digital and analog input pins are inputs.
- Digital and analog output pins are output (For digital pins, use this only if the pin is push and pull capable or has an internal pull-up or pull-down network.)
- GPIO pins, bus pins (sda of i2c) , … are bidirectional
- Pins for passive devices and pins that are always only connected to other passive devices are passive
- Pins that are intended to supply power to other devices use power output (output pin of a dc/dc converter, a voltage regulator, …)
- Not connected is used for all pins of the footprint that have no function in the symbol. (You can make them invisible to reduce clutter but don’t stack them. Otherwise they will be connected with each other.)
- Open collector is used for open collector or open drain outputs (output pins that need an external pull up)
- Open emitter are used for open emitter or open source outputs (output pins that need an external pull down)
- Tri-state is used for output pins that have a high impedance state (high Z) Such pins have the following possible states.
- High -> low impedance connection to high signal voltage (in most cases the positive supply voltage)
- Low -> low impedance connection to low signal voltage (in most case GND)
- High Z -> no connection to anything. (high impedance state)
Connecting Multiple Output Pins
If you have multiple output pins or power output pins that need to be connected in parallel then you have a choice to make. Let ERC complain about connecting multiple power output pins or give only one of these pins the type output. (The other pins would get the type passive in the later case.)
Such a configuration benefits greatly from being stacked. (all pins on top of each other with all but one pin set to invisible. Make sure the visible pin is the one with the correct electrical type.) The reason being is that if they are not stacked then it would be possible to connect one of the pins marked as non output to something where ERC would otherwise complain. Stacking ensures that this can not happen.
Bug in older versions of kicad
The symbol editor does not like having different settings in a stack. Workaround: finish all settings of the pins while they are not stacked and move them on top of each other as the last step.
(If you open the pin properties of any stacked pin, all pins in the stack get changed by the editor.)
Invisible Power Input Pins
Another special case are invisible power input pins. They are global labels. This is how power symbols are implemented in kicad. Do not use invisble power input pins in any application other then power symbols. (They can be dangerous)
More details about power output/input
A pin is power input if it is a consumer of power. It is power output if it is the source for power. (outputs of a dc/dc converter, of a ldo, …)
The power flag is used to tell ERC that a pin that is not a power output is the source of power. This is needed if the supply is via a generic connector, or if a passive component is in series to the power supply (a fuse, the inductor of a filter, …)
The direction the current flows alone is not what determines if it is a power input. You also need to take into account the potential of the pin compared to the potential of its counterpart.
Now lets look at the pin with the more positive potential. It is power out iff the current flows out and power in otherwise.
For the more negative pin the current direction is exactly opposite. (The current flows out of the positive pin into the negative pin -> both are power output.)
It gets tricky if the power output side shares a common pin with the power input side. In such cases power input should take precedence. (As the whole circuit will not work if there is no external power provided to the common pin.)
Side note: The current directions mentioned above use the convention of “technical current direction”. In most materials electrons are the charge carriers. Sadly our mathematical models define them as having a negative charge. This means they move (on average) opposite to the technical current direction.
Further reading regarding power symbols: