Kicad学习笔记2:符号库、封装库

常见术语

对于一个元器件的描述,主要包括利用spice语句所定义的物理模型(Simulation model)和代表元器件的元器件符号两种。此外,还有用于定义元器件输入输出的封装信息和用于制版的脚注。
电路元器件符号的基本组成包括符号图形、封装、脚注。

bipolar双目障碍的
双极型晶体管的器件符号都是由qnpn和qpnp两种基本元器件符号派生出来的。

Spice基本语法20140709

1 2
diode 二极管
polyline 折线
inductor 电感器
Isource 驱动上拉电流
Isink 驱动下拉电流
QNPN NPN型的三极管

QNPN应该是NPN型的三极管,在电路图中一般用Q表示各种管子,具体哪种要看具体电路图了

NPN型三极管是指由两块N型半导体中间夹着一块P型半导体所组成的三极管;也称为晶体三极管,可以说它是电子电路中最重要的器件。三极管是电子电路中最重要的器件,它最主要的功能是电流放大和开关作用,它可以把微弱的电信号变成一定强度的信号,当然这种转换仍然遵循能量守恒,它只是把电源的能量转换成信号的能量。

三极管顾名思义具有三个电极。二极管是由一个PN结构成的,而三极管由两个PN结构成,共用的一个电极成为三极管的基极(用字母B表示——B取自英文Base,基本的、基础的),其他的两个电极分别称为集电极(用字母C表示——C取自英文Collector,收集)和发射极(用字母E表示—— E取自英文Emitter,发射)。基区和发射区之间的结成为发射结,基区和集电区之间的结成为集电结。
PNP 和NPN型三极管,放大电路工作原理,类似水龙头?

符号库

KiCad Symbols

1 2
*.sp 网表文件
*.lib 原理图元件库文件
*.dcm 原理图元件库文档
sym-lib-table 符号库列表
*.kicad_sch 原理图文件
*.kicad_sym 符号库文件

demo

新建一个空的*.kicad_sch文件:

(kicad_sch (version 20230121) (generator eeschema)

  (uuid b56ee123-6559-4d97-a196-b4d8e5ac7e3c)

  (paper "A4")

  (lib_symbols
         
  )


  (sheet_instances
    (path "/" (page "1"))
  )
)

1.定义一个电阻

Resistance
首先在lib_symbols中定义一个符号:
定义前:

  (lib_symbols
         
  )

定义电阻后:

