Help, My Serial Data Has Been Framed: How To Handle Packets When All You Have Are Streams

Jason Sachs December 11, 201110 comments

Today we're going to talk about data framing and something called COBS, which will make your life easier the next time you use serial communications on an embedded system -- but first, here's a quiz:

Quick Diversion, Part I: Which of the following is the toughest area of electrical engineering? analog circuit design digital circuit design power electronics communications radiofrequency (RF) circuit design electromagnetic...

10 Circuit Components You Should Know

Jason Sachs November 27, 20112 comments

Chefs have their miscellaneous ingredients, like condensed milk, cream of tartar, and xanthan gum. As engineers, we too have quite our pick of circuits, and a good circuit designer should know what's out there. Not just the bread and butter ingredients like resistors, capacitors, op-amps, and comparators, but the miscellaneous "gadget" components as well.

Here are ten circuit components you may not have heard of, but which are occasionally quite useful.

1. Multifunction gate (

Analog-to-Digital Confusion: Pitfalls of Driving an ADC

Jason Sachs November 19, 20118 comments

Imagine the following scenario:You're a successful engineer (sounds nice, doesn't it!) working on a project with three or four circuit boards. More than even you can handle, so you give one of them over to your coworker Wayne to design. Wayne graduated two years ago from college. He's smart, he's a quick learner, and he's really fast at designing schematics and laying out circuit boards. It's just that sometimes he takes some shortcuts... but in this case the circuit board is just something...

Modulation Alternatives for the Software Engineer

Jason Sachs November 8, 20111 comment

Before I get to talking about modulation, here's a brief diversion.

A long time ago -- 1993, to be precise -- I took my first course on digital electronics and processors. In that class, we had to buy a copy of the TTL Data Book* from Texas Instruments.

