## Voltage Drops Are Falling on My Head: Operating Points, Linearization, Temperature Coefficients, and Thermal Runaway

Today’s topic was originally going to be called “Small Changes Caused by Various Things”, because I couldn’t think of a better title. Then I changed the title. This one’s not much better, though. Sorry.

What I had in mind was the Shockley diode equation and some other vaguely related subjects.

My Teachers Lied to MeMy introductory circuits class in college included a section about diodes and transistors.

The ideal diode equation is...

## Important Programming Concepts (Even on Embedded Systems) Part V: State Machines

Other articles in this series:

- Part I: Idempotence
- Part II: Immutability
- Part III: Volatility
- Part IV: Singletons
- Part VI: Abstraction

Oh, hell, this article just had to be about state machines, didn’t it? State machines! Those damned little circles and arrows and q’s.

Yeah, I know you don’t like them. They bring back bad memories from University, those Mealy and Moore machines with their state transition tables, the ones you had to write up...

## Optimizing Optoisolators, and Other Stories of Making Do With Less

It’s been a few months since I’ve rolled up my sleeves here and dug into some good old circuit design issues. I started out with circuit design articles, and I’ve missed it.

Today’s topic will be showing you some tricks for how to get more performance out of an optoisolator. These devices — and I’m tempted to be lazy and call them “optos”, but that sounds more like a cereal with Greek yogurt-covered raisins — are essentially just an LED...

## Book Review: "Turing's Cathedral"

My library had Turing’s Cathedral: The Origins of the Digital Universe by George Dyson on its new acquisitions shelf, so I read it. I’d recommend the book to anyone interested in the history of computing.

Turing’s Cathedral primarly covers the period in early computing from 1940-1958, and bridges a gap between a few other popular books: on the historic side, between Richard Rhodes’s

## Important Programming Concepts (Even on Embedded Systems) Part IV: Singletons

Other articles in this series:

- Part I: Idempotence
- Part II: Immutability
- Part III: Volatility
- Part V: State Machines
- Part VI: Abstraction

Today’s topic is the singleton. This article is unique (pun intended) in that unlike the others in this series, I tried to figure out a word to use that would be a positive concept to encourage, as an alternative to singletons, but

## Second-Order Systems, Part I: Boing!!

I’ve already written about the unexciting (but useful) 1st-order system, and about slew-rate limiting. So now it’s time to cover second-order systems.

The most common second-order systems are RLC circuits and spring-mass-damper systems.

Spring-mass-damper systems are fairly common; you’ve seen these before, whether you realize it or not. One household example of these is the spring doorstop (BOING!!):

