# Inexpensive solid-state variable resistor

I have an analog audio project I'm playing around with designs for and it will need about 150 solid-state variable resistors. I plan to control these from a micro controller so a digitally controlled pot would work but all the ones I've found are way too expensive ($1.00-$1.50).

My original plan was to use something like a MOSFET with a small capacitor and another transistor to hold a voltage on the gate. I would then update the voltages of each in turn via a DAC and some GPIO. However I haven't found any transistors suitable for my application (i.e. something that behaves enough like an ideal resistor).

Any ideas?

FWIW: the project is a variant on this (discontinued) EQ design: Designing with the LMC835 Digital-Controlled Graphic Equalizer.

• Are you trying to implement a bunch of variable gains for a mixer, or oscillator frequencies for a synth, or something else? There might be a cheaper way to do it than digital pots. – endolith Sep 27 '10 at 23:51
• @endolith: A computer controlled analog EQ. And a cheaper way is exactly what I'm looking for. – BCS Sep 28 '10 at 1:08
• @BCS - A computer-controlled analog EQ sounds oxymoronic to me. Please correct me if I'm wrong, but won't any digitally controlled pot be, well, digital, and the microcontroller and/or pot introduce switching noise when you change the pot's value? – J. Polfer Oct 21 '10 at 22:06
• @sheepsimulator: There is no reason that a digital pot would inherently add switching noise (I'd assume that a well designed one would attempt to minimize that) as for the rest of the system, while mixed signal applications are a problem, they are a know problem with know solutions, they make digital sounds boards after all and they have to go analog at some point. For that matter it could be setup so that you could turn off the digital parts and the analog parts would continue to function just fine. -- As to being oxymoronic, no it's not (moronic OTOH is a distinct possibility :). – BCS Oct 21 '10 at 22:59
• What did you end up going with? I'm solving a similar problem right now. – terrace Feb 14 '11 at 0:02

## 6 Answers

If you want something that behaves more like a resistor, you can use a photocell and light it with an LED from a filtered PWM. That's acting as a 2-terminal variable resistor rather than a 3-terminal pot, though.

You could control all the LEDs from a single microcontroller using something like the TLC5940, which has 16 PWM LED driver outputs, with brightness of each programmable over a serial connection. You'd need 10 of these at $1.84 each to control 150 channels, though twice that if you need two resistors per channel (to simulate an actual pot). Also, have you looked at ICs with lots of pots inside?$0.33 per pot is better than $1, for instance: You could also look into voltage-controlled or programmable gain amplifier ICs, which might take the place of both an op-amp and a pot: As for a computer-controlled many-channel graphic EQ, a DSP is a cheaper option. For instance, TI, AKM, and Analog have audio signal processors with ADCs and DACs built-in, and easy to use GUIs for making the EQ, though you need to buy the development board. :) Have you seen Digitally-Controllable Audio Filters and Equalizers? • That's creative. – tcrosley Sep 28 '10 at 1:09 • In other words, an analog opto-isolator? – BCS Sep 28 '10 at 2:06 • Yep, but with a photoresistor instead of a phototransistor. They're used in optical limiters or compressors, for instance. – endolith Sep 28 '10 at 2:14 • A DSP is not an option. The point of the project is that the signal processing is analog. As to that last link, nope, I hadn't seen that but it's very close to what I'm thinking of. – BCS Sep 28 '10 at 3:07 • @Mark: You don't need 256 steps for an EQ. ±15 dB in 1 dB steps is only 30 steps. If the drive capability of the PWM IC has 4096 linear(?) steps from 0 mA to 60 mA, that's 15 µA for the smallest. Since it's all run from a microcontroller, you can skip steps in firmware to get linear dB response or whatever you need. – endolith Oct 22 '10 at 16:44 How about this? MCP4011-4014 It is$0.39 each for 100QTY. So for 150 QTY, it would be $58.50 + shipping. • That would do quite well. The +/- 20% doesn't look that nice though. (More related devices: microchip.com/ParamChartSearch/…) – BCS Sep 28 '10 at 14:42 • @BCS Yes, the +/- 20% doesn't look nice on the face of it, but whatever microcontroller you use to set the digital pot can also be loaded with calibration data / code, probably bringing it much closer to just a few percent, especially if you recalibrate on startup to a 1% resistor. Then you can attain better precision by scaling in firmware and selecting the appropriate tap. – MicroservicesOnDDD Feb 25 at 20:33 A JFET can be configured as a variable resistor, operating in its ohmic region. It works in many cases. Here's my über-crude design: Vdd -----------+ | R1 _| G -\/\/\-+-|_ | | \ v put R2 / v load \ | here +---| | GND -----------+  (We need a schematics editor: that would be awesome.) It's a bit tricky to get it biased (if that's even the right word) in the right position. I made a variable oscillator circuit with one before. I also designed a variable PWM+frequency circuit (variable frequency-variable speed drive) for driving a motor using a dual op-amp and JFET. • How would a microcontroller keep a steady voltage on all of these JFETs gates, though? Seems like you'd have to use analog transmission gates, anyway. – endolith Sep 29 '10 at 20:22 • Ditto endolith: the main reason I was looking at FETs was that they gave hight enough gate impedance that they a small capacitor will let them hold a given state for a reasonable length of time, ms at least. (OTOH it would work if I didn't have to drive so many. +1) – BCS Sep 29 '10 at 22:55 • That concern applies to my LED idea, though, too. Worse, actually, since it needs constant current instead of constant voltage. With high-impedance transmission gates you could multiplex analog voltages to each JFET gate, but it seems complex. – endolith Oct 6 '10 at 21:37 • The problem with storing the charge on the capacitor is that it will drop quickly due to the resistors. (R2 shunts to ground.) However, it may be possible to use a diode to isolate the gate capacitance to store a charge... – Thomas O Oct 6 '10 at 21:40 this is less an answer and more a word of caution when using digital pots or similar devices. Make sure you look carefully at their actual mode of operation and not just the theory or equivalent circuit in the datasheet. I had a design a few years ago that had several analog inputs that were designed to operate at both line and microphone level. As such there was a differential pre amp stage using an IC designed for that purpose with adjustable gain from 0 to 60dB. We needed to control the gain set digitally with a micro controller which was set with a single external resistor. The resistor was in the signal path and AC coupled (swung +/- around ground). This wasn't mentioned in the pre-amp datasheet and wasn't expected as the output of the pre amp was referenced to the ADC input of a DSP. The output swung around 1.65V and always stayed above ground. Through feedback from the DSP the system automatically adjusted the pre-amp gain to get very close to full range input on the ADC to improve resolution. At first i just used an AD digital potentiometer that appeared in all regards to be a regular old pot, everything indicated it was a resistor with a digitally controlled wiper position. Well it wasn't. Internally it was implemented with a cascade of transistors setup to present a constant resistance. This doesn't sound bad at first but what it does mean is that the resistor couldn't pass voltage outside the bounds of the pot's supplies. I implemented it with 3.3V and GND for the 2 rails as thats what we used for digital I/O. But in that configuration the resistor couldn't pass current with a negative voltage and it just chopped the bottom off any AC coupled signal going through it. We ended up having to replace it in the next rev with a digital pot that allowed +/- rails wide enough to support the signal going through the resistor. That was a bit of a pain as it meant that it needed to run off the analog supplies but still have serial signals from the digital portions of the circuit attached to it. Anyway, point is make sure you do your diligence and know exactly what the signal that needs to pass through the variable resistor looks like and that it will work given the topology of the resistor's design. • Thanks. Noted. In this case, I know what signals will be going through them (about the same as you had) so all I need to check is that the pot is what i think it is. – BCS Oct 22 '10 at 0:11 I'd agree with endolith that you should seriously look at other ways to solve the problem. As you haven't described the circuit you're trying to add this component to, much less posted the schematic or the transfer function you're trying to achieve, I can only guess that there are more efficient ways to solve the problem. Is one terminal of your variable resistor connected to a supply? This will make many approaches much more feasible. In the case of a connection to ground, for example, an N-type MOSFET, a capacitor, a resistor, and a PWM will probably suffice for a (relatively) slow-changing pot. The key to designing a solid-state variable resistor is operating in your transistor in the active region, rather than allowing it to become saturated. Your audio application likely requires a logarithmic or frequency weighting scale anyways, so why not build in some feedback or monitoring, and not worry about the slight nonlinearity? • Other ways in what way? Avoid using a solid-state variable resistor? A totality different architecture? The first might work but what I'm looking for actually would need ~150 independent degrees of freedom so the second may change the demands on the component but not the quantity needed. Also given the number needed, I need something has low cost for all unshared aspects. – BCS Sep 28 '10 at 1:16 • Since you posted the appnote, I can elaborate on one simple way - Do it just the same way they did it! Do you really need more finely grained control than what they've implemented in their design? The 55k, 25k, 16k, 11k, 8k, and 3k network controlled by FET switches will give you, as stated in the datasheet, better than 0.1 dB accuracy over 12dB. You can adjust these numbers and/or resistor counts to get better control or more steps. – Kevin Vermeer Sep 28 '10 at 18:41 • Building your own digital pots for each one? :D You could use an analog multiplexer instead of individual FETs. The CD4051 is$0.15 in large quantities and acts as a SP8T switch, for instance. – endolith Sep 28 '10 at 19:03
• @reemrevnivek, I've considered that and even took a first pass at the numbers: to get 256 steps at the spacing and accuracy I want requires about 16 elements (1 element = 1R, 1C and 2FETs) from rdeml's answer I can get 256 (sadly linear) steps for \$.25 and that really pushes the DIY pot for cost. – BCS Sep 28 '10 at 19:12

One approach not yet mentioned which is applicable in some low-frequency scenarios, though it must be used with caution, is to recognize that a resistor which is switched on and off via PWM signal will, at frequencies which are much lower than the PWM frequency, behave roughly like a larger resistor whose resistance is that of the original divided by the PWM duty cycle. So a 1K resistor at 5% duty cycle will behave roughly like a 20K resistor.

The biggest caveat with this approach is that it will often inject noise into the system at the PWM frequency. This may not be a problem if the components dealing with the signal can filter out such noise cleanly, or if they can pass it through without distortion to other components which can. Before using such a design, one must ensure that one of the above requirements is met. The fact that a component has a maximum useful frequency does not imply that it will cleanly filter things above that frequency. Many amplifiers, for example, will distort if the input signal would cause the output slew rate to exceed their abilities. If an amplifier is fed a mixture of a 1KHz signal at 0DB and a 1MHz signal at -20DB (10% the voltage of the original) the output slew rate for the 1MHz component would be 100 times that of the 1KHz component. It's entirely possible that the slew rate of the 1KHz component would be well within the amplifier's abilities, but the 1MHz component would not; that could in turn cause the 1KHz portion of the output to come out severely distorted.

• That might work well (and cleanly) if the loading is inductive enough. – BCS Jun 11 '11 at 1:20
• @BCS: I don't think inductive loading is what's needed. If the PWM rate is substantially above the highest frequency of interest (e.g. by a factor of 100) every stage of filtering will drop the noise level by a factor of 10-100 (100 in the ideal case; 10 in an easily-achievable case; a practical case would be somewhere between). The question is whether the injected noise will cause distortion before that happens, and that depends on the circuit design. If nothing else, adding some filtering may allow the PWM approach to be usable and eliminate the need for fancier stuff. – supercat Jun 11 '11 at 15:58