Sideband #75: Electronic Shortcuts

My notes don’t include what triggered the thought, but I think it was something in one of the Lee Smolin books I read recently. My recent post, Analog Computing, brought the idea to mind again, because analog computers often use op amps. I was reminded yet again while reading about SPADs.

I’m talking about the very useful rules of thumb (heuristics) I learned to help understand, even design, electronic circuitry. They’re shortcuts in the sense of being only approximately true, but their simplified view can make a circuit much easier to understand.

I thought I’d pass them on for those interested in electronic design.

These tips are extremely niche and, because I’ve had them for ages, seem somehow very ordinary and obvious to me now. But my Abacus and Slide Rule post, which I also thought very niche yet obvious, has become my third most popular post this year. I thought maybe those interested in learning electronics might appreciate these tips. I’ll try to make it interesting for everyone.

The op amp shortcut behind this post may be the most complicated of the bunch, so I’ll save it for last. I’ll start with some basics (warning: this is a long post)…

§ §

Pipes with water flowing are a good analogy for an electric circuit. To make the analogy accurate, the water must flow in a closed path, a circuit. We also require a source — a tank with a pump that pushes water through the circuit and back to the tank. (A good example is the radiator system in a car.)

In the analogy, water pressure (say in pounds per square inch) is voltage, and the amount of water flowing through a given pipe (say in gallons per second) is the current. Voltage and current are two fundamental electrical concepts. Voltage (in volts) is electrical pressure; current (in amperes) is the amount of electricity flowing.

These two are linked. Higher pressure (voltage) pushes more current (amps) through the same pipe.

This entails a third fundamental concept: resistance. The diameter of a pipe affects how much water passes through it — a smaller diameter offers more resistance to the flow. Diameter also affects pressure — smaller means higher. Electrically, more resistance (in ohms) means less current and/or higher voltage.

§

These three electrical properties are tied together in a famous equation known as Ohm’s law:

\displaystyle{E}={I}{R}

Where E (energy) is voltage (in volts), I (intensity) is current (in amps), and R is resistance (in ohms). Some use other letters, but this is how I learned it back in the day. This equation is the first shortcut. As a rough first approximation, any circuit boils down to voltage pushing current through resistance.

Given any two, we can always calculate the third. If we know the voltage and resistance of a circuit, we can calculate the current:

\displaystyle{I}=\frac{E}{R}

If we know the voltage and current, we can calculate resistance:

\displaystyle{R}=\frac{E}{I}

A second equation, Watt’s law, ties voltage and current to wattage (“power” is a derived notion associated with work done):

\displaystyle{P}={I}{E}

Where P (in watts) is the power. (The PIE makes this one easy to remember.)

§

Let’s apply these formulae to a 60-watt lightbulb given we know the standard USA house voltage is (nominally) 120 volts:

\displaystyle\frac{60\;\mathrm{watts}}{120\;\mathrm{volts}}={0.5\;\mathrm{amps}}

A 60-watt bulb draws 0.5 amps of current. Now we can calculate its resistance:

\displaystyle\frac{120\;\mathrm{volts}}{0.5\;\mathrm{amps}}={240\;\mathrm{ohms}}

A 60-watt bulb has 240 ohms of resistance (which is why it draws 0.5 amps and uses 60 watts of power).

§

So the water pipes as electronics analogy is:

  • wires = pipes
  • circuit = closed loops of pipes
  • voltage (volts) = water pressure
  • current (amps) = amount of water
  • power (watts) = work done = volts × amps
  • battery or power source = water tank and pump

That last one is the source of the voltage and current. These pieces on their own allow something akin to the radiator system in a car. Water, pressurized by a pump, flows from the radiator, through the engine cooling lines, and back to the radiator. An electrical circuit, rather than cooling an engine, might instead light a lightbulb or drive a heating element, but the network topology is similar.

Generally, of course, electronic circuits are much more complicated, but broken down into small pieces, the above is basically the deal.

§ §

BTW: Being not “grounded” allows safe contact with electrical systems because of the incomplete circuit. When isolated electrically, there is no path for the current to follow, so no electricity flows through you regardless of the voltage.

In contrast, being “grounded” means an electrical object should be safe because if a short energizes the object, current flows to ground (probably tripping a breaker or fuse).

Basically, things should be grounded, but you shouldn’t be.

