How embedded projects run into trouble: Jack’s Top Ten – Number Six
As of last week we’re at sixes and sevens in my Top Ten mistakes I see made in embedded projects. Today, number 6:
6 - Crummy analog/digital interfacing
In the digital world there are ones and zeroes. It’s pristine. Binary. There’s no question what state a node is in, and the difference between the two is a gulf wider than the Grand Canyon.
Alas, the real world is much uglier and the only granularity is at a quantum level. The difference between 1.0000 and 0.99999 volts might be very important. But that delta can be hard to measure.
Proper analog design is hard, but the good news is that things are much better than when this industry was young. Back then it was all but impossible to get more than about 12 bits in an ADC… and those devices were large, potted modules costing hundreds of dollars, back when hundreds were more like thousands in today’s tarnished dollars. There were no multi-layer PCBs so distributing clean power was difficult; isolating noisy digital from sensitive analog often meant building multiple boards and shielding one in an aluminum box. Today PCBs of all sorts are cheap and quick to produce, and the variety of analog ICs boggles the mind. Digi-Key lists 16,000 different part numbers just for ADCs; a 24 bitter is just two bucks.
On the other hand, the more resolution we can get, the more we need so other issues become paramount, like noise. 24 bits of resolution over a 5 volt span means each bit is worth less than a millionth of a volt. At least one of these ADCs has a 5 G-ohm impedance, which means each bit represents a faction of a femto-amp, so you’re practically counting electrons.
Noise can be fought by many means, but I see too many teams blithely throwing some sort of filter at it. A simple bit of code can average some number of samples, or implement IIR/FIR filters. These are great solutions to some problems, and disasters for others. Any sort of filter will distort the data to some extent and many will delay the result, which can be a problem for fast real-time systems. It’s often better to use careful analog design to minimize the noise before it hits an ADC.
Digital outputs, particularly those that drive significant loads, can inject transients into sensitive analog. There are plenty of great solutions, but these need to be evaluated and designed in early in the project.
Modern analog components are so easy to use that some sprinkle them around a PCB without considering the coupling of the digital circuits switching into the analog side. Careful use of guard traces, where needed, is often neglected. Sometimes circuits need to be protected via optoisolators. Ferrites can reduce coupled noise.
A common theme I see is a very competent digital engineer not understanding the nuances of careful analog design. Last week I saw a product with a transistor driving a relay – a very digital bit of circuitry. There was no diode across the coil. Inductive analog transients might destroy the transistor.
In a sense digital isolates us from basic electronics as we can often neglect all of that circuit theory learned so long ago in college. Without a careful analysis of our designs we’re likely to get into trouble.
I highly recommend that anyone designing analog circuitry get the books listed in the reference. Electronics is a lot of fun, and these books are readable and very interesting.
Next week, I go after the managers.
The Art of Electronics, by Horowitz and Hill
The ARRL Handbook for Radio Communications
Op Amps for Everyone, by Bruce Carter