Skip to content

Commit b9c3652

Browse files
napowderlyclaude
andcommitted
Add high-side-switch package and update .gitignore
Include the existing high-side-switch P-FET power switch package and add layouts/ to .gitignore (auto-generated by atopile builds). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 191394f commit b9c3652

15 files changed

Lines changed: 46063 additions & 24 deletions

.gitignore

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# For PCBs designed using KiCad: https://www.kicad.org/
2-
# Format documentation: https://kicad.org/help/file-formats/
3-
4-
# Temporary files
1+
# === KiCad ===
52
*.000
63
*.bak
74
*.bck
@@ -17,34 +14,35 @@ _autosave-*
1714
*-save.kicad_pcb
1815
*.kicad_pcb.lck
1916
fp-info-cache
20-
21-
# Netlist files (exported from Eeschema)
2217
*.net
23-
24-
# Autorouter files (exported from Pcbnew)
2518
*.dsn
2619
*.ses
2720

28-
# Exported BOM files
29-
*.xml
30-
*.csv
31-
32-
build/
33-
.DS_Store
34-
35-
# Virtual environment
36-
.venv/
37-
venv/
38-
39-
# .ato directory
21+
# === atopile ===
4022
.ato/
23+
build/
24+
layouts/
4125

42-
# IDEs
43-
.vscode/
44-
26+
# === Zephyr / west ===
27+
firmware/build/
28+
firmware/card/build/
29+
firmware/card/twister-out*
30+
.west/
4531