The “ground” here literally refers to the ground, the Earth, which is considered to be a zero-voltage reference point. Building a crystal radio requires a good ground, which involves driving a pipe into the ground. Or just attaching to the water mains that comes into your house from the ground.

(Voltage can be tricky in that, as with energy in general, all that matters is the difference in voltage between two points. One-million volts is perfectly safe if one has a potential of one-million-and-one volts, because the difference is only one volt.)

§ §

Doing something useful with an electronic circuit requires more than amps flowing through wires. Even the lightbulb or heater already mentioned involve a bit more than a power source and wires.

Figure 1. A battery and resistor in a circuit.

Old-fashioned lightbulbs and electrical heaters are special instances of an electrical circuit component called a resistor. I mentioned resistance above. Other than superconductors, everything current flows through has resistance. (The big deal about superconductors is they don’t.)

Resistors are components with a specific amount of resistance (in ohms) — typically large amounts compared to wire. They can vary in value from single-digits (even fractions) to millions of ohms.

The heuristic for resistors is simply Ohm’s law. The current (I) depends on the voltage (E) and resistance (R). The power (as heat) a resistor dissipates depends on voltage and current.

The battery is 1.5 volts, the resistor is 5,600 ohms, so about 268 microamps of current flow through the resistor. That’s about 402 microwatts of power. (We know the first two because the battery is labeled, and the resistor is color-coded. We calculate the last two.)

Figure 2. Schematic version of battery and resistor circuit.

If, in some other circuit, we measure 1 milliamp flowing through that resistor, we’d know it has 5.6 volts across it and is dissipating 5.6 milliwatts.

Lightbulbs and heaters are low-resistance devices that draw a lot of current and therefore consume a lot of power. (The lightbulb had only 240 ohms across 120 volts.) That power goes to creating light and/or heat.

In electronics, however, resistors act as valves to control the flow of current. Any heat generated (let alone light!) is usually considered a problem. (Such problems are often announced by a burning smell.)

Resistors have a power rating — the one shown in Figure 1 has a maximum rating of 250 milliwatts, which is common. Currents (and the voltages driving them) must be kept low enough to not burn out the resistor (in electronic gear low voltages are common, so this isn’t normally an issue).

§ §

In the Analog Computing post I showed a simple example of a circuit that used resistors as valves to model basic physical phenomenon. That circuit also used capacitors:

Figure 3. A ladder circuit with resistors (R) and capacitors (C).

Schematically, they’re generically shown as two parallel lines, although fancier symbols indicate more specific types of capacitor. The parallel lines are as evocative as the jagged line for resistors. Capacitors are literal breaks in the circuit. They do not have a path for current through them!

Their value is twofold: Firstly, they can store voltage and current like tiny batteries. Secondly, changing voltage can push current through them. The faster the voltage changes, the more current can pass.

This second quality makes them a distinctive and fundamental component. They have a resistance that’s linked to frequency. As frequency increases, resistance decreases. It can become effectively zero. But when the frequency is zero the resistance is infinite and no current passes.

§

Capacitors have an opposite number, coils, where the resistance increases with frequency. They have nearly zero resistance when the frequency is zero (just the resistance of the wire itself).

Coils are formally known as inductorsinductance is the inverse of capacitance. Both are forms of reactance — resistance that depends on frequency.

Figure 4. Crystal radio.

Because coils and capacitors react to frequency oppositely, the combination of a capacitor and a coil, an LC circuit, form a “tuned circuit” that picks out a single frequency.

Most radios use some form of LC circuit to tune the desired station out of the mix of all detectable radio signals (AM, FM, CB, TV, Wi-Fi, Bluetooth, et plures alii).

In fact, as seen in Figure 4, the LC circuit is a large part of a crystal radio. The coil (L) and variable capacitor (C) have the highest mutual resistance at the frequency of the selected radio station. Their low resistance to other frequencies “shorts” other stations to ground.

The headphones bridge the circuit and thus “see” the voltage of that picked out station. (The diode (D) strips the high-frequency radio signal leaving the audio.)

§ §

Resistors, capacitors, and coils (oh, my), along with the wires to connect them and some source of voltage and current, comprise the vast bulk of passive electronics. As the crystal radio and many other circuits demonstrate, much can be done with electronics that, metaphorically speaking, coast downhill.