(For what it’s worth: the spring...

## The CRC Wild Goose Chase: PPP Does What?!?!?!

I got a bad feeling yesterday when I had to include reference information about a 16-bit CRC in a serial protocol document I was writing. And I knew it wasn’t going to end well.

The last time I looked into CRC algorithms was about five years ago. And the time before that… sometime back in 2004 or 2005? It seems like it comes up periodically, like the seventeen-year locust or sunspots or El Niño,...

## Important Programming Concepts (Even on Embedded Systems) Part III: Volatility

1vol·a·tile adjective \ˈvä-lə-təl, especially British -ˌtī(-ə)l\ : likely to change in a very sudden or extreme way : having or showing extreme or sudden changes of emotion : likely to become dangerous or out of control

— Merriam-Webster Online Dictionary

Other articles in this series:

## Slew Rate Limiters: Nonlinear and Proud of It!

I first learned about slew rate limits when I was in college. Usually the subject comes up when talking about the nonideal behavior of op-amps. In order for the op-amp output to swing up and down quickly, it has to charge up an internal capacitor with a transistor circuit that’s limited in its current capability. So the slew rate limit \( \frac{dV}{dt} = \frac{I_{\rm max}}{C} \). And as long as the amplitude and frequency aren’t too high, you won’t notice it. But try to...

## You Will Make Mistakes

</scorpion>: FAILAnyone out there see the TV pilot of Scorpion? Genius hacker squad meets Homeland Security in a fast-paced thriller to save hundreds of airplanes from crashing after LAX air traffic control software upgrade fails and they didn’t save a backup of the old version (ZOMG!!!) so thousands of people are going to die because the planes… well, they just can’t land! They just can’t. Even if the weather is sunny and calm and there could quite possibly...

## Linear Feedback Shift Registers for the Uninitiated, Part III: Multiplicative Inverse, and Blankinship's Algorithm

Last time we talked about basic arithmetic operations in the finite field \( GF(2)[x]/p(x) \) — addition, multiplication, raising to a power, shift-left and shift-right — as well as how to determine whether a polynomial \( p(x) \) is primitive. If a polynomial \( p(x) \) is primitive, it can be used to define an LFSR with coefficients that correspond to the 1 terms in \( p(x) \), that has maximal length of \( 2^N-1 \), covering all bit patterns except the all-zero...

## Linear Feedback Shift Registers for the Uninitiated, Part XII: Spread-Spectrum Fundamentals

Last time we looked at the use of LFSRs for pseudorandom number generation, or PRNG, and saw two things:

- the use of LFSR state for PRNG has undesirable serial correlation and frequency-domain properties
- the use of single bits of LFSR output has good frequency-domain properties, and its autocorrelation values are so close to zero that they are actually better than a statistically random bit stream

The unusually-good correlation properties...

## Ten Little Algorithms, Part 5: Quadratic Extremum Interpolation and Chandrupatla's Method

Other articles in this series:

- Part 1: Russian Peasant Multiplication
- Part 2: The Single-Pole Low-Pass Filter
- Part 3: Welford's Method (And Friends)
- Part 4: Topological Sort
- Part 6: Green’s Theorem and Swept-Area Detection

Today we will be drifting back into the topic of numerical methods, and look at an algorithm that takes in a series of discretely-sampled data points, and estimates the maximum value of...

## Padé Delay is Okay Today

This article is going to be somewhat different in that I’m not really writing it for the typical embedded systems engineer. Rather it’s kind of a specialized topic, so don’t be surprised if you get bored and move on to something else. That’s fine by me.

Anyway, let’s just jump ahead to the punchline. Here’s a numerical simulation of a step response to a \( p=126, q=130 \) Padé approximation of a time delay:

Impressed? Maybe you should be. This...

## Real-time clocks: Does anybody really know what time it is?

We recently started writing software to make use of a real-time clock IC, and found to our chagrin that the chip was missing a rather useful function, namely elapsed time in seconds since the standard epoch (January 1, 1970, midnight UTC).Let me back up a second.A real-time clock/calendar (RTC) is a micropower chip that has an oscillator on it that keeps counting time, independent of main system power. Usually this is done with a lithium battery that can power the RTC for years, so that even...

## Linear Feedback Shift Registers for the Uninitiated, Part VII: LFSR Implementations, Idiomatic C, and Compiler Explorer

The last four articles were on algorithms used to compute with finite fields and shift registers:

- multiplicative inverse
- discrete logarithm
- determining characteristic polynomial from the LFSR output

Today we’re going to come back down to earth and show how to implement LFSR updates on a microcontroller. We’ll also talk a little bit about something called “idiomatic C” and a neat online tool for experimenting with the C compiler.

## Linear Feedback Shift Registers for the Uninitiated, Part II: libgf2 and Primitive Polynomials

Last time, we looked at the basics of LFSRs and finite fields formed by the quotient ring \( GF(2)[x]/p(x) \).

LFSRs can be described by a list of binary coefficients, sometimes referred as the polynomial, since they correspond directly to the characteristic polynomial of the quotient ring.

Today we’re going to look at how to perform certain practical calculations in these finite fields. I maintain a Python library on bitbucket called...

## First-Order Systems: The Happy Family

Все счастли́вые се́мьи похо́жи друг на дру́га, ка́ждая несчастли́вая семья́ несчастли́ва по-сво́ему.— Лев Николаевич Толстой, Анна Каренина

Happy families are all alike; every unhappy family is unhappy in its own way.— Lev Nicholaevich Tolstoy, Anna Karenina

I was going to write an article about second-order systems, but then realized that it would be...

## How to Include MathJax Equations in SVG With Less Than 100 Lines of JavaScript!

Today’s short and tangential note is an account of how I dug myself out of Documentation Despair. I’ve been working on some block diagrams. You know, this sort of thing, to describe feedback control systems:

And I had a problem. How do I draw diagrams like this?

I don’t have Visio and I don’t like Visio. I used to like Visio. But then it got Microsofted.

I can use MATLAB and Simulink, which are great for drawing block diagrams. Normally you use them to create a...

## 10 Software Tools You Should Know

Unless you're designing small analog electronic circuits, it's pretty hard these days to get things done in embedded systems design without the help of computers. I thought I'd share a list of software tools that help me get my job done. Most of these are free or inexpensive. Most of them are also for working with software. If you never have to design, read, or edit any software, then you're one of a few people that won't benefit from reading this.

Disclaimer: the "best" software...

## You Will Make Mistakes

</scorpion>: FAILAnyone out there see the TV pilot of Scorpion? Genius hacker squad meets Homeland Security in a fast-paced thriller to save hundreds of airplanes from crashing after LAX air traffic control software upgrade fails and they didn’t save a backup of the old version (ZOMG!!!) so thousands of people are going to die because the planes… well, they just can’t land! They just can’t. Even if the weather is sunny and calm and there could quite possibly...

## Have You Ever Seen an Ideal Op-Amp?

Somewhere, along with unicorns and the Loch Ness Monster, lies a small colony of ideal op-amps. Op-amp is short for operational amplifier, and we start our education on them by learning about these mythical beasts, which have the following properties:

- Infinite gain
- Infinite input impedance
- Zero output impedance

And on top of it all, they will do whatever it takes to change their output in order to make their two inputs equal.

But they don't exist. Real op-amps have...

## Oscilloscope review: Hameg HMO2024

Last year I wrote about some of the key characteristics of oscilloscopes that are important to me for working with embedded microcontrollers. In that blog entry I rated the Agilent MSOX3024A 4-channel 16-digital-input oscilloscope highly.

Since then I have moved to a different career, and I am again on the lookout for an oscilloscope. I still consider the Agilent MSOX3024A the best choice for a...

## Slew Rate Limiters: Nonlinear and Proud of It!

I first learned about slew rate limits when I was in college. Usually the subject comes up when talking about the nonideal behavior of op-amps. In order for the op-amp output to swing up and down quickly, it has to charge up an internal capacitor with a transistor circuit that’s limited in its current capability. So the slew rate limit \( \frac{dV}{dt} = \frac{I_{\rm max}}{C} \). And as long as the amplitude and frequency aren’t too high, you won’t notice it. But try to...

## Stairway to Thévenin

This article was inspired by a recent post on reddit asking for help on Thévenin and Norton equivalent circuits.

(With apologies to Mr. Thévenin, the rest of the e's that follow will remain unaccented.)

I still remember my introductory circuits class on the subject, roughly as follows:

(NOTE: Do not get scared of what you see in the rest of this section. We're going to point out the traditional approach for teaching linear equivalent circuits first. If you have...

## Lessons Learned from Embedded Code Reviews (Including Some Surprises)

My software team recently finished a round of code reviews for some of our motor controller code. I learned a lot from the experience, most notably why you would want to have code reviews in the first place.

My background is originally from the medical device industry. In the United States, software in medical devices gets a lot of scrutiny from the Food and Drug Administration, and for good reason; it’s a place for complexity to hide latent bugs. (Can you say “

## Someday We’ll Find It, The Kelvin Connection

You’d think it wouldn’t be too hard to measure electrical resistance accurately. And it’s really not, at least according to wikiHow.com: you just follow these easy steps:

- Choose the item whose resistance you wish to measure.
- Plug the probes into the correct test sockets.
- Turn on the multimeter.
- Select the best testing range.
- Touch the multimeter probes to the item you wish to measure.
- Set the multimeter to a high voltage range after finishing the...

## Complexity in Consumer Electronics Considered Harmful

I recently returned from a visit to my grandmother, who lives in an assisted living community, and got to observe both her and my frustration first-hand with a new TV. This was a Vizio flatscreen TV that was fairly easy to set up, and the picture quality was good. But here's what the remote control looks like:

You will note:

- the small lettering (the number buttons are just under 1/4 inch in diameter)
- a typeface chosen for marketing purposes (matching Vizio's "futuristic" corporate...

## Round Round Get Around: Why Fixed-Point Right-Shifts Are Just Fine

Today’s topic is rounding in embedded systems, or more specifically, why you don’t need to worry about it in many cases.

One of the issues faced in computer arithmetic is that exact arithmetic requires an ever-increasing bit length to avoid overflow. Adding or subtracting two 16-bit integers produces a 17-bit result; multiplying two 16-bit integers produces a 32-bit result. In fixed-point arithmetic we typically multiply and shift right; for example, if we wanted to multiply some...

## March is Oscilloscope Month — and at Tim Scale!

I got my oscilloscope today.

Maybe that was a bit of an understatement; I'll have to resort to gratuitous typography:

I GOT MY OSCILLOSCOPE TODAY!!!!Those of you who are reading this blog may remember I made a post about two years ago about searching for the right oscilloscope for me. Since then, I changed jobs and have been getting situated in the world of applications engineering, working on motor control projects. I've been gradually working to fill in gaps in the infrastructure...