Skip to main content
Built-in Elements

<voltagesource />

Overview​

<voltagesource /> defines a two-pin voltage source that can drive your circuit in SPICE simulations. It supports DC sources as well as waveform-driven sources ("sinewave", "square", "triangle", and "sawtooth"). Use this element to provide input stimulus for filters, rectifiers, power converters, and other analog designs.

Schematic Circuit Preview
export default () => (
<board routingDisabled>
<voltagesource
name="V1"
waveShape="square"
voltage="5V"
frequency="1kHz"
dutyCycle={0.5}
/>
<resistor name="R1" resistance="1k" />

<trace from=".V1 > .pin1" to=".R1 > .pin1" />
<trace from=".V1 > .pin2" to=".R1 > .pin2" />

<voltageprobe name="VP_OUT" connectsTo=".R1 > .pin1" />
<analogsimulation duration="5ms" timePerStep="0.05ms" spiceEngine="ngspice" />
</board>
)

Properties​

PropertyDescriptionExample
nameReference designator for the source."V1"
voltageDC voltage or amplitude voltage for the source."5V"
peakToPeakVoltagePeak-to-peak voltage for waveform-driven sources."4V"
waveShapeWaveform shape for transient sources: "sinewave", "square", "triangle", or "sawtooth"."square"
frequencyFrequency of the waveform."1kHz"
phaseWaveform phase in degrees.90
dutyCycleDuty cycle for square waves, from 0 to 1 (or percentage string such as "50%").0.5
pulseDelay, riseTime, fallTime, pulseWidth, periodOptional pulse timing parameters for square/pulse waveforms.riseTime="1ns"
acMagnitude, acPhaseSmall-signal AC analysis magnitude (volts) and phase (degrees).acMagnitude="1V"
schX, schY, schRotationSchematic placement controls.schRotation={270}

Use <voltagesource /> alongside <analogsimulation /> to define inputs for SPICE analysis. For physical power sources on a PCB, consider <battery /> or a connector instead.