📦 归档:唐磊输出的环路车检器 KiCad 工程统一移入 pcb/ 目录

This commit is contained in:
2026-08-21 18:18:38 +08:00
parent 1e33f0c73a
commit f8a3f726fc
14 changed files with 20 additions and 1 deletions
@@ -0,0 +1,258 @@
#!/usr/bin/env python3
"""Generate KiCad 7 schematic (.kicad_sch) for the loop vehicle detector."""
import re, uuid, os
BASE = "/root/.openclaw/workspace/loop-detector/loop-detector-kicad"
SYM = os.path.join(BASE, "loopdet.kicad_sym")
SCH = os.path.join(BASE, "loop-detector.kicad_sch")
def uid():
return str(uuid.uuid4())
# ---------- extract lib_symbols from .kicad_sym ----------
data = open(SYM, encoding="utf-8").read()
# only extract TOP-LEVEL (symbol "X" ...) blocks: track paren depth while scanning
sym_blocks = []
pat = re.compile(r'\(symbol "([^"]+)"')
# find all matches, then filter to depth-1 (inside kicad_symbol_lib only)
depth = 0
top_starts = []
for m in pat.finditer(data):
# compute depth at match start by counting parens before it
prefix = data[:m.start()]
d = prefix.count('(') - prefix.count(')')
if d == 1: # directly inside kicad_symbol_lib
top_starts.append(m.start())
for start in top_starts:
depth = 0
j = start
while j < len(data):
if data[j] == '(':
depth += 1
elif data[j] == ')':
depth -= 1
if depth == 0:
break
j += 1
sym_blocks.append(data[start:j+1])
# embedded symbol names must carry the library prefix (e.g. "loopdet:C") so that
# lib_id "loopdet:C" resolves to the embedded definition without hitting the table
import re as _re
def _prefix(sym_block):
return _re.sub(r'\(symbol "([^"]+)"', r'(symbol "loopdet:\1"', sym_block, count=1)
lib_symbols = "(lib_symbols\n" + "\n".join(" " + _prefix(b) for b in sym_blocks) + "\n)\n"
# ---------- components ----------
# (lib, ref, value, x, y, rot, ref_at, val_at)
COMPONENTS = [
("CONN2", "J1", "CONN_2P", 40, 130, 0, (40, 136), (40, 124)),
("TVS_BI", "TVS1", "TVS_BIDI", 62, 130, 0, (62, 136), (62, 124)),
("XFMR", "T1", "1:1", 90, 130, 0, (90, 138), (90, 120)),
("C", "C1", "100~470p", 107, 130, 90, (113, 136), (113, 124)),
("Q_NPN", "Q1", "S9018", 130, 130, 0, (126.5, 136),(126.5, 124)),
("R", "Rc", "2.2k", 138, 126.19,0, (134.5, 132),(134.5, 120)),
("R", "Rb1", "100k", 124.92,121.5,90, (131, 121.5),(131, 117)),
("R", "Rb2", "47k", 124.92,137.5,90, (131, 137.5),(131, 133)),
("R", "Re", "1k", 132.54,139.5,90, (138.5, 139.5),(138.5, 135)),
("C", "C2", "100p", 138, 135.5, 90, (144, 135.5),(144, 131)),
("C", "Cc2", "10p", 148, 126.19,0, (148, 132), (148, 120)),
("COMP", "U1", "LM393", 170, 130, 0, (170, 137), (170, 123)),
("R", "R3", "10k", 150, 124, 90, (156, 124), (156, 119.5)),
("R", "R4", "10k", 150, 138.5, 90, (156, 138.5),(156, 134)),
("MCU", "MCU1", "STM32F103C8", 215, 130, 0, (215, 143), (215, 117)),
("R", "R5", "1k", 245, 124.92,0, (245, 131), (245, 119)),
("OPTO", "U2", "PC817", 265, 124.92,0, (265, 131), (265, 119)),
("MOS_N", "Q2", "N-MOS", 300, 126.19,0, (296.5, 132),(296.5, 120)),
("RELAY_SPDT","K1", "SPDT 12V", 325, 122.38,0, (325, 130), (325, 116)),
("R", "R6", "1k", 245, 130, 0, (245, 136), (245, 124)),
("LED", "D2", "LED", 280, 130, 0, (280, 136), (280, 124)),
]
# ---------- wires ----------
WIRES = [
# A net: J1.p1 - TVS1.p1 - T1.p1
((37.46, 127.46), (82.38, 127.46)),
((59.46, 127.46), (59.46, 130)),
# B net: J1.p2 - TVS1.p2 - T1.p2
((37.46, 132.54), (82.38, 132.54)),
((64.54, 132.54), (64.54, 130)),
# T1 sec upper: p3 - C1.p1 - base input
((97.62, 127.46), (110, 127.46)),
((110, 127.46), (110, 130)),
((110, 130), (124.92, 130)),
# T1 sec lower: p4 - C1.p2 - GND
((97.62, 132.54), (107, 132.54)),
((107, 132.54), (107, 145)),
# VCC bus
((100, 115), (320, 115)),
((140.54, 126.19), (140.54, 115)),
((124.92, 118.96), (124.92, 115)),
((150, 121.46), (150, 115)),
((317.38, 119.84), (317.38, 115)),
# GND bus
((100, 145), (340, 145)),
((124.92, 140.04), (124.92, 145)),
((132.54, 142.04), (132.54, 145)),
((138, 138.04), (138, 145)),
((257.38, 127.46), (257.38, 145)),
((302.54, 130), (302.54, 145)),
((282.54, 130), (282.54, 145)),
# base net
((124.92, 124.04), (124.92, 134.96)),
# collector net
((132.54, 126.19), (145.46, 126.19)),
((138, 126.19), (138, 132.96)),
# emitter
((132.54, 133.81), (132.54, 136.96)),
# comp in+
((150.54, 126.19), (162.38, 126.19)),
((162.38, 126.19), (162.38, 127.46)),
# vref
((150, 126.54), (150, 135.96)),
((150, 132.54), (162.38, 132.54)),
# comp out -> PA0
((177.62, 130), (177.62, 124.92)),
((177.62, 124.92), (202.3, 124.92)),
# PA1 -> R5
((227.7, 124.92), (242.46, 124.92)),
# R5 -> OPTO.1
((247.54, 124.92), (257.38, 124.92)),
((257.38, 124.92), (257.38, 122.38)),
# OPTO.4 -> gate
((272.62, 122.38), (294.92, 122.38)),
((294.92, 122.38), (294.92, 126.19)),
# drain -> K1.A2
((302.54, 122.38), (317.38, 122.38)),
((317.38, 122.38), (317.38, 124.92)),
# PA2 -> R6
((227.7, 130), (242.46, 130)),
# R6 -> D2.A
((247.54, 130), (277.46, 130)),
]
# ---------- net labels ----------
LABELS = [
("VCC", (100, 115), 0),
("GND", (100, 145), 0),
("VCC", (227.7, 135.08), 0),
("GND", (202.3, 135.08), 0),
("COM", (332.62, 122.38), 0),
("NO", (332.62, 117.3), 0),
("NC", (332.62, 127.46), 0),
]
# ---------- texts ----------
TEXTS = [
("环路车检器原理图 — LC 振荡 + 频率计数方案(推荐①)", (20, 20), 3.5),
("信号链:环形线圈 → T1 匹配变压器 → 考毕兹振荡 → 比较器整形 → MCU 测频判车 → 光耦隔离 → 继电器输出", (20, 30), 1.5),
("接路面环形线圈(3~5匝,双绞屏蔽线 ≤20m)", (20, 108), 1.27),
("→ 道闸控制器 / PLC 输入", (340, 114), 1.27),
("【设计说明】", (20, 165), 1.5),
("1) 线圈经 T1 匹配变压器隔离耦合,抗地环路干扰;", (20, 173), 1.27),
("2) 谐振频率 f0 ≈ 1/(2π√(L·C1)),建议 20~150kHz(待现场验证);", (20, 181), 1.27),
("3) MCU 周期法测频(输入捕获),灵敏度阈值多档可调 + 回差防抖;", (20, 189), 1.27),
("4) 基准频率上电自学习 + 慢速跟踪,抗温漂(雨雪/昼夜温差);", (20, 197), 1.27),
("5) 输出经光耦 U2 隔离驱动继电器 K1,防浪涌反灌烧 MCU;", (20, 205), 1.27),
("6) 软件加看门狗;继电器粘连/掉线检测;", (20, 213), 1.27),
("7) 电源:VIN 12~24V → 防反接 + TVS → LDO 5V → LDO 3.3V(本页未画出);", (20, 221), 1.27),
("8) 相邻车道串扰:线圈间距 ≥1m,必要时交替频率;", (20, 229), 1.27),
("【关键参数(参考值,待现场验证)】", (240, 165), 1.5),
("C1: 100~470pF C2: 100pF", (240, 173), 1.27),
("Rb1: 100k Rb2: 47k", (240, 181), 1.27),
("Rc: 2.2k Re: 1k", (240, 189), 1.27),
("Q1: S9018/2N3904 Q2: N-MOS", (240, 197), 1.27),
("U1: LM393 比较器 U2: PC817 光耦", (240, 205), 1.27),
("K1: SPDT 12V/24V 继电器", (240, 213), 1.27),
("MCU: STM32F103/GD32F103", (240, 221), 1.27),
]
# ---------- build ----------
def fmt_xy(p):
return f"(xy {p[0]:g} {p[1]:g})"
parts = []
ROOT_UUID = uid()
parts.append("(kicad_sch")
parts.append(" (version 20230121)")
parts.append(' (generator eeschema)')
parts.append(f" (uuid {ROOT_UUID})")
parts.append(' (paper "A3")')
parts.append(" (title_block")
parts.append(' (title "Loop Vehicle Detector")')
parts.append(' (date "2026-08-21")')
parts.append(' (rev "1.0")')
parts.append(' (company "xde")')
parts.append(' (comment 1 "LC Oscillation + Frequency Counting")')
parts.append(" )")
parts.append("")
# lib_symbols (indent 2)
parts.append(lib_symbols.rstrip("\n"))
parts.append("")
# components
for lib, ref, value, x, y, rot, ref_at, val_at in COMPONENTS:
parts.append(" (symbol")
parts.append(f" (lib_id \"loopdet:{lib}\")")
parts.append(f" (at {x:g} {y:g} {rot})")
parts.append(" (unit 1)")
parts.append(" (in_bom yes)")
parts.append(" (on_board yes)")
parts.append(" (dnp no)")
parts.append(f" (uuid {uid()})")
parts.append(f" (property \"Reference\" \"{ref}\" (at {ref_at[0]:g} {ref_at[1]:g} 0) (effects (font (size 1.27 1.27)) (justify left)))")
parts.append(f" (property \"Value\" \"{value}\" (at {val_at[0]:g} {val_at[1]:g} 0) (effects (font (size 1.27 1.27)) (justify left)))")
parts.append(f" (property \"Footprint\" \"\" (at {x:g} {y:g} 0) (effects (font (size 1.27 1.27)) hide))")
parts.append(f" (property \"Datasheet\" \"\" (at {x:g} {y:g} 0) (effects (font (size 1.27 1.27)) hide))")
# pin uuids (number of pins depends on lib)
PINMAP = {
"R": ["1", "2"], "C": ["1", "2"], "TVS_BI": ["1", "2"], "LED": ["A", "K"],
"Q_NPN": ["B", "C", "E"], "MOS_N": ["G", "D", "S"],
"XFMR": ["1", "2", "3", "4"], "OPTO": ["1", "2", "4", "3"],
"COMP": ["+", "-", "OUT"],
"MCU": ["PA0", "GND", "PA1", "PA2", "VDD"],
"RELAY_SPDT": ["A1", "A2", "COM", "NO", "NC"],
"CONN2": ["1", "2"],
}
for pn in PINMAP[lib]:
parts.append(f" (pin \"{pn}\" (uuid {uid()}))")
parts.append(" (instances")
parts.append(" (project \"loop-detector\"")
parts.append(f" (path \"/{ROOT_UUID}\"")
parts.append(f" (reference \"{ref}\") (unit 1)")
parts.append(" )")
parts.append(" )")
parts.append(" )")
parts.append(" )")
parts.append("")
# wires
for p1, p2 in WIRES:
parts.append(" (wire")
parts.append(f" (pts {fmt_xy(p1)} {fmt_xy(p2)})")
parts.append(" (stroke (width 0) (type default))")
parts.append(f" (uuid {uid()})")
parts.append(" )")
parts.append("")
# net labels
for name, pos, ang in LABELS:
parts.append(" (label")
parts.append(f" \"{name}\" (at {pos[0]:g} {pos[1]:g} {ang})")
parts.append(" (effects (font (size 1.27 1.27)) (justify left bottom))")
parts.append(f" (uuid {uid()})")
parts.append(" )")
parts.append("")
# texts
for s, pos, size in TEXTS:
parts.append(" (text")
parts.append(f" \"{s}\" (at {pos[0]:g} {pos[1]:g} 0)")
parts.append(f" (effects (font (size {size:g} {size:g})))")
parts.append(f" (uuid {uid()})")
parts.append(" )")
parts.append("")
parts.append(" (sheet_instances")
parts.append(' (path "/" (page "1"))')
parts.append(" )")
parts.append(")")
out = "\n".join(parts) + "\n"
open(SCH, "w", encoding="utf-8").write(out)
print("wrote", SCH, len(out), "bytes")
Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