(lib_symbols
     (symbol "R_1" (pin_names (offset 0) hide) (in_bom yes) (on_board yes)
      (property "Reference" "R" (at 2.032 0 90)
        (effects (font (size 1.27 1.27)))
      )
      (property "Value" "R_1" (at 0 0 90)
        (effects (font (size 1.27 1.27)))
      )
      (property "Footprint" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)))
      )
      (property "Datasheet" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)))
      )
      (property "ki_keywords" "R DEV" (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "ki_description" "Resistance" (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (symbol "R_1_0_1"
        (rectangle (start -1.016 3.81) (end 1.016 -3.81)
          (stroke (width 0) (type default))
          (fill (type none))
        )
      )
      (symbol "R_1_1_1"
        (pin passive line (at 0 6.35 270) (length 2.54)
          (name "1" (effects (font (size 0.508 0.508))))
          (number "1" (effects (font (size 0.508 0.508))))
        )
        (pin passive line (at 0 -6.35 90) (length 2.54)
          (name "2" (effects (font (size 0.508 0.508))))
          (number "2" (effects (font (size 0.508 0.508))))
        )
      )
    )
    
  )

只在lib_symbols括号内添加符号定义,并不能在电路图中显示电阻,想要显示电阻还需要在lib_symbols括号的下面,添加对该电阻符号的引用:
添加引用后的电路原理图文件:

(kicad_sch (version 20230121) (generator eeschema)

  (uuid b56ee123-6559-4d97-a196-b4d8e5ac7e3c)

  (paper "A4")

  (lib_symbols
     (symbol "R_1" (pin_names (offset 0) hide) (in_bom yes) (on_board yes)
      (property "Reference" "R" (at 2.032 0 90)
        (effects (font (size 1.27 1.27)))
      )
      (property "Value" "R_1" (at 0 0 90)
        (effects (font (size 1.27 1.27)))
      )
      (property "Footprint" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)))
      )
      (property "Datasheet" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)))
      )
      (property "ki_keywords" "R DEV" (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "ki_description" "Resistance" (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (symbol "R_1_0_1"
        (rectangle (start -1.016 3.81) (end 1.016 -3.81)
          (stroke (width 0) (type default))
          (fill (type none))
        )
      )
      (symbol "R_1_1_1"
        (pin passive line (at 0 6.35 270) (length 2.54)
          (name "1" (effects (font (size 0.508 0.508))))
          (number "1" (effects (font (size 0.508 0.508))))
        )
        (pin passive line (at 0 -6.35 90) (length 2.54)
          (name "2" (effects (font (size 0.508 0.508))))
          (number "2" (effects (font (size 0.508 0.508))))
        )
      )
    )
    
  )

(symbol (lib_name "R_1") (lib_id "schematic_libspice:R") (at 129.54 52.07 0) (unit 1)
    (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
    (uuid 00000000-0000-0000-0000-000032cfc288)
    (property "Reference" "R3" (at 131.191 51.4755 0)
      (effects (font (size 1.27 1.27)) (justify left))
    )
    (property "Value" "22K" (at 131.191 53.2377 0)
      (effects (font (size 1.27 1.27)) (justify left))
    )
    (property "Footprint" "" (at 129.54 52.07 0)
      (effects (font (size 1.524 1.524)) hide)
    )
    (property "Datasheet" "" (at 129.54 52.07 0)
      (effects (font (size 1.524 1.524)) hide)
    )
    (pin "1" (uuid 60060ce6-2e33-460b-8c5d-c0482b8b6dd6))
    (pin "2" (uuid fafa3e44-a677-4f8b-9987-e9e904317bb9))
    (instances
      (project "pspice"
        (path "/a4349b77-fc13-4b06-b73d-e811f055a7b6"
          (reference "R3") (unit 1)
        )
      )
    )
  )
    
  (sheet_instances
    (path "/" (page "1"))
  )
)

该文件显示效果:
Kicad学习笔记2:符号库、封装库_第1张图片
passive line:

所谓有源电路和无源电路,在电路中是按照是否包含电源来划分的,有源电路就是包含电源的电路;无源电路就是不包含电源的电路。

角度:

gnd

定义gnd符号:

 (symbol "schematic_libspice:0" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes)
      (property "Reference" "#GND" (at 0 -2.54 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "Value" "0" (at 0 -1.778 0)
        (effects (font (size 1.27 1.27)))
      )
      (property "Footprint" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)))
      )
      (property "Datasheet" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)))
      )
      (symbol "0_0_1"
        (polyline
          (pts
            (xy -1.27 0)
            (xy 0 -1.27)
            (xy 1.27 0)
            (xy -1.27 0)
          )
          (stroke (width 0) (type default))
          (fill (type none))
        )
      )
      (symbol "0_1_1"
        (pin power_in line (at 0 0 0) (length 0) hide
          (name "0" (effects (font (size 1.016 1.016))))
          (number "1" (effects (font (size 1.016 1.016))))
        )
      )
    )

引用gnd

  (symbol (lib_id "schematic_libspice:0") (at 72.39 74.93 0) (unit 1)
    (in_bom yes) (on_board yes) (dnp no)
    (uuid 00000000-0000-0000-0000-000032cfc344)
    (property "Reference" "#GND01" (at 72.39 77.47 0)
      (effects (font (size 1.016 1.016)) hide)
    )
    (property "Value" "0" (at 72.39 76.708 0)
      (effects (font (size 1.016 1.016)))
    )
    (property "Footprint" "" (at 72.39 74.93 0)
      (effects (font (size 1.524 1.524)) hide)
    )
    (property "Datasheet" "" (at 72.39 74.93 0)
      (effects (font (size 1.524 1.524)) hide)
    )
    (pin "1" (uuid 5279db28-aeca-4fc9-b2dd-7ef276d13bfc))
    (instances
      (project "pspice"
        (path "/a4349b77-fc13-4b06-b73d-e811f055a7b6"
          (reference "#GND01") (unit 1)
        )
      )
    )
  )

效果:

Kicad学习笔记2:符号库、封装库_第2张图片

pwr flag

定义

