Skip to content

Commit d2e9cd3

Browse files
refactor: Reorganize SPICE simulation documentation (#326)
* refactor: Reorganize SPICE simulation documentation * cleanup * fix build error * renambe tab
1 parent 4023dad commit d2e9cd3

File tree

5 files changed

+256
-218
lines changed

5 files changed

+256
-218
lines changed

docs/advanced/spice-simulation.mdx

Lines changed: 0 additions & 218 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"label": "SPICE Simulation",
3+
"position": 5,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Learn how to use tscircuit to run SPICE simulations and analyze analog circuit behavior."
7+
},
8+
"collapsible": true,
9+
"collapsed": true
10+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
title: Boost Converter Example
3+
sidebar_label: Boost Converter
4+
sidebar_position: 2
5+
description: An example of a boost converter circuit configured for SPICE simulation.
6+
---
7+
import CircuitPreview from "@site/src/components/CircuitPreview"
8+
9+
<p>
10+
Here is an example of a boost converter circuit configured for SPICE
11+
simulation. It uses one voltage source (`V2`) with a square wave to drive
12+
a MOSFET, boosting the voltage from a 5V DC source (`V1`) to a higher
13+
level. Voltage probes are placed at the input and output to observe the
14+
results.
15+
</p>
16+
<CircuitPreview
17+
defaultView="schematic"
18+
showSimulationGraph={true}
19+
code={`
20+
export default () => (
21+
<board width={30} height={30} schMaxTraceDistance={5}>
22+
<voltagesource
23+
name="V1"
24+
voltage={"5V"}
25+
schY={2}
26+
schX={-5}
27+
schRotation={270}
28+
/>
29+
<trace from={".V1 > .pin1"} to={".L1 > .pin1"} />
30+
<trace from={".L1 > .pin2"} to={".D1 > .anode"} />
31+
<trace from={".D1 > .cathode"} to={".C1 > .pin1"} />
32+
<trace from={".D1 > .cathode"} to={".R1 > .pin1"} />
33+
<trace from={".C1 > .pin2"} to={".R1 > .pin2"} />
34+
<trace from={".R1 > .pin2"} to={".V1 > .pin2"} />
35+
<trace from={".L1 > .pin2"} to={".M1 > .drain"} />
36+
<trace from={".M1 > .source"} to={".V1 > .pin2"} />
37+
<trace from={".M1 > .source"} to={"net.GND"} />
38+
<trace from={".M1 > .gate"} to={".V2 > .pin1"} />
39+
<trace from={".V2 > .pin2"} to={".V1 > .pin2"} />
40+
<inductor
41+
footprint={"0603"}
42+
name="L1"
43+
inductance={"1mH"}
44+
schY={3}
45+
schX={-1}
46+
pcbY={3}
47+
/>
48+
<diode
49+
name="D1"
50+
footprint={"0603"}
51+
schY={3}
52+
schX={2.1}
53+
pcbY={6}
54+
pcbX={3}
55+
/>
56+
<capacitor
57+
polarized
58+
schRotation={270}
59+
name="C1"
60+
capacitance={"10uF"}
61+
footprint={"0603"}
62+
schX={3}
63+
pcbX={3}
64+
/>
65+
<resistor
66+
schRotation={270}
67+
name="R1"
68+
resistance={"1k"}
69+
footprint={"0603"}
70+
schX={6}
71+
pcbX={9}
72+
/>
73+
<voltagesource
74+
name="V2"
75+
voltage={"10V"}
76+
waveShape="square"
77+
dutyCycle={0.68}
78+
frequency={"1kHz"}
79+
schX={-3}
80+
schRotation={270}
81+
/>
82+
<mosfet
83+
channelType="n"
84+
footprint={"sot23"}
85+
name="M1"
86+
mosfetMode="enhancement"
87+
pcbX={-4}
88+
/>
89+
<voltageprobe connectsTo={".V1 > .pin1"} />
90+
<voltageprobe connectsTo={".R1 > .pin1"} />
91+
92+
<analogsimulation
93+
duration={100}
94+
timePerStep={1}
95+
spiceEngine="ngspice"
96+
/>
97+
</board>
98+
)
99+
`}
100+
/>
101+
<p>
102+
The simulation results would show the output voltage across `R1`
103+
successfully "boosted" compared to the 5V input from `V1`. The specific
104+
output voltage depends on the duty cycle of the MOSFET driver `V2` and the
105+
component values.
106+
</p>

0 commit comments

Comments
 (0)