Category Archives: Analog

So What is a Resistor Anyway

I had a friend ask me a question concerning his engineering homework some time back and it got me thinking. At first glance, I looked at it as an engineering issue, being such is the world where in I live… and all of a sudden, its like hey wait a second, this is just homework.

This isn’t a real circuit, where in Mr Murphy is lurking around every corner, just waiting to holler out gotcha should you overlook some seemingly minor detail. This isn’t a production issue, where in an error can equate to hundreds of man hours in rework, or an analysis to determine whether rework, or throwing the entire batch away and starting over is a more cost effective approach.

I thought back to my days at uni in circuit analysis class, where in we’d pound on complex resistor networks, using norton and thevenin to solve equations. We’d look at short cuts where in we could throw this and that sort of characteristics away, being their contribution to the circuit of a whole was minuscule. The classes back then served me well for years, and continue to do so.

And yet, there are many times where in that resistor, isn’t really a resistor, its a complex device, with potentially a capacitive or inductive component or both. It may have some weird impedance curves as a function of frequency. It will have thermal dependencies due to ambient temperatures, but it may also have issues with self heating, or heating from nearby components. This first aid in toronto suggests that you add insult to injury, it may have its own internal voltage sources with both ac and dc components as well. All of the above could change throughout its life cycle, or could even change due to mechanical stresses, either as one time things due to assembly issues, or as life long concerns due to stresses on the pcb itself. It could also be influenced by environmental factors such as circuit board pollution, crystalline growth on the terminations, or even water or chemical ingress through its packaging.

Fortunately, most resistors are applied in such a way that they are merely resistors, the factors above end up falling into the miniscule category and can be discarded as too small too have much of an effect on the circuit as a whole.

As such, the primary drivers of resistor selection end up being the idealized value and its associated tolerance, the power and voltage rating, its physical size/foot print, and whether it currently exists in inventory. Application specific concerns may require a specific material spec, carbon comp, metal film, and wirewound to name a few. Temperature coefficient,  and/or reliability specification may also be in driving factor in some designs.

Alas, for my friends homework, a resistor was just a resistor.

Op amps as comparators, be very very wary

I’ve have hundreds of thousands of units in the field where I used an op amp as a comparator, but its not a calkwalk by any means… in fact, as a friend says, its challenging Mr Murphy. I do not recommend doing so… but, marketing cost targets and pcb real estate limitations, combined with a left over op amp in a quad package may end up making it worth considering. Thus, lets look at a few issues.

Op Amps are dog slow compared to comparators

The most apparent issue is op amps are dog slow compared to comparators. Now, if your signals are pretty slow, speed is likely a non issue.

Be wary of an op amps output topology and power supply

Next is the matter of the op amps output. Ie, if you are using bipolar power supplies for the op amps, and the op amp/comparator feeds a micro, you need to play a few games, and that will add some cost and real estate. Or perhaps you are able to run the op amp on a unipolar supply, and it has a rail to rail output, and you will use the same power supply for the micro… expect Mr Murphy to arrive, as you chase op amp instability due to unintentional positive feedback (mostly due to common mode effects). Such scenarios can be a real bear to deal with, requiring untold number of pcb revs to make things happy and stable… and what if the pcb gets dirty with age, throw in a little leakage to create a positive feedback path, and now you have field failures left and right.

If you are tempted to try something like this, add a second analog supply, separate grounds, use faraday shields, and consider conformal coating. Then, once you are all done, go hammer on the input, and look for any signs of instability… hammer it hard, you may be surprised that you still have work to do. With such a topology, you are likely asking to see Mr Murphy at every turn, so put up lots of stop signs, and once installed, hammer them to make sure they are solid.

Phase Inversion, oh noes!

Then comes phase inversion… yes, the term op amp vendors dont like to talk about. Comparators are designed to have a substantial differential input voltage and the resulting currents to some extent as well, op amps on the other hand, are applied where the differential input voltage is theoretically zero, same with input current (Vos, Ib, and layout issues obviously preclude it from being zero, but you get the idea..) If you go outside of the maximum speced differential, expect that you might see phase inversion. It happens with a lot of common op amps, perhaps less so with todays designs than years ago… but no one likes to talk about it. DO NOT EXPECT SPICE MODELS to show this, in fact dont expect spice models to show much of any real world behavior…. Also be aware, it is possible each time the op amp gets whacked with an out of spec differential, it may be degraded permanantly… Not a good spot to be in.

Internal Protection Diodes may bite

And speaking of damage…. some op amps have internal protection diodes, so, if you go outside of the differential input specs, you fire them up… expect all sorts of bizarre and unexplained behavior. This could include thermal issues on the die adjacent to the internal ground making for all sorts of fun scenarios, long after the op amp signals have returned to a nominal state.

Apart from damage, pretty much anytime you get very far from zero volts differential on an op amp input, performance specs can get very dodgy. Sometimes manufacturers will spec out how performance degrades… often times, being such is a misapplication of an op amp, they leave that information off the datasheet. And yes, Spice models as a general rule wont tell you either, even more so, if temperature varies.

Dont use op amps as comparators, but if you must

So… what to do… dont try it, but if you must, go over the datasheets with a fine tooth comb. Look for gotchas on the input and output specs. Be very careful to avoid unintentional positive feedback paths. Give the apps guys at call at the factory, and ask em straight out. Can I do this… they will tell you NO, but they may offer particular suggestions which might help. They know folks misapply their parts all the time… They also know that some op amps plain and simple will not work as comparators no matter how much tweaking one does. In other cases, they must admit some models can do well in such a topology, provided the designer does their homework ahead of time.