Preface to the Second Edition
This edition of Learning the Art of Electronics makes some changes that reflect what we have learned about the way the book has been used since its publication in 2016.
The most important changes are two.
- In our own course, we have begun experimenting with a change that we had resisted for the first few decades of the course: separating, into separate terms, the analog and digital halves of the course.
- In the digital half of the course, we have substituted an ARM microcontroller board for the two-path 8051 microcontroller labs of the first edition of LAoE. In addition, FPGA exercises replace the PLDs of the first edition (which we here will call “LAoE_1″).
The more relaxed pace relieves our sense that we were overdoing the hurry. (We recall the old saw, “We should cover less, uncover more.”) The two-term format allows us time to add some new labs.
LAoE_1 envisioned assigning one chapter for each day of the course. This second edition relaxes this expectation: more than one day will be used for nearly every chapter.
The eased pace allows us to pause to discuss and build some circuits that are mentioned but not demonstrated in LAoE_1. For example, on Day One we propose exploring the details of DVM behavior. In Lab 3, we try out a variety of diodes, and show ways to use an oscilloscope to display their behavior. Midway in the operational-amplifier section of the course, we pause to try applying a junction field-effect transistor (JFET), a device we excluded from LAoE_1, though LAoE_1 does use FETs (MOSFETs) as switches.
Analog Additions
We add three labs that ask construction of relatively complex circuits:
- Instrumentation amplifier: this is a special case of an op-amp-based differential amplifier, and thus appears midway in the op-amp section of the book. The designs begin with circuits based literally on operational amplifiers, but then ask you to try two integrated versions of the amplifier, including one that relies on translation into the digital domain. That exercise relies on an Arduino microcontroller. A course (or solo hobbyist!) choosing not to bring in a digital process so early in the course can simply omit the Arduino application.
- Lock-in Amplifier: this method for extracting information from a noisy environment we apply with a home-brew circuit, not a commercial lock-in amp. This lab, too, is placed in the op-amp section of the course.
- Automatic Gain Control: this circuit, a relatively-complex negative feedback loop, requires introducing the JFET (junction field-effect transistor), the FET type omitted from the first edition.
Digital Additions and Changes
Programmable Logic Additions
In LAoE_1 we used a PAL (Programmable Array Logic) to replace discrete devices in the Big Board microcomputer. In this edition, programmable logic, in the form of a Field Programmable Gate Array (FPGA), assumes equal standing with discrete logic.
We use a small FPGA initially to replicate combinational logic, then to create sequential circuits including flip-flops, counters, shift registers, and finite state machines of increasing complexity. In general, we first look at a standard discrete logic device like a gate or counter, then replicate its function in the FPGA.
The digital portion of the course ends with a greatly expanded Digital Project Lab, using the FPGA to drive a multiplexed four-digit LED display and then using that display to build a full, working system of your own design. Suggested projects include a digital clock, a capacitance meter, a digital voltmeter, and a hotel safe, but any design that can make use of the numerical output of the display is possible.
Microcontroller Additions
With the exception of the introduction to Chapter 22N reviewing computer history and introducing microcontrollers, the six chapters dedicated to embedded processing in this edition are entirely new. We’ve bid a fond farewell to our 1980’s Intel 8-bit 8051 microcontroller, assembly language, and crude development tools to move into the modern age of RISC processors.
Our microcontroller labs now develop code for the 32-bit ARM Cortex-M0+ microcontroller using the C language and an Integrated Development Environment incorporating a hardware debugging tool that allows us to stop and peer into the controller innards whenever a voyeuristic impulse strikes us (which is usually when our program is not working correctly). We glory in the [almost] unlimited reach of 32-bit variables and the availability of thirteen general-purpose registers, each of which can be used as a data pointer register into memory.1
Of course with great power comes great complexity. Even the low-end ARM microcontroller we use is loaded with peripherals including timer/counters, analog comparators, DAC, ADCs, serial communications units, touch screen interfaces, and more, all with dozens of configuration registers compared to the paltry timer and UART controlled by a handful of registers in the 8051.
We start our journey with small ambition, to blink an LED (the “Hello World” of embedded development). Along the way we tackle the internal peripherals one at a time, scanning a keypad with port I/O commands for user input, using a DAC to output synthetic sine waves, adding a timer interrupt to create musical notes with little CPU intervention, and programming the serial interface to output text on an LCD display. By the last lab, we will have built an entire application, a jukebox that plays children’s lullabies using a Real Time Operating System (RTOS), which enables us to reuse the code developed in the previous labs as as set of separate tasks interacting through inter-task mailboxes and events.
Structural Innovations
Online Content
Alas, with the additional content in the second edition, the book is close to reaching a size that can no longer be printed in a single volume. Rather than forcing you to buy two books (and perhaps saving a few readers from a painful hernia), we have moved some less-used content online to a new website, https://LAoE.link/Online_Chapters.html
The online chapter numbers are included in the Table of Contents with an “O” suffix but you will not find them in the book, you will need to visit the website. However, only optional or rarely used material has been moved online. For example, Chapter 22O, which describes alternatives to the SparkFun SAMD21 Mini breakout we use in the microcontroller labs, is unlikely to be needed more than once, if at all.
Similarly, moving the second half of the previous Chapter 26N online (now renamed to Chapter 28O) allows us to add to keep the list of interesting Sensors, Actuators, and Gadgets up to date without burdening your book with extra pages.
Maintainable Hyperlinks
We often, particularly in the new microcontroller material, need to point you to web references that are not our own. Unfortunately, the permanency of print does not coexist well with the ephemeral Internet. Law professor Jonathan Zittrain analyzed 2 million links at nytimes.com and found that 25% of them no longer pointed to the original content (what he coins “link rot”). Our solution is to direct you to a link we create prefaced with https://LAoE.link/ which then redirects you to the actual reference.
For example, the statistic above comes from Prof. Zittrain’s article The Internet is Rotting in The Atlantic available at https://www.theatlantic.com/technology/archive/2021/06/the-internet-is-a-collective-hallucination/619320/. At the time of this edition’s publication, our link https://LAoE.link/Link_Rot.html pointed to this same page. But should this article move or become unavailable, we will update our link to point to its new location or, at worst, a similar reference.
Should you be concerned about typing a link into your browser that leads to you-know-not-where (or you just object to typing in links in general) you can go to our link redirect web site by typing a single URL, https://LAoE.link/, and scrolling to the bottom of the home page. There you will find a list of our links and the sites they redirect to, organized by book chapter. You can then just click on the link directly with no additional typing.
We rely on you, dear reader, to let us know when a link is broken. Please email us at BadLink@LAoE.link with the page number and link that does not appear to work and we will endeavor to correct it.
Thanks where thanks are due
Finally, we would like to acknowledge the friends and colleagues who have generously given their time to making sure the new material in this edition not only is correct, but that the lab exercises work as expected. Thanks to Harvard Preceptor Kathryn Ledbetter for testing the FPGA labs without preconceptions – her comments and criticisms were invaluable in helping us make confusing content clearer. Thanks also to University of Maryland Professor Sarah Eno, whose beta testing of the new microcontroller material ensured smoother sailing for you, our readers, in completing those labs. Finally, we once again are indebted to Jim MacArthur, whose extensive knowledge and experience in all things electronic not only caught many of our errors in the content but whose suggestions led to much clearer explanations overall as well. As always, any remaining errors are our own. If you bring them to our attention, we will endeavor to correct them in a future edition. Contact us at authors@LAoE.link.
Tom Hayes
David Abrams
February 2024
- Those of you who struggled with the limited range of 8-bit registers and the single DPTR register in the 8051 should be shouting for joy about now.↩︎