46-
# Python cache files
32+
# === Python ===
4733
__pycache__/
4834
*.pyc
4935
*.pyo
5036
*.pyd
37+
*.egg-info/
38+
dist/
39+
.venv/
40+
venv/
41+
42+
# === OS ===
43+
.DS_Store
44+
Thumbs.db
45+
46+
# === IDEs ===
47+
.vscode/
48+
.idea/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
requires-atopile: "^0.9.0"
2+
3+
paths:
4+
src: "."
5+
layout: ./layouts
6+
7+
builds:
8+
default:
9+
entry: high-side-switch.ato:HighSidePowerSwitch
10+
example:
11+
entry: high-side-switch.ato:Example
12+
13+
dependencies: []
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#pragma experiment("BRIDGE_CONNECT")
2+
3+
# High-Side Power Switch
4+
# ======================
5+
# P-channel MOSFET with NPN gate driver for GPIO-controlled power switching.
6+
# Default state: OFF (gate pulled high via pull-up resistor).
7+
# Active-high enable: NPN pulls MOSFET gate low to turn on.
8+
#
9+
# Designed for 24V, 6A continuous (5.14A worst-case per slot).
10+
# P-FET: Si4435DDY or equivalent (-30V, -8.5A, Rds(on) 20mohm)
11+
# Power dissipation at 5A: I²R = 25 * 0.02 = 0.5W
12+
13+
import Resistor
14+
import Capacitor
15+
16+
# --- High-Side Power Switch Module ---
17+
18+
module HighSidePowerSwitch:
19+
"P-FET high-side switch with NPN gate driver. Active-high enable, default OFF."
20+
21+
# External interfaces
22+
power_in = new ElectricPower # 24V bus input
23+
power_out = new ElectricPower # Switched 24V output
24+
enable = new ElectricLogic # Active-high enable from GPIO expander
25+
26+
# --- P-Channel MOSFET (high-side switch) ---
27+
# Source connected to power_in.hv (24V)
28+
# Drain connected to power_out.hv (switched 24V)
29+
# Gate controlled by NPN driver
30+
#
31+
# Gate-Source pull-up resistor (default OFF: gate pulled to source = VGS=0)
32+
r_gs_pullup = new Resistor
33+
r_gs_pullup.resistance = 10kohm +/- 5%
34+
r_gs_pullup.package = "0402"
35+
36+
# --- NPN Gate Driver ---
37+
# When enable is HIGH: NPN turns on, pulls MOSFET gate to GND -> VGS = -24V -> MOSFET ON
38+
# When enable is LOW: NPN off, pull-up holds gate at source potential -> MOSFET OFF
39+
#
40+
# Base resistor (limits base current from 3.3V GPIO)
41+
r_base = new Resistor
42+
r_base.resistance = 10kohm +/- 5%
43+
r_base.package = "0402"
44+
45+
# Base-emitter pull-down (ensures NPN stays off when GPIO is floating)
46+
r_be_pulldown = new Resistor
47+
r_be_pulldown.resistance = 100kohm +/- 5%
48+
r_be_pulldown.package = "0402"
49+
50+
# Gate resistor (limits inrush current to gate capacitance, provides soft-start)
51+
r_gate = new Resistor
52+
r_gate.resistance = 100ohm +/- 5%
53+
r_gate.package = "0402"
54+
55+
# Shared ground between input and output
56+
power_in.lv ~ power_out.lv
57+
58+
# --- Connections ---
59+
# P-FET gate-source pull-up: gate to source (power_in.hv)
60+
# NPN collector to gate via gate resistor
61+
# NPN base from enable via base resistor
62+
# NPN emitter to GND
63+
#
64+
# NOTE: The P-FET and NPN transistor are discrete components that need
65+
# explicit part selection. The connectivity is:
66+
# power_in.hv ---- r_gs_pullup ---- GATE ---- r_gate ---- NPN_collector
67+
# | NPN_emitter ---- GND
68+
# |--- P-FET source NPN_base ---- r_base ---- enable.line
69+
# NPN_base ---- r_be_pulldown ---- GND
70+
# power_out.hv --- P-FET drain
71+
#
72+
# TODO: Add P-FET and NPN component definitions when JLCPCB parts are selected
73+
# P-FET: Si4435DDY (-30V, -8.5A, Rds(on) 20mohm, SOT-23/SO-8)
74+
# NPN: 2N3904 or MMBT3904 (SOT-23)
75+
76+
77+
# --- Example Usage ---
78+
79+
module Example:
80+
"Example: High-side switch on a 24V bus controlled by a GPIO"
81+
82+
power_24v = new ElectricPower
83+
power_24v_switched = new ElectricPower
84+
enable = new ElectricLogic
85+
86+
sw = new HighSidePowerSwitch
87+
sw.power_in ~ power_24v
88+
sw.power_out ~ power_24v_switched
89+
sw.enable ~ enable
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
(kicad_symbol_lib
2+
(version 20241229)
3+
(generator "faebryk_convert")
4+
(symbol "0402WGF1000TCE"
5+
(property "Reference" "R"
6+
(id 0)
7+
(at 0 5.08 0)
8+
(effects
9+
(font
10+
(size 1.27 1.27)
11+
)
12+
)
13+
)
14+
(property "Value" "0402WGF1000TCE"
15+
(id 1)
16+
(at 0 -5.08 0)
17+
(effects
18+
(font
19+
(size 1.27 1.27)
20+
)
21+
)
22+
)
23+
(property "Footprint" "C25076:R0402"
24+
(id 2)
25+
(at 0 -7.62 0)
26+
(effects
27+
(font
28+
(size 1.27 1.27)
29+
)
30+
)
31+
)
32+
(property "Datasheet" "https://lcsc.com/product-detail/Chip-Resistor-Surface-Mount-UniOhm_100R-1000-1_C25076.html"
33+
(id 3)
34+
(at 0 -10.16 0)
35+
(effects
36+
(font
37+
(size 1.27 1.27)
38+
)
39+
)
40+
)
41+
(property "LCSC Part" "C25076"
42+
(id 5)
43+
(at 0 -12.7 0)
44+
(effects
45+
(font
46+
(size 1.27 1.27)
47+
)
48+
)
49+
)
50+
(in_bom yes)
51+
(on_board yes)
52+
(symbol "0402WGF1000TCE_0_1"
53+
(rectangle
54+
(start -2.54 1.02)
55+
(end 2.54 -1.02)
56+
(stroke
57+
(width 0)
58+
(type default)
59+
(color 0 0 0 0)
60+
)
61+
(fill
62+
(type background)
63+
)
64+
)
65+
(pin input line
66+
(at 5.08 -0 180)
67+
(length 2.54)
68+
(name "2"
69+
(effects
70+
(font
71+
(size 1.27 1.27)
72+
)
73+
)
74+
)
75+
(number "2"
76+
(effects
77+
(font
78+
(size 1.27 1.27)
79+
)
80+
)
81+
)
82+
)
83+
(pin input line
84+
(at -5.08 -0 0)
85+
(length 2.54)
86+
(name "1"
87+
(effects
88+
(font
89+
(size 1.27 1.27)
90+
)
91+
)
92+
)
93+
(number "1"
94+
(effects
95+
(font
96+
(size 1.27 1.27)
97+
)
98+
)
99+
)
100+
)
101+
)
102+
)
103+
)

0 commit comments

Comments
 (0)