Circuit VR: Some Op Amps

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.

Op-amp schematic symbol
a very simple op amp circuit with some detail omitted

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.

Practical Concerns

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:

  1. The inputs of the op amp don’t connect to anything internally.
  2. The output mysteriously will do what it can to make the inputs equal, as far as it is physically possible.
Op amp with inverting input connected to output
1x amplifier

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.

Voltage divider with and without 1x amplifier
Comparing voltage divider performance with and without a 1x amplifier

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.

Non-inverting opamp circuit
Non-inverting amplifier example

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.

What’s Next?

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.

Hackaday Podcast 099: Our Hundredth Episode! Denture Synth, OLED Keycaps, And SNES Raytracing

Hackaday editors Mike Szczys and Elliot Williams celebrate the 100th episode! It’s been a pleasure to marvel each week at the achievements of awesome people and this is no different. This week there’s a spinning POV display that solves pixel density and clock speed in very interesting ways. A macro keyboard made of OLED screens gives us a “do want” moment. And you can run a Raspberry Pi photo frame by sipping power from ambient light if you use the right power-tending setup. We wrap up the last episode of 2020 with a dive into ballpoint pens and solar racers.

Take a look at the links below if you want to follow along, and as always, tell us what you think about this episode in the comments!

Direct download (~65 MB)

Places to follow Hackaday podcasts:

Continue reading “Hackaday Podcast 099: Our Hundredth Episode! Denture Synth, OLED Keycaps, And SNES Raytracing”

Ringing In The Holidays With Self-Playing Chimes

The holiday season is here, and along with it comes Christmas music. Love them or hate them, Yuletide tunes are a simple fact of life each December. This year, [Derek Anderson] put a modern spin on a few classic melodies and listened to them via his set of self-playing chimes.

Inspired by [Derek]’s childhood Ye Merry Minstrel Caroling Christmas Bells (video), these chimes really bring the old-school Christmas decoration into the 21st century. Each chime is struck by a dedicated electromagnetically-actuated mallet, which is in turn controlled by an ESP32 running MicroPython.

Winding the electromagnets

The chimes play MIDI files, so you could, of course, play music unrelated to Christmas if you wanted to. And they even feature an OLED screen that displays what song is being played. For added flair, the entire thing is beautifully framed in black walnut, not to mention the custom-wound solenoids.

This project incorporated mechanical and electrical design, woodworking, 3D printing, programming, and song arrangement. It’s a wonder that [Derek] was able to create the entire product in the 40-80 hour time frame he estimated. (Though it looks like he had a bit of help.)

We always love to see projects like this, ones in which several disciplines get rolled together to create a beautiful finished piece.

 

Continue reading “Ringing In The Holidays With Self-Playing Chimes”

How The Gates (Almost) Stole Christmas

‘Twas the night before Christmas and all through the house
Blue screens were everywhere; no response from the mouse
Windows, it seems, had decided to die
Because it had updated; we didn’t know why
But Santa had a plan while we were all in bed
He reformatted our server and installed Linux instead
In the morning we rushed in and what did we see?
Programs were running, and most of them free!
There was Chrome and Open Office and emacs for me
Not a penny was going to Mr. Gates’ fee
Now we have no more blue screens, ever, of course
Because Santa turned us on to that sweet open source

We Would Not Want To Be Stormtroopers Right Now

Humanity is another step closer to a fantasy-accurate lightsaber thanks to Hackaday alumnus [James Hobson] at Hacksmith. Their proto-saber cuts through (cosplay) stormtrooper armor, (foam) walls, and a (legit!) 1/4″ (6.35mm) steel plate. For so many reasons, we want to focus on the blade and handle. (Video, embedded below.)

The blade is a plasma stream designed for glassworking and burns a propane/oxygen mix with almost no residue, but the “blade” stays in a tight cylinder shape. With a custom PCB hosting a mixing controller, the blade extends and retracts like in the movies. The handle is not a technical marvel; it is an artistic wonder and if you want to see some machining eye-candy, check out the first video after the break. The second video demonstrates just how much damage you can do with a 4000° Fahrenheit tube of portable plasma.

