Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 0 additions & 218 deletions docs/advanced/spice-simulation.mdx

This file was deleted.

10 changes: 10 additions & 0 deletions docs/guides/spice-simulation/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"label": "SPICE Simulation",
"position": 5,
"link": {
"type": "generated-index",
"description": "Learn how to use tscircuit to run SPICE simulations and analyze analog circuit behavior."
},
"collapsible": true,
"collapsed": true
}
106 changes: 106 additions & 0 deletions docs/guides/spice-simulation/boost-converter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
title: Boost Converter Example
sidebar_label: Boost Converter
sidebar_position: 2
description: An example of a boost converter circuit configured for SPICE simulation.
---
import CircuitPreview from "@site/src/components/CircuitPreview"

<p>
Here is an example of a boost converter circuit configured for SPICE
simulation. It uses one voltage source (`V2`) with a square wave to drive
a MOSFET, boosting the voltage from a 5V DC source (`V1`) to a higher
level. Voltage probes are placed at the input and output to observe the
results.
</p>
<CircuitPreview
defaultView="schematic"
showSimulationGraph={true}
code={`
export default () => (
<board width={30} height={30} schMaxTraceDistance={5}>
<voltagesource
name="V1"
voltage={"5V"}
schY={2}
schX={-5}
schRotation={270}
/>
<trace from={".V1 > .pin1"} to={".L1 > .pin1"} />
<trace from={".L1 > .pin2"} to={".D1 > .anode"} />
<trace from={".D1 > .cathode"} to={".C1 > .pin1"} />
<trace from={".D1 > .cathode"} to={".R1 > .pin1"} />
<trace from={".C1 > .pin2"} to={".R1 > .pin2"} />
<trace from={".R1 > .pin2"} to={".V1 > .pin2"} />
<trace from={".L1 > .pin2"} to={".M1 > .drain"} />
<trace from={".M1 > .source"} to={".V1 > .pin2"} />
<trace from={".M1 > .source"} to={"net.GND"} />
<trace from={".M1 > .gate"} to={".V2 > .pin1"} />
<trace from={".V2 > .pin2"} to={".V1 > .pin2"} />
<inductor
footprint={"0603"}
name="L1"
inductance={"1mH"}
schY={3}
schX={-1}
pcbY={3}
/>
<diode
name="D1"
footprint={"0603"}
schY={3}
schX={2.1}
pcbY={6}
pcbX={3}
/>
<capacitor
polarized
schRotation={270}
name="C1"
capacitance={"10uF"}
footprint={"0603"}
schX={3}
pcbX={3}
/>
<resistor
schRotation={270}
name="R1"
resistance={"1k"}
footprint={"0603"}
schX={6}
pcbX={9}
/>
<voltagesource
name="V2"
voltage={"10V"}
waveShape="square"
dutyCycle={0.68}
frequency={"1kHz"}
schX={-3}
schRotation={270}
/>
<mosfet
channelType="n"
footprint={"sot23"}
name="M1"
mosfetMode="enhancement"
pcbX={-4}
/>
<voltageprobe connectsTo={".V1 > .pin1"} />
<voltageprobe connectsTo={".R1 > .pin1"} />

<analogsimulation
duration={100}
timePerStep={1}
spiceEngine="ngspice"
/>
</board>
)
`}
/>
<p>
The simulation results would show the output voltage across `R1`
successfully "boosted" compared to the 5V input from `V1`. The specific
output voltage depends on the duty cycle of the MOSFET driver `V2` and the
component values.
</p>
Loading