Step Response in a Snap (Switches and Step Sources)

Scroll through the screenshots below to learn how to run time-domain (transient) simulations, plot step responses for an RC circuit, and explore how it changes when we make the circuit nonlinear with an LED.

Click and drag a resistor, a capacitor, and a voltage source from the toolbox onto your schematic, pressing R to rotate the resistor to horizontal:

Drag wires from the endpoints to complete the circuit:

Press G to add a ground node, and click to place it:

Press N to insert a node name label, and click to place it on top of the capacitor:

Press N again and insert another node name label on top of the voltage source:

Double-click NODE1 and rename it to "out":

Double-click NODE2 and name it "in". You may also rotate it around its anchor point by pressing R:

Press / (forward slash) to begin searching the toolbox and enter "time". Click and drag the Time Controlled Switch to break the wire between V1 and R1:

We've now completed the circuit. Switch to simulation mode by clicking Simulate at the bottom of the window:

We'd like to see the step response, so click Time Domain in the simulation settings panel:

To run the simulation, we need to tell the simulator what to plot. Click on the node name labels "in" and "out" and you’ll see that V(in) and V(out) get added to the simulation Outputs:

Now we just need to indicate how long to simulate for. Enter "10m" under Stop Time (for 10 milliseconds of overall simulation), and "10u" under Time Step (for 10 microseconds of time resolution):

Click Run Time-Domain Simulation, and in just a moment, a plot appears:

Hover over the traces to see the voltages:

Let's get more detail here. We can click and drag within the plot window to zoom in on a region of interest:

Double-click within the plot to reset to the original zoom.

Click on the simulation settings box and change the Stop Time to "1m", and run the simulation again:

Notice the change in the x-axis.

This simulation runs very quickly because we only are simulating 100 time steps (1ms stop time / 10us time step). However, we can improve the accuracy of the simulation if we make the time step smaller. Click on the simulation settings box and change Time Step to "0.1u" and run the simulation again:

While the general shape is the same, there's now much more detail in the simulation curve. In general, choosing a smaller Time Step increases simulation accuracy but may take a bit longer for the simulation to run.

Click Build at the bottom of the window. Press / (forward slash) to focus the toolbar search, and type "step":

We can use the Voltage Step Source element in place of the voltage source and Time-Controlled Switch combination. First, while holding the Shift key to select multiple elements, click V1 and SW1, and then press Backspace or Delete to remove them:

Click and drag the Voltage Step from the toolbox to the place where V1 used to be:

Click and drag to rejoin the wire between R1 and the "in" label:

Press F5 to repeat the last configured simulation. A new plot window appears:

The Voltage Step source allows us to easily see the same step response, without dealing with the complexity of a separate switch element.

Let's make the circuit a bit more complex. Click Build at the bottom to switch back to build mode and double-click on V2 to edit the step parameters. Change it to be a 5 volt step:

Clear the toolbox search and scroll down to Diodes. Click and drag an LED onto the circuit, sitting next to C1:

Drag wires from D1 to connect it in parallel with C1:

Before you run the simulation, can you guess what the output curve will look like?

Press F5 to run the simulation and find out:

Let's also look at the current through the diode. Click Hide at the top right of the plot window:

Now, hover your mouse near the anode of D1 and you'll see the diode's terminal appear as a small grey circle. Click this grey circle:

After clicking the endpoint, take a look at the simulation settings window. You'll notice that I(D1.nA) has been added to the simulation's Outputs list:

Do you expect the LED current to rise following the same shape as V(out)? Let's find out. Click Run Time-Domain Simulation again:

CircuitLab is smart enough to draw the voltage and current plots on two separate subplots with separate y-axes, but sharing one time x-axis. (You can change this by clicking Advanced Graphing.)

That's it! While the capacitor's charging up, the LED doesn't start turning on for a good 30 microseconds or so.

Click below to open the final circuit, or try it yourself from scratch (recommended).

« Return to Table of Contents

Search Documentation

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.