You won’t be dueling anyone just yet, since there is no magnetic field shaping the blade like the ones [Lucas] envisioned. Unfortunately, you can’t block anything more substantial than a balloon sword since solid material will pass right through it, but it will suffer a mighty burn in the process. Lightsabers are a fantasy weapon, but the collective passion of nerds have made it as real as ever, and the Guinness folks give credibility to this build.

Continue reading “We Would Not Want To Be Stormtroopers Right Now”

Hello, Holograms

Holograms are tricky to describe because science-fiction gives the name to any three-dimensional image. The science-fact versions are not as flashy, but they are still darn cool. Legitimate holograms are images stored on a photographic medium, and they retain a picture of the subject from certain angles. In other words, when [Justin Atkin] makes a hologram of a model building, (video, embedded below) you can see the east side of the belfry, but when you reorient, you see the west side, or the roof if you point down. Holography is different from stereoscopy, which shows you a 3D image using two cameras. With a stereoscopic image, you cannot tilt it and see a new part of the subject, so there is a niche for each method.

There are a couple of different methods for making a hologram at home. First, you probably want a DIY hologram kit since it will come with the exposure plate and a known-good light source. Far be it for us to tell you you can’t buy plates and a laser pointer to take the path less traveled. Next, you need something that will not move, so we’re afraid you cannot immortalize your rambunctious kitty. The last necessity is a stable platform since you will perform a long-exposure shot, and even breathing on the setup can ruin the image. Different colors come from the coherent light source, so getting the “Rainbow Holograms” advertised in the video is a matter of mixing lights. Since you can buy red, green, and blue laser pointers for a pittance, you can do color remixes to your content.

Another type of hologram appears on things like trading cards as those wildly off-color (chromatic, not distasteful) images of super-heroes or abstract shapes. They’re a different variety, which can be printed en-masse, unlike the one-off [Justin] shows us how to make.

If you’re yearning for volumetric displays, we are happy to point you to this beauty capable of showing a jaw-dropping 3D model or this full-color blocky duck.

Continue reading “Hello, Holograms”

4-bit Retrocomputer Emulator Gets Custom PCB

It might be fair to suspect that most people who are considered digital natives have very little to no clue about what is actually going on inside their smartphones, tablets, and computers. To be fair, it is not easy to understand how modern CPUs work but this was different at the beginning of the 80s when personal computers just started to become popular. People who grew up back then might have a much better understanding of computer basics thanks to computer education systems. The Busch 2090 Microtronic Computer System released in 1981 in Germany was one of these devices teaching people the basics of programming and machine language. It was also [Michael Wessel]’s first computer and even though he is still in proud possession of the original he just recently recreated it using an Arduino.

The original Microtronic was sold under the catchy slogan “Hobby of the future which has already begun!” Of course, the specs of the 4-bit, 500 kHz TMS 1600 inside the Microtronic seem laughable compared to modern microcontrollers, but it did run a virtual environment that taught more than the native assembly. He points out though that the instruction manual was exceptionally well written and is still highly effective in teaching students the basics of computer programming.

Already, a couple of years back he wrote an Arduino-based Microtronic emulator. In his new project, he got around to extending the functionality and creating a custom PCB for the device. The whole thing is based on ATMega 2560 Pro Mini including an SD card module for file storage, an LCD display, and a whole bunch of pushbuttons. He also added an RTC module and a speaker to recreate some of the original functions like programming a digital clock or composing melodies. The device can also serve as an emulator of the cassette interface of the original Microtronic that allowed to save programs with a whopping data rate of 14 baud.

He has certainly done a great job of preserving this beautiful piece of retro-tech for the future. Instead of an Arduino, retro computers can also be emulated on an FPGA or just take the original hardware and extend it with a Raspberry Pi.