We’ve just made it much easier to simulate a step response in CircuitLab. Finding a circuit’s unit step response in the time domain is one of the most common operations for anyone learning about or designing analog filters and amplifiers.
It’s always been possible to simulate step responses in CircuitLab using a combination of a voltage source and a switch, but we’ve now bundled this behavior into a signal component: the Voltage Step Source and the corresponding Current Step Source.
Here’s a simple example comparing voltage step responses between a series RC circuit and a parallel RL circuit:
Click to open and simulate the circuit above. Can you predict the shape of V(RC) and V(RL) before you run the simulation?
Here’s a more advanced example showing how an op-amp non-inverting amplifier can exhibit stability problems, including ringing and overshoot, even with small amounts of parasitic (undesired) capacitance at the feedback node:
Click to open and simulate the circuit above. How long does it take for the output to settle down after the input step? Is there a capacitance level beyond which this amplifier is basically useless?
Note that the step only happens in a transient simulation. A DC simulation (or DC Sweep) always happens before the step. This lets the simulator find the old, pre-step steady-state operating point first, before it models the transient change to a new post-step steady-state.
These new step source components are both available in the “Voltage Signal Sources” and “Current Signal Sources” sections of the CircuitLab toolbox, right between the configurable function generator source and the CSV input source:
After inserting a step source, you can double-click it to configure its amplitude and provide a delay. Conveniently, by default, a step source provides a unit step at t=0.
We’re introducing a new component to the CircuitLab toolbox: the ideal diode.
We’ve had semiconductor PN junction diodes since we’ve launched, which show the exponential current-voltage relationship and accurately model real-world diodes.
In contrast, the ideal diode is more like a simulated on-off switch: the I-V curve would be piecewise linear. It acts like it’s open-circuit when reverse biased, and short-circuit when forward biased. You can simply drag the ideal diode from the toolbox into your circuit, and optionally double-click to configure its parameters.
Here’s an example using four ideal diodes to build a full-wave rectifier:
Click to open and simulate the circuit above. Observe how the 4 diodes turn on and off at different times in the AC cycle.
Here’s an simulation comparing the regular PN Junction Diode with the ideal diode:
Click to open and simulate the circuit above.
Note that D2 (a PN junction diode) gives us a gentle knee as it transitions from off to on, as real diodes do. D2’s curve is smooth in the calculus sense: its derivative is continuous.
In contrast, ideal diodes D1 and D3 show an abrupt (piecewise-linear) knee when they change from off to on. These are not smooth in the calculus sense: their derivatives are discontinuous.
Both diode models, as well as Zener Diodes, photodiodes, and LEDs, are nows available in the CircuitLab toolbox:
In this tutorial video we build and simulate in an inverting amplifier with a chosen gain using an op-amp and other passive elements. We go over a few key concepts of an op-amps, introduce negative feedback, and build out a circuit that allows you to choose a specific gain for your inverting amplifier.
So I'm going to open up my CircuitLab editor here, and find the operational amplifier section, and I'm gonna drop this op amp onto my circuit. Op amps have lots of super cool properties, but I'm going to be using two big ones.
First, an op amp takes the difference of the two input voltages, and multiples that difference by a really really high number at the output voltage. This multiplication factor is the open loop gain of an op amp. We can see it here in the properties, it's the A_OL number, notice how all the device models have a different number, but the important thing is that number is a super high number, look em they're all in the hundreds of thousands or millions.
The other property is that no current (in reality very very little current) flows into or out of either of the input terminals. This will be important later.
The opamp models CircuitLab model the real devices based on the numbers in their datasheets. An "ideal" op amp which you may run into a problem set just has these properties maximally true, so the open loop gain is infinite and the input currents are actually 0.
Lets see these two properties in our simulation. [Show open loop gain in CircuitLab editor]
Ok so that's neat but not that useful because I want to be able to control this gain, just having an arbitrarily large number out here isn't helpful. So the first neat trick I'm going to use is negative feedback.
I'm gonna grab the output terminal and let's reason about what happens when I connect it directly to the minus input terminal. In this configuration, if something like a bit of noise in the universe was to make this voltage go up at the non inverting terminal, the output goes up, and the inverting input goes up, which makes the output go down. That output going down is fighting the original change.. And it balances out when there’s no difference between the two input terminals.
In this configuration, with negative feedback the op amp works to subtract any difference between the two input terminals. Meaning the inverting terminal will follow the non inverting terminal. We made a follower circuit!
So we are not there yet, let's introduce one more thing. I'm going to add a voltage source here, and two resistors. And I'm gonna call this one Rf, and this one Rin. Lets reason about this circuit. What is our output? We know in this configuration the difference between these two terminals is 0. The only way it can do that is by changing its output voltage and then measuring the two inputs again. We also know that no current can flow into or out of our input terminals. So I put a signal voltage here of 1, and if the op amp is forcing this to be 0, then our trusty friend V=IR says there is current flowing through this resistor, the other rule of the op amp says that current can't go into this terminal, so it has to go through this other resistor Rf. Again our trusty friend says if there is an IR there has to be voltage drop, and since it's the same I and R I think this voltage at out2 is going to be -1, and by golly it is.
So what if I make this Rf twice as large. Same input V, same Rin, so this current is the same, but now r is twice as much. Again V=IR so twice as much R and same I means twice as much Vout. Is it? Yes it is bloody exciting.
This means that just by changing the ratio of these resistors I can manipulate this circuit to have an arbitrary gain at its output!
You can find a link to this Circuit in the description of this video, you can open it up, change it and simulate it yourself to see what happens. If you found this helpful please like the video, and we will see you next time.
CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.
|New @ CircuitLab|