Electronics gets a lot more interesting with active components. They allow a design to go uphill. Logic circuits illustrate this. Passive components allow AND and OR gates, but a NOT gate requires an active component. Any inversion or amplification (and often just copying) requires active components.

Figure 5. An old transistor and its symbol.

Originally electronics used relays or vacuum tubes, but most electronics these days are based on transistors. All three are essentially electronic switches. They use an input signal to control a different output signal.

I don’t know how they teach it these days; in mine they spent a lot of time on the solid-state physics of transistors — energy bands, hole currents, and so forth. I spent years bashing my head against that wall.

Eventually I realized it’s all unnecessary. (Unless one plans to design transistors.) There is a simple model that makes them easy to work with.

Each transistor is one-half diode, so it’s important to understand about diodes. (Refer to the diode, D, above in Figure 4.) Firstly, their general function: they are one-way valves; current only flows one way through a diode.

One of the great ironies and irritations of electronics design is that the damned arrow points the wrong way. You’d think current would flow the direction the triangle is pointing. That would make things ever so logical. But due to historical confusion, we’re stuck with current flowing against the arrow.

Figure 6. An NPN transistor.

Figure 6 shows the transistor diagram again, this time with the three leads labeled E (emitter), B (base), and C (collector). (The names are evocative.)

The direction the emitter arrow backwardly points tells us this is an NPN transistor. The sister type, PNP, functions identically, but current polarity is reversed. Its arrow points the other way.

Functionally and conceptually, current flows into the transistor from the emitter and out the other two leads. Most of the current flows out the collector (hence its name). A relatively small amount flows out the base, but that base current controls the transistor.

If base current is zero, the transistor is off, and no collector current flows. As base current increases, so does collector current (which is much greater). At some point the transistor (harmlessly) “saturates” and is fully on. Maximum collector current flows.

Figure 7.

The design heuristic is to see the transistor as a coupled diode and variable resistor, as shown in Figure 7.

Now we come to the other thing about diodes. In the forward direction (against the arrow), they have no resistance. In the reverse direction they have infinite resistance (ideally speaking).

The big caveat for design is that in the forward direction, under normal conditions, a diode always drops a specific voltage across itself. That voltage differs depending on the device type; it can be as low as 0.3 volts and as high as 1.7 or more. As a rule, I use 0.7 volts.

Figure 7 makes the diode half apparent. Current flows from the emitter to the base. Always treat that EB path as a diode. Current flow depends on the other parts of the circuit. Just factor in that B is always ~0.7 volts higher than E because of the drop across the diode.

Current flow through the diode controls the much larger current flow in the EC path. Effectively that half acts like a variable resistor controlled by the base current. Sufficient base current reduces the resistance to zero. Zero base current increases it to infinity (the transistor is “off”).

§

So that’s transistors, at least the old-fashioned kind. You have no idea how much I wish someone had explained this to me way back in high school. Three simple rules:

  1. Base current controls collector current.
  2. The emitter-base half is just a diode.
  3. Base is always ~0.7 volts upstream from the emitter.

It does get more complicated in practice, of course. I may dig into transistor design a bit more in another post. There’s a lot more to be said.

§ §

Figure 8. FETs

Most modern transistors are field-effect transistors of one kind or another. The main thing about an FET is that the base isn’t electrically connected to anything. There is also a different terminology: the emittercollector path is renamed sourcedrain, and the base is renamed gate.

The voltage on the gate, through its electric field, controls the current from source to drain. This makes FETs voltage-based devices rather than current-controlled like regular transistors. They’re far more economical because far less current flows.

The heuristic here is simple. It’s the same as with a triode tube. The gate effectively has infinite input resistance, so no current flows through it. What matters is the voltage other circuitry presents to the gate.

FETs also have the two “polarity” types, both shown in Figure 8. There is an “N-channel” version (top) and a “P-channel” version (bottom). The arrow indicates the type.

§ §

Figure 9. Op amp.

Finally, at long last, the op amp! The notion of infinite gate impedance in an FET is a good segue for one of the three rules about op amps.

But first, an operational amplifier is a differential amplifier. It has two inputs, and it amplifies the difference between them. Figure 9 shows the schematic (physically they’re just small chips). The two inputs are on the left, the output is on the right.