If you have any experience in digital logic design you probably know that TTL stands for Transistor-transistor logic (thereby making the phrase "TTL Logic" an example of RAS...

Complexity in Consumer Electronics Considered Harmful

Jason Sachs October 1, 20111 comment

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...

Which MOSFET topology?

Jason Sachs September 1, 20119 comments

A recent electronics.StackExchange question brings up a good topic for discussion. Let's say you have a power supply and a 2-wire load you want to be able to switch on and off from the power supply using a MOSFET. How do you choose which circuit topology to choose? You basically have four options, shown below:

From left to right, these are:

High-side switch, N-channel MOSFET High-side switch, P-channel MOSFET Low-side switch, N-channel...

Thermistor signal conditioning: Dos and Don'ts, Tips and Tricks

Jason Sachs June 15, 201116 comments

In an earlier blog entry,  I mentioned this circuit for thermistor signal conditioning:

It is worth a little more explanation on thermistor signal conditioning; it's something that's often done poorly, whereas it's among the easiest applications for signal conditioning.

The basic premise here is that there are two resistors in a voltage divider: Rth is the thermistor, and Rref is a reference resistor. Here Rref is either R3 alone, or R3 || R4, depending on the gain...

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

Jason Sachs May 29, 20118 comments

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...

Byte and Switch (Part 2)

Jason Sachs May 7, 20118 comments

In part 1 we talked about the use of a MOSFET for a power switch. Here's a different circuit that also uses a MOSFET, this time as a switch for signals:

We have a thermistor Rth that is located somewhere in an assembly, that connects to a circuit board. This acts as a variable resistor that changes with temperature. If we use it in a voltage divider, the midpoint of the voltage divider has a voltage that depends on temperature. Resistors R3 and R4 form our reference resistance; when...

Byte and Switch (Part 1)

Jason Sachs April 26, 201113 comments

Imagine for a minute you have an electromagnet, and a microcontroller, and you want to use the microcontroller to turn the electromagnet on and off. Sounds pretty typical, right?We ask this question on our interviews of entry-level electrical engineers: what do you put between the microcontroller and the electromagnet?We used to think this kind of question was too easy, but there are a surprising number of subtleties here (and maybe a surprising number of job candidates that were missing...

Linear Feedback Shift Registers for the Uninitiated, Part X: Counters and Encoders

Jason Sachs December 9, 2017

Last time we looked at LFSR output decimation and the computation of trace parity.

Today we are starting to look in detail at some applications of LFSRs, namely counters and encoders.


I mentioned counters briefly in the article on easy discrete logarithms. The idea here is that the propagation delay in an LFSR is smaller than in a counter, since the logic to compute the next LFSR state is simpler than in an ordinary counter. All you need to construct an LFSR is

Racing to Sleep

Jason Sachs December 30, 2019

Today we’re going to talk about low-power design.

Suppose I’m an electrical engineer working with wildlife biologists who are gathering field data on the Saskatchewan ringed-neck mountain goat. My team has designed a device called the BigBrotherBear 2000 (BBB2000) with a trip cable and a motor and a camera and a temperature sensor and a hot-wire anemometer and a real-time clock and an SD card and a battery and a LoRa transceiver. The idea is something like...

Linear Feedback Shift Registers for the Uninitiated, Part V: Difficult Discrete Logarithms and Pollard's Kangaroo Method

Jason Sachs October 1, 2017

Last time we talked about discrete logarithms which are easy when the group in question has an order which is a smooth number, namely the product of small prime factors. Just as a reminder, the goal here is to find \( k \) if you are given some finite multiplicative group (or a finite field, since it has a multiplicative group) with elements \( y \) and \( g \), and you know you can express \( y = g^k \) for some unknown integer \( k \). The value \( k \) is the discrete logarithm of \( y \)...

Linear Feedback Shift Registers for the Uninitiated, Part IV: Easy Discrete Logarithms and the Silver-Pohlig-Hellman Algorithm

Jason Sachs September 16, 20174 comments

Last time we talked about the multiplicative inverse in finite fields, which is rather boring and mundane, and has an easy solution with Blankinship’s algorithm.

Discrete logarithms, on the other hand, are much more interesting, and this article covers only the tip of the iceberg.

What is a Discrete Logarithm, Anyway?

Regular logarithms are something that you’re probably familiar with: let’s say you have some number \( y = b^x \) and you know \( y \) and \( b \) but...

Book Review: "Turing's Cathedral"

Jason Sachs November 20, 20146 comments

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

Organizational Reliability

Jason Sachs December 22, 20111 comment

I was cleaning out my email inbox at work today and ran across something I had forwarded on to a friend a few years ago, which I thought I would share, for those of you who are working in the engineering world.

Below is a handout I got about 10 years ago from Doug Field, an executive now at Apple. Doug is a superb and inspiring leader, whom I had the opportunity to work with briefly.

The following is a bit of a diversion from the topics I usually post, but is some good food for thought for...

Garden Rakes Revisited: The Hall of Shame

Jason Sachs April 12, 2014

A little while ago, I wrote about what I call the “garden rakes” syndrome in software, where there are little bugs or pitfalls lying around like sloppy garden rakes that no one has put away, and when you use these software programs, instead of zooming around getting things done, you’re either tripping over the garden rakes or carefully trying to avoid them. Either way, you lose focus on what you’re really trying to work on, and that causes a big hit in...

Musings on Publication — and Zero Sequence Modulation

Jason Sachs May 30, 20141 comment

Perhaps you don’t think about it, but in order for you to read these articles, someone has to do something.

And I don’t just mean writing them. Stephane Boucher has set up this website so that it’s automatic, for the most part — at least from my end of things, as an author. When I get an idea for an article, I open up a new IPython Notebook, write my article, save it in a Mercurial repository, run a Python script to convert from IPython Notebook format to HTML, open...

Shibboleths: The Perils of Voiceless Sibilant Fricatives, Idiot Lights, and Other Binary-Outcome Tests

Jason Sachs September 29, 2019

AS-SALT, JORDAN — Dr. Reza Al-Faisal once had a job offer from Google to work on cutting-edge voice recognition projects. He turned it down. The 37-year-old Stanford-trained professor of engineering at Al-Balqa’ Applied University now leads a small cadre of graduate students in a government-sponsored program to keep Jordanian society secure from what has now become an overwhelming influx of refugees from the Palestinian-controlled West Bank. “Sometimes they visit relatives...

Linear Feedback Shift Registers for the Uninitiated, Part IX: Decimation, Trace Parity, and Cyclotomic Cosets

Jason Sachs December 3, 2017

Last time we looked at matrix methods and how they can be used to analyze two important aspects of LFSRs:

  • time shifts
  • state recovery from LFSR output

In both cases we were able to use a finite field or bitwise approach to arrive at the same result as a matrix-based approach. The matrix approach is more expensive in terms of execution time and memory storage, but in some cases is conceptually simpler.

This article will be covering some concepts that are useful for studying the...