Aller au contenu principal

Square Wave Generator

An ideal voltage source that produces a periodic square-wave output. Commonly used to drive digital logic, test switching power supplies, clock circuits, and observe transient responses.

Properties

PropertyDescriptionDefaultRange
AmplitudeHigh-state voltage (V)5 V0.1 V – 1 000 V
FrequencySwitching frequency (Hz)1 000 Hz0.001 Hz – 10 MHz
Duty cycleFraction of each period the output is high (%)50 %1 % – 99 %
Rise timeTime to transition from low to high (s)1 µs1 ns – 1 ms

Simulation behavior

The output alternates between 0 V (low) and amplitude (high). The high time is duty_cycle / frequency and the low time is (1 – duty_cycle) / frequency.

Transitions are modeled with the configured rise time rather than an instantaneous edge, which prevents numerical instability in the solver and more accurately models real-world drivers.

The generator is an ideal voltage source — it can source or sink unlimited current to maintain the programmed waveform.

Tips

  • Set duty cycle below 50 % to model a PWM signal for dimming an LED or controlling motor speed — observe the average brightness or current change in real time.
  • Increase rise time to model a slow or heavily-loaded driver and watch the effect on a downstream RC circuit.
  • Combine with an inductor and diode to build a simple boost converter and observe how switching frequency affects output ripple.