There is a more elaborate diagram at the top of this post. That one labels the leads and shows the power connections. It points out an important point: op amps require positive and negative power supplies. Most electronic gear only requires a positive supply. Op amps require both to process positive-negative going inputs.

The secret to op amps is three idealized rules (also listed at the top of the post). An op amp:

  1. Has infinite gain.
  2. Has infinite input impedance
  3. Has zero output impedance

The first characteristic means an op amp tries to amplify even the tiniest difference between its inputs to infinite output. That’s obviously impossible, so the output will be the maximum allowed by the power supply. As with transistors, amplification (harmlessly) “clips” beyond that max. The output simply can’t be any higher.

The upshot is the op amp circuits are designed to keep the inputs almost exactly the same. Feedback mechanisms ensure the balance, and the huge gain of the op amp keeps it stable. It’s this first characteristic that makes these easy to understand.

The second characteristic, same as with FETs, means no current flows into the device, so there’s no load on input circuitry. Whatever signal these devices “listen” to, it doesn’t need to supply any power.

The third characteristic means the op amp can maintain its output voltage regardless of any (reasonable) output current. This effectively means that if an op amp decides its output is 3.3 volts, that will be the voltage at the output under any reasonable load.

§ §

At this point, believe it or not, based on the information in this post, you should be able to make at least some sense of this schematic:

Figure 10. Putting it all together.

A couple of helpful hints: It’s an amplifier; it takes an input signal on the left and amplifies it, presenting a low output impedance signal on the right. The “water tank and its pump” are out of sight; the V+ is the incoming supply, and the ground is the return. As far as the circuit doing work, the water flows from top to bottom. The signal flows from left to right.

Give it a shot. When I pick this up, I’ll explain it, and others, in what I hope will be understandable fashion. This post is long enough for now!

§ §

My favorite electronics joke: Did you hear about the guy who soldered a resistor onto his stove? He wanted an Ohm on the Range.

Two very similar electron jokes: [1] An electron and a positron are in a bar having drinks. The positron says, “Your round.” The electron asks, “Are you sure?” The positron replies, “I’m positive!” (Funny also because electrons are extraordinarily round.) [2] Two atoms are sitting in a bar having drinks. One says, “Damn! I just lost an electron!” The other asks, “Are you sure?” The first one replies, “I’m positive!”

There is also the one about why are electrons always depressed? Because they’re always so negative.

I’m not sure any of these jokes are current…

Stay positive, my friends! Go forth and spread beauty and light.


About Wyrd Smythe

The canonical fool on the hill watching the sunset and the rotation of the planet and thinking what he imagines are large thoughts. View all posts by Wyrd Smythe

5 responses to “Sideband #75: Electronic Shortcuts

  • Wyrd Smythe

    A very long post, but I did warn that I intended to embrace my hardware roots…

  • Michael

    Wyrd, as a mechanical engineer I almost always use the piping analogy for circuits. It’s why I don’t get far electrically. Haha. The tricky one to make an analogy for is real vs reactive power, but those scrunchy garden hoses have come to my rescue in the last few years and provided the perfect mechanical analogy! All the pressure consumed to keep the hose taut is the VARs (reactive power) and the water that actually flows through it the real current.

    I eagerly await your post on 3-phase synchronous generator controls. 🙂

    • Michael

      And I didn’t say that very well… the current flowing through the hose multiplied by its pressure (voltage) and some square root of three somewhere for 3-phase power, gives the real power. Something like that. 😉

    • Wyrd Smythe

      Ha!! Well, all my hobby design work was with low-power, mostly DC, stuff (some audio). I never did much with high-power circuits or AC systems (especially RF systems, which always seemed to have an element of black magic to them). Even at low frequencies like 60-Hz, exactly as you’re referring to, things get interesting with reactive loads. Give me a nice easy-to-understand digital circuit any day! 😮

      As I think you’re pointing out here, the water pipe analogy struggles with frequency. Water systems generally don’t have a good analogue for frequency, let alone for coils or caps. (For instance, the water tank analogy works for how caps can store current and voltage, but not so much for their reactance to frequency. The scrunchy garden hose is a neat idea. I never did come up with an analogue for an inductor.)

      Nice of you to drop by on this one! These arcane topic posts usually don’t get any views, let alone comments.

And what do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: