Using circuit simulating software like SPICE can be a powerful tool for modeling the behavior of a circuit in the real world. On the other hand, it’s not always necessary to have all of the features of SPICE available all the time, and these programs tend to be quite expensive as well. To that end, [Wes Hileman] noticed an opportunity for a specific, quick method for performing impedance calculations using python without bulky, expensive software and came up with a program which he calls fastZ.
The software works on any network of passive components (resistors, capacitors, and inductors) and the user can specify parallel and series connections using special operators. Not only can the program calculate the combined impedance but it can perform frequency analysis at a specified frequency or graph the frequency response over a wide range of frequencies. It’s also running in python which makes it as simple as importing any other python package, and is also easy to implement in any other python program compared to building a simulation and hoping for the best.
If you find yourself regularly drawing Bode plots or trying to cobble together a circuit simulation to work with your python code, this sort of solution is a great way to save a lot of headache. It is possible to get the a piece of software like SPICE to to work together with other python programs though, often with some pretty interesting results.
[Everett]’s 5-year-old loves a simple game called Hoot Owl Hoot! in which players cooperatively work to move owls along a track to the safety of a nest. Player pieces move on spaces according to the matching colors drawn from a deck of cards. If a space is already occupied, a piece may jump ahead to the next available spot. The game has a bit more to it than that, but those are the important parts. After a few games, the adults in the room found themselves disagreeing about which strategy was optimal in this simple game.
It seemed to [Everett] that it was best to move pieces in the rear, keeping player pieces grouped together and maximizing the chance of free moves gained by jumping over occupied spaces. [Everett]’s wife countered that a “longest move” strategy was best, and one should always select whichever piece would benefit the most (i.e. move the furthest distance) from any given move. Which approach wins games in the fewest moves? This small Python script simulates the game enough to iteratively determine that the two strategies are quite close in results, but the “longest move” strategy does ultimately come out on top.
As far as simulations go, it’s no Tamagotchi Singularity and [Everett] admits that the simulation isn’t a completely accurate one. But since its only purpose is to compare whether “no stragglers” or “longest move” wins in fewer moves, shortcuts like using random color generation in place of drawing the colors from a deck shouldn’t make a big difference. Or would it? Regardless, we can agree that board games can be fitting metaphors for the human condition.
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.
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:
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.
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.
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 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.
[Sebastian and Karl-Johan] are two award-winning Danish Space Architects who are subjecting themselves to harsh, seemingly uninhabitable conditions, for science. The pair set out to build a lunar base that could land with the manned Moon missions in 2024. Like any good engineering problem, what good is a solution without testing? So the pair have placed their habitat in a Moon Analogue habitat and are staying in their habitat for two months. They want to really feel the remoteness, the bitter cold, and the fatigue of actually being on the moon. So far they are about halfway through their journey and expect to return home in December 2020.
When asking themselves where on Earth is it most like the Moon, they came up with Moriusaq, Greenland. It’s cold, remote, in constant sunlight this time of year, and it is a vast white monochrome landscape just like the moon. The first moon settlement missions are expected to be at the South Pole of the Moon, as known as the Peak of Eternal Light. The habitat itself is a testament to the duo’s ingenuity. The whole structure folds to fit the tight space and weight requirements of rockets. Taking 2.9m3 (102 ft3) when stored, it expands 560% in volume to 17.2m3 (607 ft3). In Greenland, the structure needs to withstand -30ºC (-22ºF) and 90 km/h winds.
Because the South Pole is in constant sunlight, the temperature varies much less there than on the rest of the Moon, which makes Greenland a very good analogue temperature-wise. The foldable skin is covered in solar panels, both on the top of the bottom. The highly reflective nature of the Moon’s surface makes it easy to capture the light bouncing up onto the bottom of the habitat.
Several other bits of technology have been included onboard, like a 3D printer, a circadian light stimulation system, an algae reactor, and a weather simulation. Since both the Moon and Greenland are in constant sunlight, the pod helps regulate the circadian rhythms of the occupants by changing the hue and brightness throughout the day. The weather simulation tries to break up the monotony of space by introducing weather like a stormy day or rainbow colours.
Their expedition is still ongoing and they post daily mission updates. While some might call their foray into the unknown madness, we call it bold. Currently, NASA is planning its Artemis mission in 2024 and we hope that the lessons learning from the Lunark and other experiments culminate in a better experience for all astronauts.
Noise is a fact of life, especially in electronic circuits. But on our paper schematics and just as often our simulations, there is no noise. If you are blinking an LED on a breadboard, you probably don’t care. But if you are working on something meatier, handling electrical noise gracefully is important and simulation can help you. [Ignacio de Mendizábal] has a great piece on simulating EMC filters using LTSpice that can get you started.
There are many ways of classifying noise and [Ignacio] starts with common-mode versus differential noise, where common-mode is noise with current flowing in the same direction without regard to the circuit’s normal operation, and differential noise having currents that flow in the opposite direction of normal current flow.
Musicians have a fantastic language to describe signals. A sound can be fat, dark, crunchy, punchy — the list goes on. These aren’t very technical terms, but they get the job done. After all, it’s much easier to ask to guitarist for a crisper sound than to ask them to sharpen the edges of the waveform, while amplifying the high-frequency components and attenuating the low-frequency components. Of course, it’s fun to look at signals this way as well, especially when you can correlate shifts in sound quality to changes in the waveform and, ideally, the circuit that produces it.
To undergo such an investigation, [Nash Reilly] has been simulating guitar effects pedals in LTSpice. Able to find most of the schematics he needs online, [Nash] breaks down the function of each part of the circuit and builds a simulation of the entire system. His write-up clearly explains, and often demonstrates, what’s going on inside the box. On the surface, it’s an interesting tour of the inner workings of your favorite effects pedals. Beyond that, it’s an excellent survey of analog design that is well-worth the read for anybody interested in audio, electronics, or audio electronics.
For those interested in taking the physical route rather than the simulated one, we’ve taken a look at pedal design before. Anybody who wants to try their hand at creating simulations can grab a copy of LTSpice, or check out a package called LiveSpice, which lets you simulate circuits in realtime and use them to process live audio — pretty useful for prototyping guitar effects.
If you’re interested in SDR and digital signal processing but don’t know where to start, you’re in luck. Ben Hillburn, president of the GNU Radio Project, recently tweeted about an online curriculum for learning SDR and DSP using Python. The course was developed by Dr. Mark Lichtman, who was a lead on GNU Radio, and from the look of it, this is the place to go to learn about putting SDRs to use doing cool things. The course is chock full of animations that make the concepts clear, and explain what all the equations mean in a way that’s sure to appeal to practical learners.
It’s not much of a secret that the Hackaday community loves clocks. We build clocks out of everything and anything, and any unique way of telling time is rightly applauded and celebrated on our pages. But does the clock motif make a good basis for a video game? Perhaps not, but that didn’t stop Clock Simulator from becoming a thing. To “play” Clock Simulator, you advance the hands of an on-screen clock by pressing a button once per second. Now, thanks to Michael Dwyer, you don’t even have to do that one simple thing. He developed a hardware cheat for Clock Simulator that takes the 1PPS output from a GPS module and wires it into a mouse. The pulse stream clicks the mouse once per second with atomic precision, rendering the player irrelevant and making the whole thing even more pointless. Or perhaps that is the point.
Maybe we were a little hard on Clock Simulator, though — we can see how it would help achieve a Zen-like state with its requirement for steady rhythm, at least when not cheating. Another source of Zen for some is watching precision machining, and more precise, the better. We ran into this mesmerizing video of a CNC micro-coil winder and found it fascinating to watch, despite the vertical format. The winder is built from a CNC lathe, to the carriage of which a wire dispenser and tensioning attachment have been added. The wire is hair-fine and passes through a ruby nozzle with a 0.6 mm bore, and LinuxCNC controls the tiny back and forth motion of the wire as it winds onto the form. We don’t know what the coil will be used for, but we respect the precision of winding something smaller than a matchhead.
Dave Jones over at EEVblog posted a teardown video this week that goes to a place few of us have ever seen: inside a processor module for an IBM System/390 server. These servers earned the name “Big Iron” for a reason, as everything about them was engineered to perform. The processor module Dave found in his mailbag was worth $250,000 in 1991, and from the look of it was worth every penny. From the 64-layer ceramic substrate supporting up to 121 individual dies to the stout oil-filled aluminum enclosure, everything about this module is impressive. We were particularly intrigued by the spring-loaded copper pistons used to transfer heat away from each die; the 2,772 pins on the other side were pretty neat too.
Here’s an interesting question: what happens if an earthquake occurs in the middle of a 3D printing run? It’s probably not something you’ve given much thought, but it’s something that regular reader Marius Taciuc experienced recently. As he relates, the magnitude 6.7 quake that struck near Kainatu in Papua New Guinea (later adjusted to a 6.3 magnitude) resulted in a solid 15 seconds of shaking at his location, where he was printing a part on his modified Mendel/Prusa i2. The shaking showed up clearly in the part as the machine started swaying with the room. It’s probably not a practical way to make a seismograph, but it’s still an interesting artifact.