I have a current project that requires sensing an analog voltage, and turning on an LED when each of three thresholds is reached. The analog voltage relates to a detected RF power level (in the 50 to 100 watt range, at HF), and the whole circuit is powered by scavenging a little bit of the RF power and making some dc from it. I need about 100 of these boxes. Cost is an issue.
I found a circuit as prior art that used a quad op-amp to make the comparators, and bunch of resistive dividers to set the thresholds. Simple enough, and cheap. I'm kind of busy at the moment and had another engineer take a look at it and whip something up based on the original circuit. This engineer is pretty good, but does more digital and software than analog. He has a small sideline business selling a PIC microcontroller-based product that he designed to hobbyists.
The cost of a couple of quad op-amps, regulator, reference, and 20 or so resistors is within the budget; parts cost is not much over a dollar.
A few things changed from the prior art. The old circuit had one active channel; the new version needs two. There was concern about whether the circuit would power up fast enough to settle to reasonable accuracy soon enough without latching up if the input was ready before the supply voltage. A layout bug got the hysteresis backwards on the comparators. And the designer was having trouble getting the accuracy he wanted once he worst-cased the tolerances on the resistors, reference, etc.
So he eased into his comfort zone and threw a PIC at it.
One chip for each channel. One resistive divider to get the dc representing the RF power down to a manageable level (the coupler delivers around 10V for 100W). The PIC he used has an on-chip reference, enough outputs to drive the LEDs, and (of course) programmable threshold points (with hysteresis easily added in software). It also has a brown-out feature to allow well-behaved startup and power-down.
I was nervous about going this way, since anything with software in it is just too easy to keep revising and revising and never get finished. And I was not sure of the cost impact. But in this case it looks like the right choice. The software came up on the first try and does what we need. The designer is a lot less stressed. The PIC-based design was done faster than the revision to the analog-based design. And the cost? (Drum roll.) Still not much over a dollar, and well within the budget.
This was a lesson for me on several levels. I am still wrestling with the idea that it can make sense to replace a simple analog circuit with a microprocessor and software. It's not always the right solution, but in the overall discussion of analog integration, perhaps there are a lot of low- to moderate-accuracy and low- to moderate-bandwidth problems that are well solved this way. This is especially true when the design staff is more comfortable with the digital approach. "Impedance matching" the staff to the job is important.
The rest of the story is that the enclosures and connectors make up much more of the total cost than the electronics. Some of us can still recall when boxes and connectors were cheap and electronics was expensive. But that's another story for another day.