(symbol "schematic_libspice:PWR_FLAG" (power) (pin_numbers hide) (pin_names (offset 0) hide) (in_bom yes) (on_board yes)
      (property "Reference" "#FLG" (at 0 1.905 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "Value" "PWR_FLAG" (at 0 3.81 0)
        (effects (font (size 1.016 1.016)))
      )
      (property "Footprint" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "Datasheet" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "ki_keywords" "Power Flag Symbol" (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "ki_description" "general power-flag symbol" (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (symbol "PWR_FLAG_0_0"
        (pin power_out line (at 0 0 90) (length 0)
          (name "pwr" (effects (font (size 1.27 1.27))))
          (number "1" (effects (font (size 1.27 1.27))))
        )
      )
      (symbol "PWR_FLAG_0_1"
        (polyline
          (pts
            (xy 0 0)
            (xy 0 1.27)
            (xy -1.016 1.905)
            (xy 0 2.54)
            (xy 1.016 1.905)
            (xy 0 1.27)
          )
          (stroke (width 0) (type default))
          (fill (type none))
        )
      )
    )
	

引用

  (symbol (lib_id "schematic_libspice:PWR_FLAG") (at 190.5 21.59 0) (unit 1)
    (in_bom yes) (on_board yes) (dnp no)
    (uuid 00000000-0000-0000-0000-0000592c404d)
    (property "Reference" "#FLG01" (at 190.5 19.685 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (property "Value" "${SIM.PARAMS}" (at 190.5 17.78 0)
      (effects (font (size 1.27 1.27)))
    )
    (property "Footprint" "" (at 190.5 21.59 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (property "Datasheet" "" (at 190.5 21.59 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (property "Sim.Enable" "0" (at 190.5 21.59 0)
      (effects (font (size 1.524 1.524)) hide)
    )
    (property "Sim.Device" "SPICE" (at 0 0 0)
      (effects (font (size 0 0)) hide)
    )
    (property "Sim.Params" "PWR_FLAG" (at 190.5 17.78 0)
      (effects (font (size 1.27 1.27)))
    )
    (property "Sim.Pins" "1=1" (at 0 0 0)
      (effects (font (size 0 0)) hide)
    )
    (pin "1" (uuid 543a559b-b06e-4e20-82fb-ab9348890dd8))
    (instances
      (project "pspice"
        (path "/a4349b77-fc13-4b06-b73d-e811f055a7b6"
          (reference "#FLG01") (unit 1)
        )
      )
    )
  )

效果图:

Kicad学习笔记2:符号库、封装库_第3张图片

电源

(symbol "schematic_libspice:+12V" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes)
      (property "Reference" "#PWR" (at 0 -3.81 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "Value" "+12V" (at 0 3.556 0)
        (effects (font (size 1.27 1.27)))
      )
      (property "Footprint" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "Datasheet" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "ki_keywords" "Power Flag Symbol" (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "ki_description" "power-flag symbol" (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (symbol "+12V_0_1"
        (polyline
          (pts
            (xy -0.762 1.27)
            (xy 0 2.54)
          )
          (stroke (width 0) (type default))
          (fill (type none))
        )
        (polyline
          (pts
            (xy 0 0)
            (xy 0 2.54)
          )
          (stroke (width 0) (type default))
          (fill (type none))
        )
        (polyline
          (pts
            (xy 0 2.54)
            (xy 0.762 1.27)
          )
          (stroke (width 0) (type default))
          (fill (type none))
        )
      )
      (symbol "+12V_1_1"
        (pin power_in line (at 0 0 90) (length 0) hide
          (name "+12V" (effects (font (size 1.27 1.27))))
          (number "1" (effects (font (size 1.27 1.27))))
        )
      )
    )

效果:
Kicad学习笔记2:符号库、封装库_第4张图片
power-in line

电源输入线

电容

(symbol "schematic_libspice:C" (pin_names (offset 0.254)) (in_bom yes) (on_board yes)
      (property "Reference" "C" (at 2.54 3.81 90)
        (effects (font (size 1.27 1.27)))
      )
      (property "Value" "C" (at 2.54 -3.81 90)
        (effects (font (size 1.27 1.27)))
      )
      (property "Footprint" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)))
      )
      (property "Datasheet" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)))
      )
      (symbol "C_0_1"
        (polyline
          (pts
            (xy -3.81 -1.27)
            (xy 3.81 -1.27)
          )
          (stroke (width 0) (type default))
          (fill (type none))
        )
        (polyline
          (pts
            (xy -3.81 1.27)
            (xy 3.81 1.27)
          )
          (stroke (width 0) (type default))
          (fill (type none))
        )
      )
      (symbol "C_1_1"
        (pin passive line (at 0 6.35 270) (length 5.08)
          (name "~" (effects (font (size 1.016 1.016))))
          (number "1" (effects (font (size 1.016 1.016))))
        )
        (pin passive line (at 0 -6.35 90) (length 5.08)
          (name "~" (effects (font (size 1.016 1.016))))
          (number "2" (effects (font (size 1.016 1.016))))
        )
      )
    )

引用该符号:

(symbol (lib_id "schematic_libspice:C") (at 179.07 72.39 0) (unit 1)
    (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
    (uuid 00000000-0000-0000-0000-00003e9d1ef8)
    (property "Reference" "C2" (at 183.515 71.7955 0)
      (effects (font (size 1.27 1.27)) (justify left))
    )
    (property "Value" "220pF" (at 183.515 73.5577 0)
      (effects (font (size 1.27 1.27)) (justify left))
    )
    (property "Footprint" "" (at 179.07 72.39 0)
      (effects (font (size 1.524 1.524)) hide)
    )
    (property "Datasheet" "" (at 179.07 72.39 0)
      (effects (font (size 1.524 1.524)) hide)
    )
    (pin "1" (uuid da53b0db-67cd-4ffc-8de8-6fec29c85424))
    (pin "2" (uuid b2dcde2e-7c76-4360-8ad4-07683f4e82d4))
    (instances
      (project "pspice"
        (path "/a4349b77-fc13-4b06-b73d-e811f055a7b6"
          (reference "C2") (unit 1)
        )
      )
    )
  )

效果图:
Kicad学习笔记2:符号库、封装库_第5张图片
电容单位
1法拉(F)= 1000毫法(mF)=1000000微法(μF)

1微法(μF)= 1000纳法(nF)= 1000000皮法(pF)

电容之间的换算公式:1F(法拉)=1000 mF(毫法),1mF(毫法)=1000 μF(微法),1μF(微法)=1000 nF(纳法copy),1nF(纳法)=1000 pF(皮法)。

1(F) = 1E3(mF) = 1E6(uF) = 1E9(nF) = 1E12(pF)这是完整的科学计数法换算式,都是三次方的关系,皮法和微法是常用的单位。

扩展资料:

一个电容器,如果带1库的电量时两级间的电势差是1伏,这个电容器的电容就是1法拉,即:C=Q/U 。

但电容的大小不是由Q(带电量)或U(电压)决定的,即电容的决定式为:C=εrS/4πkd 。其中,εr是相对介电常数,S为电容极板的正对面积,d为电容极板的距离,k则是静电力常量。

常见的平行板电容器,电容为C=εS/d(ε为极板间介质的介电常数,ε=εrε0,ε0=1/4πk,S为极板面积,d为极板间的距离)。

电感

定义

  (symbol "schematic_libspice:INDUCTOR" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes)
      (property "Reference" "L" (at 0 2.54 0)
        (effects (font (size 1.27 1.27)))
      )
      (property "Value" "INDUCTOR" (at 0 -1.27 0)
        (effects (font (size 1.27 1.27)))
      )
      (property "Footprint" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)))
      )
      (property "Datasheet" "" (at 0 0 0)
        (effects (font (size 1.27 1.27)))
      )
      (symbol "INDUCTOR_0_1"
        (arc (start -2.54 0) (mid -3.81 1.2645) (end -5.08 0)
          (stroke (width 0) (type default))
          (fill (type none))
        )
        (arc (start 0 0) (mid -1.27 1.2645) (end -2.54 0)
          (stroke (width 0) (type default))
          (fill (type none))
        )
        (arc (start 2.54 0) (mid 1.27 1.2645) (end 0 0)
          (stroke (width 0) (type default))
          (fill (type none))
        )
        (arc (start 5.08 0) (mid 3.81 1.2645) (end 2.54 0)
          (stroke (width 0) (type default))
          (fill (type none))
        )
      )
      (symbol "INDUCTOR_1_1"
        (pin input line (at -6.35 0 0) (length 1.27)
          (name "1" (effects (font (size 0.762 0.762))))
          (number "1" (effects (font (size 0.762 0.762))))
        )
        (pin input line (at 6.35 0 180) (length 1.27)
          (name "2" (effects (font (size 0.762 0.762))))
          (number "2" (effects (font (size 0.762 0.762))))
        )
      )
    )
	

引用:

 (symbol (lib_id "schematic_libspice:INDUCTOR") (at 215.9 38.1 0) (unit 1)
    (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
    (uuid 00000000-0000-0000-0000-00003e9d4a5d)
    (property "Reference" "L1" (at 215.9 34.1304 0)
      (effects (font (size 1.27 1.27)))
    )
    (property "Value" "100mH" (at 215.9 35.8926 0)
      (effects (font (size 1.27 1.27)))
    )
    (property "Footprint" "" (at 215.9 38.1 0)
      (effects (font (size 1.524 1.524)) hide)
    )
    (property "Datasheet" "" (at 215.9 38.1 0)
      (effects (font (size 1.524 1.524)) hide)
    )
    (pin "1" (uuid 87045877-3271-4d58-92ca-ad889dc6cca9))
    (pin "2" (uuid 54a4f219-cd84-413f-979c-e131c021d173))
    (instances
      (project "pspice"
        (path "/a4349b77-fc13-4b06-b73d-e811f055a7b6"
          (reference "L1") (unit 1)
        )
      )
    )
  )

效果:
Kicad学习笔记2:符号库、封装库_第6张图片

你可能感兴趣的:(kicad,学习,bash,开发语言)