We are big fans of the Falstad circuit simulator. Sure, it isn’t perfect, but there’s nothing else like it when you want to whip up a simple circuit. But we were blown away when we saw a more or less complete hardware implementation of Pong in Falstad. No kidding. Starting with the original schematics, there are multiple pages that show each sub-circuit and even a playable subset that you can play the game in your browser.
We are always impressed with something so simple can actually be so complex. For example, what would you think goes into an analog computer? Of course, a “real” analog computer has opamps that can do logarithms, square roots, multiply, and divide. But would it surprise you that you can make an analog device like a slide rule using a Wheatstone bridge — essentially two voltage dividers. You don’t even need any active devices at all. It is an old idea and one that used to show up in electronic magazines now and again. I’ll show you how they work and simulate the device so you don’t have to build it unless you just want to.
A voltage divider is one of the easiest circuits in the world to analyze. Consider two resistors Ra and Rb in series. Voltage comes in at the top of Ra and the bottom of Rb is grounded. The node connecting Ra and Rb — let’s call it Z — is what we’ll consider the output.
Let’s say we have a 10 V battery feeding A and a perfect voltmeter that doesn’t load the circuit connected to Z. By Kirchoff’s current law we know the current through Ra and Rb must be the same. After all, there’s nowhere else for it to go. We also know the voltage drop across Ra plus the voltage drop across Rb must equal to 10 V. Kirchoff, conservation of energy, whatever you want to call it. Let’s call these quantities I, Va, and Vb. Continue reading “Circuit VR: The Wheatstone Bridge Analog Computer”→
These days, we are spoiled for choice with regard to SDRs for RF analysis, but sometimes we’re more interested in the source of RF than the contents of the transmission. For this role, [Drew] created the RFListener, a wideband directional RF receiver that converts electromagnetic signal to audio.
The RF Listener is built around a AD8318 demodulator breakout board, which receives signals using a directional broadband (900 Mhz – 12 Ghz) PCB antenna, and outputs an analog signal. This signal is fed through a series of amplifiers and filters to create audio that can be fed to the onboard speaker. Everything is housed in a vaguely handgun shaped enclosure, with some switches on the back and a LED amplitude indicator. [Drew] demonstrates the RFListener around his house, pointing it at various devices like his router, baby monitor and microwave. In some cases, like with a toy drone, the modulation is too high frequency to generate audio, so the RF listener can also be switched to “tone mode”, which outputs audio tone proportional to the signal amplitude.
The circuit is completely analog, and the design was first done in Falstad Circuit Simulator, followed by some breadboard prototyping, and a custom PCB for the final version. As is, it’s already an interesting exploration device, but it would be even more so if it was possible to adjust the receiver bandwidth and frequency to turn it into a wideband foxhunting tool.
There was a time when building electronics and building software were two distinct activities. These days, almost any significant electronic project will use a CPU somewhere, or — at least — could. Using a circuit simulator can get you part of the way and software simulators abound. But cosimulation — simulating both analog circuits and a running processor — is often only found in high-end simulation products. But I noticed the other day the feature quietly snuck into our favorite Web-based simulator, Falstad.
Back in March, the main project added work from [Mark McGarry] to support AVR8js written by [Uri Shaked]. The end result is you can have the circuit simulator on the left of the screen and a Web-based Arduino IDE on the right side. But how does it work beyond the simple demo? We wanted to find out.
The screen looks promising. The familiar simulator is to the left and the Arduino IDE — sort of — is to the right. There’s serial output under the source code, but it doesn’t scroll very well, so if you output a lot of serial data, it is hard to read.
Circuit simulations are great because you can experiment with circuits and make changes with almost no effort. In Circuit VR, we look at circuits using a simulator to do experiments without having to heat up a soldering iron or turn on a bench supply. This time, we are going to take a bite of a big topic: op amps.
The op amp — short for operational amplifier — is a packaged differential amplifier. The ideal op amp — which we can’t get — has infinite gain and infinite input impedance. While we can’t get that in real life, modern devices are good enough that we can pretend like it is true most of the time.
If you open this circuit in the Falstad simulator, you’ll see two sliders to the right where you can tweak the input voltage. If you make the voltages the same, the output will be zero volts. You might think that a difference amplifier would take inputs of 1.6V and 2.4V and either produce 0.8V or -0.8V, but that’s not true. Try it. Depending on which input you set to 2.4V, you’ll get either 15V or -15V on the output. That’s the infinite gain. Any positive or negative output voltage will quickly “hit the rail” or the supply voltage which, in this case, is +/-15V.
The biggest omitted detail in the schematic symbol above is that there’s no power supply here, but you can guess that it is +/- 15V. Op amps usually have two supplies, a positive and a negative and while they don’t have to be the same magnitude, they often are. Some op amps are specifically made to work with a single-ended supply so their negative supply can connect to ground. Of course, that presupposes that you don’t need a negative voltage output.
The amount of time it takes the output to switch is the slew rate and you’ll usually find this number on the device datasheet. Obviously, for high-speed applications, a fast slew rate is important, particularly if you want to use the circuit as a comparator as we are here.
Other practical problems arise because the op amp isn’t really perfect. A real op amp would not hit the 15V rail exactly. It will get close depending on how much current you draw from the output. The higher the current, the further away from the rails you get. Op amps will also have some offset that will prevent it from hitting zero when the inputs are equal, although on modern devices that can be very low. Some older devices or those used in high-precision designs will have a terminal to allow you to trim the zero point exactly using an external resistor.
Op Amps Can Provide Steady Voltage Under Variable Load
Rather than dig through a lot of math, you can deal with nearly all op amp circuits if you remember two simple rules:
The inputs of the op amp don’t connect to anything internally.
The output mysteriously will do what it can to make the inputs equal, as far as it is physically possible.
That second rule will make more sense in a minute, but we already see it in action. Set the simulator so the – input (the inverting input) is at 0V and the noninverting input (+) is at 4V. The output should be 15V. The output is trying to make the inverting input match the noninverting one, but it can’t because there is no connection. The output would like to provide an infinite amount of voltage, but it can only go up to the rail which is 15V.
We can exploit this to make a pretty good x1 amplifier by simply shorting the output to the – terminal. Remember, our rules say the input terminals appear to not connect to anything, so it can’t hurt. Now the amplifier will output whatever voltage we put into it:
You might wonder why this would be interesting. Well, we will learn how to increase the gain, but you actually see this circuit often enough because the input impedance is very high (infinite in theory, but not practice). And the output impedance is very low which means you can draw more current without disturbing the output voltage much.
This circuit demonstrates the power of a 1x amplifier. Both voltage dividers produce 2.5V with no load. However, with a 100 ohm load at the output, the voltage divider can only provide around 400mV. You’d have to account for the loading in the voltage divider design and if the load was variable, it wouldn’t be possible to pick a single resistor that worked in all cases. However, the top divider feeds the high impedance input of the op amp which then provides a “stiff” 2.5V to whatever load you provide. As an example, try changing the load resistors from 100 ohms to different values. The bottom load voltage will swing wildly, but the top one will stay at 2.5V.
Don’t forget there are practical limits that won’t hold up in real life. For example, you could set the load resistance to 0.1 ohms. The simulator will dutifully show the op amp sourcing 25A of current through the load. Your garden-variety op amp won’t be able to do that, nor are you likely to have the power supply to support it if it did.
What’s Being Amplified?
This is an amplifier even though the voltage stayed the same. You are amplifying current and, thus, power. Disconnect the bottom voltage divider (just delete the long wire) and you’ll see that the 5V supply is providing 12.5 mW of power. The output power is 62.5 mW and, of course, varies with the load resistor.
Notice how this circuit fits the second rule, though. When the input changes, the op amp makes its output equal because that’s what makes the + and – terminals stay at the same voltage.
Of course, we usually want a higher voltage when we amplify. We can do that by building a voltage divider in the feedback loop. If we put a 1:2 voltage divider in the loop, the output will have to double to match the input and, as long as that’s physically possible, that’s what it will do. Obviously, if you put in 12V it won’t be able to produce 24V on a 15V supply, so be reasonable.
This type of configuration is called a non-inverting amplifier because, unlike an inverting amplifier, an increase in the input voltage causes an increase in the output voltage and a decrease in input causes the output to follow.
Note that the feedback voltage divider isn’t drawn like a divider, but that’s just moving symbols on paper. It is still a voltage divider just like in the earlier example. Can you figure the voltage gain of the stage? The voltage divider ratio is 1:3 and, sure enough, a 5V peak on input turns into a 15V peak on the output, so the gain is 3. Try changing the divider to different ratios.
While it isn’t mathematically rigorous, thinking of the op amp as a machine that makes its inputs equal is surprisingly effective. It certainly made the analysis of these simple circuits, the comparator, the buffer amplifier, and a general non-inverting amplifier simple.
There are, of course, many other types of amplifiers, as well as other reasons to use op amps such as oscillators, filters, and other even more exotic circuits. We’ll talk about some of them next time and the idea of a virtual ground, which is another helpful analysis rule of thumb.
In the fantasy world of schematic diagrams, wires have no resistance and square waves have infinitely sharp rise times. The real world, of course, is much crueler. There are many things you can use to help tame the wild analog world into the digital realm. Switches need debouncing, signals need limiting, and you might even need a filter. One of the basic elements you might use is a Schmitt trigger. In
In this installment of Circuit VR, I’m looking inside practical circuits by building Schmitt triggers in the Falstad circuit simulator. You can click the links and get to a live simulation of the circuit so you can do your own experiments and virtual measurements.
Why Schmitt Triggers?
You usually use a Schmitt trigger to convert a noisy signal into a clean square digital logic level. Any sort of logic gate has a threshold. For a 5V part, the threshold might be that anything under 2.5V is a zero and at 2.5V or above, the signal counts as a one. Some logic families define other thresholds and may have areas where the signal is undefined, possibly causing unpredictable outputs.
There are myriad problems with the threshold, of course. Two parts might not have exactly the same threshold. The threshold might vary a bit for temperature or other factors. For parts with no forbidden zone, what happens if the voltage is right at the edge of the threshold?
I find that if I’m trying to make a point with a student or a colleague about a circuit, sometimes the Falstad online simulator is worth a few thousand words. You can draw the circuit, play with the values, and even see the current flow in an intuitive way as well as make traditional measurements. The simulator not only handles analog but also digital circuits. At first glance, though, the digital functions appear limited, but if you dig deeper, there is a custom logic block that can really help. I dug into this — and into how switches work in the simulator — the other day in response to a Hackaday post. If you use Falstad, read on!