Hybrid Signal Processing



C-Lab Home

There are times when neither analog or digital processing alone is the best way to get a job done.  If the requirement is for extremely low power, a passive resistive mixer certainly beats any DSP for dividing.  If the requirement is for speed, and saving the output is not so important, a current day analog multiplier will outperform most supercomputers.  Remembered settings are pretty hard to do in analog, but easy in digital.  So this page is about some tricks to use each technology for what it does best.  We should state some of our design preferences up front.  For microcontrollers, we like the PIC series from Microchip the best.  They have some very nice properties, such as "wanting to work" type of reliability, good drive on all pins, quiet outputs (if designed carefully) and the ability to more or less go up and down in features easily after the product is done and you know what you actually used.  This builds in a good bit of obsolescence protection.  Their application notes are worth the time to read for later reference.  For DSP's we like the TMS320c33 and its older brothers from TI.  Floating point is just so much easier to program DSP with that they are usually worth it.  Now, these are the opposite of a microcontroller, these are serious computers, and you provide the memory, i/o and so forth in the rest of your design.  We also like the x86 platform (with any opsys, the myth that you can't do realtime in Windows (tm) is just that, a myth), and the fact the the DSP code itself can run in both places with nothing but a recompile.  We are using an older version of the C3x tools (compiler is v 4.5), one we know every bug in, which is a nice thing.  For opamps and the like, we like lots of suppliers.  LTI, Burr-Brown, Microchip, National, and Maxim are all good, some better than others for a particular sort of work.  None of the above should be construed to imply we think everything else is junk, because we don't.  Some digital stuff is more and less painful to program, especially at the very detailed level, and we're into fun here.  For example, we avoid the venerable 8051 variants because they're not much fun to work with.  We avoid some (but not all) of the FPGA/ASIC sorts of things for philosophical reasons -- why should we have to pay 10's of thousands of dollars for the priveledge (eg for some buggy set of software tools) of designing in some part that is itself overpriced for what it does?  We prefer manufacturers who get it and keep their toolsets reasonably priced.  The TI series of 16 bit DSPs falls sort of in the middle.  Not great fun, but a good price/performance ratio when programmed in assembly language for a high volume product.

Note: we plan to add schematics and maybe code examples for most of this at some point, check back now and then.

Some of our tricks:

If, in your PIC design you are careful to avoid things that cause ground bounce, the output pins are very quiet at ground.  When tristated, they are really a good open circuit.  Thus, you can use them to switch things in and out of analog circuits.  These things could be either resistors, for example to change gain, or capacitors to tune something.  For whatever reason, it's harder to avoid Vcc bounce in these, but in some applications a little may not matter.

You can measure voltage or capacity by having a known one or the other work on a pair of PIC pins and looking at timing.   For example, a touch capacity sensor can be built with two PIC pins and a megohm resistor between them.  The touch pad is connected to an input pin, which measures the delay that occurs when the other pin toggles.  No capacity, no delay.  An inexpensive high resolution A/D can be built by switching a voltage into a known capacity and measuring the time it takes to cross a digital threshold.  Microchip has a good app note on this one, and nowadays precise A/D's are cheap anyway, but it's still a neat trick.

Analog thermocouple cold junction compensation is not very much fun, usually.  However, if you're going to digitize the thermocouple output anyway, a digital temperature sensor can be used to compensate the reading after the fact.  We used this trick in our reflow/preheat oven's PID controller.  TI makes a nice I2C temperature sensor, the TMP100 series.

PWM outputs from PICs can be used to directly drive a class D amplifier, the simplest version of which is a one-chip pair of N/P logic level fets and a ferrite bead, or analog filtered and used as any sort of continuous signal at frequencies below the Nyquist limit.  You'll want a good analog filter for the latter, and this is where old standbys like Don Lancaster's Active filter cookbook come in handy.

Though not strictly an analog/digital hybrid, a RabbitCore module is a nice addition to a mostly analog PIC based design if logging and ethernet connectivity are important.  The Rabbits have tons of memory by comparison to the PIC series.  I swore I'd never program for a Z80 again (which is essentially what a Rabbit is, on steroids) but with these there's no need or point to get down to assembly language.  The Rabbits have nice serial ports, some relatively clunky digital I/O, and that ethernet port.  They are hard to do hard realtime things with because of the TCP/IP stack sometimes grabbing the whole chip for awhile, but can communicate nicely with a PIC that doesn't have this problem, so between them they add up to more than the sum of the individual parts.  We've used this combo for a customer, and are planning a remote, logging weather station that doesn't need frequent connection to a PC to log very detailed, time resolved weather data.

A different sort of trick is sampling synchronously.  For things where AC line noise and harmonics are a problem, sampling at 60hz (depending on what country you live in) or some (sub)multiple can be used.  The trick is to catch the noise in the same part of its waveform each time, which turns it into a fixed DC offset that is easily subtracted out later.  In the case of sampling at a multiple of the line frequency, a simple boxcar filter can easily remove the predictable noise.  Old radio designers (are there any left?) knew all about how to avoid the harmonics of that while listening for this, and that's the basis of this technique.