@@ -0,0 +1,83 @@
{
"board": {
"design_settings": {
"defaults": {
"apply_defaults_to_fp_fields": false,
"apply_defaults_to_new_footprints": false
}
}
},
"boards": [],
"cvpcb": {
"equivalence_files": []
},
"erc": {
"erc_exclusions": [],
"meta": {
"version": 0
}
},
"libraries": {
"pinned_footprint_libs": [],
"pinned_symbol_libs": []
},
"meta": {
"filename": "loop-detector.kicad_pro",
"version": 1
},
"net_settings": {
"classes": [
{
"bus_width": 12,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.25,
"via_diameter": 0.8,
"via_drill": 0.4,
"wire_width": 6
}
],
"meta": {
"version": 3
},
"net_colors": null,
"netclass_assignments": null,
"netclass_patterns": []
},
"pcbnew": {
"last_paths": {
"gencad": "",
"netlist": "",
"plot": "",
"pos": "",
"specctra_dsn": "",
"step": "",
"svg": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"page_layout_descr_file": ""
},
"sheets": [
[
"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"Root"
]
],
"text_variables": {}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,392 @@
(kicad_symbol_lib
(version 20220914)
(generator "xde")
(symbol "R"
(pin_numbers hide) (pin_names (offset 0))
(in_bom yes)
(on_board yes)
(property "Reference" "R" (at 0 2.54 0) (effects (font (size 1.27 1.27)) (justify left)))
(property "Value" "R" (at 0 -2.54 0) (effects (font (size 1.27 1.27)) (justify left)))
(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))
(symbol "R_0_1"
(rectangle (start -1.27 -1.27) (end 1.27 1.27)
(stroke (width 0.254) (type default)) (fill (type none)))
)
(symbol "R_1_1"
(pin passive line (at -2.54 0 0) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27)))))
(pin passive line (at 2.54 0 0) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27)))))
)
)
(symbol "C"
(pin_numbers hide) (pin_names (offset 0))
(in_bom yes)
(on_board yes)
(property "Reference" "C" (at 0 2.54 0) (effects (font (size 1.27 1.27)) (justify left)))
(property "Value" "C" (at 0 -2.54 0) (effects (font (size 1.27 1.27)) (justify left)))
(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))
(symbol "C_0_1"
(polyline (pts (xy -0.635 -1.905) (xy -0.635 1.905))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 0.635 -1.905) (xy 0.635 1.905))
(stroke (width 0.254) (type default)) (fill (type none)))
)
(symbol "C_1_1"
(pin passive line (at -2.54 0 0) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27)))))
(pin passive line (at 2.54 0 0) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27)))))
)
)
(symbol "Q_NPN"
(pin_numbers hide) (pin_names (offset 0))
(in_bom yes)
(on_board yes)
(property "Reference" "Q" (at -5.08 6.35 0) (effects (font (size 1.27 1.27)) (justify left)))
(property "Value" "Q" (at -5.08 -6.35 0) (effects (font (size 1.27 1.27)) (justify left)))
(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))
(symbol "Q_NPN_0_1"
(circle (center 0 0) (radius 1.27)
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -3.81 0) (xy -1.27 0))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 0 0) (xy 1.27 -2.54) (xy 1.27 -3.81))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 0 0) (xy 1.27 2.54) (xy 1.27 3.81))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 1.02 1.78) (xy 1.45 1.65) (xy 1.35 2.2))
(stroke (width 0.254) (type default)) (fill (type none)))
)
(symbol "Q_NPN_1_1"
(pin passive line (at -5.08 0 0) (length 1.27)
(name "B" (effects (font (size 1.27 1.27))))
(number "B" (effects (font (size 1.27 1.27)))))
(pin passive line (at 2.54 -3.81 90) (length 1.27)
(name "C" (effects (font (size 1.27 1.27))))
(number "C" (effects (font (size 1.27 1.27)))))
(pin passive line (at 2.54 3.81 270) (length 1.27)
(name "E" (effects (font (size 1.27 1.27))))
(number "E" (effects (font (size 1.27 1.27)))))
)
)
(symbol "MOS_N"
(pin_numbers hide) (pin_names (offset 0))
(in_bom yes)
(on_board yes)
(property "Reference" "Q" (at -5.08 6.35 0) (effects (font (size 1.27 1.27)) (justify left)))
(property "Value" "Q" (at -5.08 -6.35 0) (effects (font (size 1.27 1.27)) (justify left)))
(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))
(symbol "MOS_N_0_1"
(polyline (pts (xy -3.81 0) (xy -1.27 0))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -1.27 -3.81) (xy -1.27 3.81))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 0 -3.81) (xy 0 3.81))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 0 -3.81) (xy 2.54 -3.81))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 0 3.81) (xy 2.54 3.81))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 1.27 1.2) (xy 0.45 0) (xy 1.27 -1.2))
(stroke (width 0.254) (type default)) (fill (type none)))
)
(symbol "MOS_N_1_1"
(pin passive line (at -5.08 0 0) (length 1.27)
(name "G" (effects (font (size 1.27 1.27))))
(number "G" (effects (font (size 1.27 1.27)))))
(pin passive line (at 2.54 -3.81 90) (length 1.27)
(name "D" (effects (font (size 1.27 1.27))))
(number "D" (effects (font (size 1.27 1.27)))))
(pin passive line (at 2.54 3.81 270) (length 1.27)
(name "S" (effects (font (size 1.27 1.27))))
(number "S" (effects (font (size 1.27 1.27)))))
)
)
(symbol "LED"
(pin_numbers hide) (pin_names (offset 0))
(in_bom yes)
(on_board yes)
(property "Reference" "D" (at 0 2.54 0) (effects (font (size 1.27 1.27)) (justify left)))
(property "Value" "D" (at 0 -2.54 0) (effects (font (size 1.27 1.27)) (justify left)))
(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))
(symbol "LED_0_1"
(polyline (pts (xy -1.27 -1.27) (xy -1.27 1.27) (xy 1.27 0) (xy -1.27 -1.27))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 1.27 -1.27) (xy 1.27 1.27))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 1.27 0) (xy 2.54 0))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -2.29 -1.02) (xy -1.52 -0.51))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -2.29 -1.4) (xy -1.52 -0.89))
(stroke (width 0.254) (type default)) (fill (type none)))
)
(symbol "LED_1_1"
(pin passive line (at -2.54 0 0) (length 1.27)
(name "A" (effects (font (size 1.27 1.27))))
(number "A" (effects (font (size 1.27 1.27)))))
(pin passive line (at 2.54 0 0) (length 1.27)
(name "K" (effects (font (size 1.27 1.27))))
(number "K" (effects (font (size 1.27 1.27)))))
)
)
(symbol "TVS_BI"
(pin_numbers hide) (pin_names (offset 0))
(in_bom yes)
(on_board yes)
(property "Reference" "TVS" (at 0 2.54 0) (effects (font (size 1.27 1.27)) (justify left)))
(property "Value" "TVS" (at 0 -2.54 0) (effects (font (size 1.27 1.27)) (justify left)))
(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))
(symbol "TVS_BI_0_1"
(polyline (pts (xy -1.27 -1.27) (xy -1.27 1.27) (xy 0 0) (xy -1.27 -1.27))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 1.27 -1.27) (xy 1.27 1.27) (xy 0 0) (xy 1.27 -1.27))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -3.81 0) (xy -1.27 0))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 1.27 0) (xy 3.81 0))
(stroke (width 0.254) (type default)) (fill (type none)))
)
(symbol "TVS_BI_1_1"
(pin passive line (at -2.54 0 0) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27)))))
(pin passive line (at 2.54 0 0) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27)))))
)
)
(symbol "XFMR"
(pin_numbers hide) (pin_names (offset 0))
(in_bom yes)
(on_board yes)
(property "Reference" "T" (at -7.62 5.08 0) (effects (font (size 1.27 1.27)) (justify left)))
(property "Value" "T" (at -7.62 -5.08 0) (effects (font (size 1.27 1.27)) (justify left)))
(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))
(symbol "XFMR_0_1"
(polyline (pts (xy -2.54 -2.54) (xy -1.27 -1.27) (xy -3.81 -1.27) (xy -1.27 1.27) (xy -3.81 1.27) (xy -2.54 2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 2.54 -2.54) (xy 1.27 -1.27) (xy 3.81 -1.27) (xy 1.27 1.27) (xy 3.81 1.27) (xy 2.54 2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -0.635 -2.54) (xy -0.635 2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 0.635 -2.54) (xy 0.635 2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(circle (center -2.54 -2.54) (radius 0.4)
(stroke (width 0.254) (type default)) (fill (type outline)))
(circle (center 2.54 -2.54) (radius 0.4)
(stroke (width 0.254) (type default)) (fill (type outline)))
(polyline (pts (xy -6.35 -2.54) (xy -2.54 -2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -6.35 2.54) (xy -2.54 2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 2.54 -2.54) (xy 6.35 -2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 2.54 2.54) (xy 6.35 2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
)
(symbol "XFMR_1_1"
(pin passive line (at -7.62 -2.54 0) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27)))))
(pin passive line (at -7.62 2.54 0) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27)))))
(pin passive line (at 7.62 -2.54 180) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "3" (effects (font (size 1.27 1.27)))))
(pin passive line (at 7.62 2.54 180) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "4" (effects (font (size 1.27 1.27)))))
)
)
(symbol "OPTO"
(pin_numbers hide) (pin_names (offset 0))
(in_bom yes)
(on_board yes)
(property "Reference" "U" (at -7.62 5.08 0) (effects (font (size 1.27 1.27)) (justify left)))
(property "Value" "U" (at -7.62 -5.08 0) (effects (font (size 1.27 1.27)) (justify left)))
(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))
(symbol "OPTO_0_1"
(rectangle (start -5.08 -3.81) (end 5.08 3.81)
(stroke (width 0.254) (type default)) (fill (type none)))
(text "OPTO" (at 0 0 0) (effects (font (size 1.27 1.27))))
(polyline (pts (xy -6.35 -2.54) (xy -4.32 -2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -4.32 -2.54) (xy -3.3 -2.54) (xy -3.81 -1.4) (xy -4.32 -2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -6.35 2.54) (xy -3.81 2.54) (xy -3.81 -1.4))
(stroke (width 0.254) (type default)) (fill (type none)))
(circle (center 2.54 0) (radius 1.27)
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 2.54 0) (xy 3.81 -1.27) (xy 3.81 -2.54) (xy 6.35 -2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 2.54 0) (xy 3.81 1.27) (xy 3.81 2.54) (xy 6.35 2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -1.9 -0.9) (xy -0.6 0.3))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -1.9 -0.3) (xy -0.6 0.9))
(stroke (width 0.254) (type default)) (fill (type none)))
)
(symbol "OPTO_1_1"
(pin passive line (at -7.62 -2.54 0) (length 1.27)
(name "A" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27)))))
(pin passive line (at -7.62 2.54 0) (length 1.27)
(name "K" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27)))))
(pin passive line (at 7.62 -2.54 180) (length 1.27)
(name "C" (effects (font (size 1.27 1.27))))
(number "4" (effects (font (size 1.27 1.27)))))
(pin passive line (at 7.62 2.54 180) (length 1.27)
(name "E" (effects (font (size 1.27 1.27))))
(number "3" (effects (font (size 1.27 1.27)))))
)
)
(symbol "COMP"
(pin_numbers hide) (pin_names (offset 0))
(in_bom yes)
(on_board yes)
(property "Reference" "U" (at -7.62 5.08 0) (effects (font (size 1.27 1.27)) (justify left)))
(property "Value" "U" (at -7.62 -5.08 0) (effects (font (size 1.27 1.27)) (justify left)))
(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))
(symbol "COMP_0_1"
(polyline (pts (xy -6.35 -2.54) (xy -6.35 2.54) (xy 6.35 0) (xy -6.35 -2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(text "+" (at -5.7 -2.29 0) (effects (font (size 1.27 1.27))))
(text "-" (at -5.7 1.4 0) (effects (font (size 1.27 1.27))))
)
(symbol "COMP_1_1"
(pin passive line (at -7.62 -2.54 0) (length 1.27)
(name "+" (effects (font (size 1.27 1.27))))
(number "+" (effects (font (size 1.27 1.27)))))
(pin passive line (at -7.62 2.54 0) (length 1.27)
(name "-" (effects (font (size 1.27 1.27))))
(number "-" (effects (font (size 1.27 1.27)))))
(pin passive line (at 7.62 0 180) (length 1.27)
(name "OUT" (effects (font (size 1.27 1.27))))
(number "OUT" (effects (font (size 1.27 1.27)))))
)
)
(symbol "MCU"
(pin_numbers hide) (pin_names (offset 0))
(in_bom yes)
(on_board yes)
(property "Reference" "U" (at 0 12.7 0) (effects (font (size 1.27 1.27)) (justify left)))
(property "Value" "U" (at 0 -12.7 0) (effects (font (size 1.27 1.27)) (justify left)))
(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))
(symbol "MCU_0_1"
(rectangle (start -12.7 -10.16) (end 12.7 10.16)
(stroke (width 0.254) (type default)) (fill (type none)))
(text "MCU" (at 0 -5.08 0) (effects (font (size 1.27 1.27))))
(text "STM32/GD32" (at 0 -2.54 0) (effects (font (size 1.27 1.27))))
)
(symbol "MCU_1_1"
(pin passive line (at -12.7 -5.08 0) (length 1.27)
(name "PA0" (effects (font (size 1.27 1.27))))
(number "PA0" (effects (font (size 1.27 1.27)))))
(pin passive line (at -12.7 5.08 0) (length 1.27)
(name "GND" (effects (font (size 1.27 1.27))))
(number "GND" (effects (font (size 1.27 1.27)))))
(pin passive line (at 12.7 -5.08 180) (length 1.27)
(name "PA1" (effects (font (size 1.27 1.27))))
(number "PA1" (effects (font (size 1.27 1.27)))))
(pin passive line (at 12.7 0 180) (length 1.27)
(name "PA2" (effects (font (size 1.27 1.27))))
(number "PA2" (effects (font (size 1.27 1.27)))))
(pin passive line (at 12.7 5.08 180) (length 1.27)
(name "VDD" (effects (font (size 1.27 1.27))))
(number "VDD" (effects (font (size 1.27 1.27)))))
)
)
(symbol "RELAY_SPDT"
(pin_numbers hide) (pin_names (offset 0))
(in_bom yes)
(on_board yes)
(property "Reference" "K" (at -7.62 6.35 0) (effects (font (size 1.27 1.27)) (justify left)))
(property "Value" "K" (at -7.62 -6.35 0) (effects (font (size 1.27 1.27)) (justify left)))
(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))
(symbol "RELAY_SPDT_0_1"
(rectangle (start -5.08 -2.54) (end 2.54 2.54)
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -5.08 -1.9) (xy 2.54 1.9))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -6.35 -2.54) (xy -5.08 -2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy -6.35 2.54) (xy -5.08 2.54))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 2.54 0) (xy 5.08 0))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 5.08 0) (xy 5.08 5.08))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 5.08 5.08) (xy 6.35 5.08))
(stroke (width 0.254) (type default)) (fill (type none)))
(polyline (pts (xy 5.08 -5.08) (xy 6.35 -5.08))
(stroke (width 0.254) (type default)) (fill (type none)))
(circle (center 5.08 0) (radius 0.4)
(stroke (width 0.254) (type default)) (fill (type outline)))
(circle (center 5.08 -5.08) (radius 0.4)
(stroke (width 0.254) (type default)) (fill (type outline)))
(circle (center 5.08 5.08) (radius 0.4)
(stroke (width 0.254) (type default)) (fill (type outline)))
)
(symbol "RELAY_SPDT_1_1"
(pin passive line (at -7.62 -2.54 0) (length 1.27)
(name "A1" (effects (font (size 1.27 1.27))))
(number "A1" (effects (font (size 1.27 1.27)))))
(pin passive line (at -7.62 2.54 0) (length 1.27)
(name "A2" (effects (font (size 1.27 1.27))))
(number "A2" (effects (font (size 1.27 1.27)))))
(pin passive line (at 7.62 0 180) (length 1.27)
(name "COM" (effects (font (size 1.27 1.27))))
(number "COM" (effects (font (size 1.27 1.27)))))
(pin passive line (at 7.62 -5.08 180) (length 1.27)
(name "NO" (effects (font (size 1.27 1.27))))
(number "NO" (effects (font (size 1.27 1.27)))))
(pin passive line (at 7.62 5.08 180) (length 1.27)
(name "NC" (effects (font (size 1.27 1.27))))
(number "NC" (effects (font (size 1.27 1.27)))))
)
)
(symbol "CONN2"
(pin_numbers hide) (pin_names (offset 0))
(in_bom yes)
(on_board yes)
(property "Reference" "J" (at -2.54 5.08 0) (effects (font (size 1.27 1.27)) (justify left)))
(property "Value" "J" (at -2.54 -5.08 0) (effects (font (size 1.27 1.27)) (justify left)))
(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))
(symbol "CONN2_0_1"
(polyline (pts (xy -3.81 -3.81) (xy -3.81 3.81))
(stroke (width 0.254) (type default)) (fill (type none)))
(circle (center -2.54 -2.54) (radius 1.27)
(stroke (width 0.254) (type default)) (fill (type none)))
(circle (center -2.54 2.54) (radius 1.27)
(stroke (width 0.254) (type default)) (fill (type none)))
)
(symbol "CONN2_1_1"
(pin passive line (at -2.54 -2.54 0) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27)))))
(pin passive line (at -2.54 2.54 0) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27)))))
)
)
)
@@ -0,0 +1,4 @@
(sym_lib_table
(version 7)
(lib (name "loopdet")(type "KiCad")(uri "${KIPRJMOD}/loopdet.kicad_sym")(options "")(descr "Loop detector custom symbols"))
)