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 (sine, square, or triangle). 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"
amplitude="5V"
offset="2.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 (when you want a steady source)."5V"
waveShapeWaveform shape for AC sources. Common values are "sinewave", "square", and "triangle"."square"
frequencyFrequency of the waveform."1kHz"
amplitudeAC amplitude (peak) for the waveform."5V"
offsetDC offset added to the waveform."2.5V"
dutyCycleDuty cycle for square waves, from 0 to 1.0.5
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.