Shop OBEX P1 Docs P2 Docs Learn Events
Digitally Controlled Variable Resistor — Parallax Forums

Digitally Controlled Variable Resistor

44RosinCore44RosinCore Posts: 11
edited 2011-05-03 20:47 in General Discussion
I need a circuit for a digitally controlled variable resistor to function as the frequency determining component in an astable 555 circuit. It is required to:
  • vary from 1590K to 0K
  • in 256 steps
  • with a tolerance of +/- 2% or less
  • be able to float in-circuit
I looked at the various offerings by Analog Devices and Maxim but I could find values that only went as high as 1000K, tolerances in the range of +/-30% and no ability to float (i.e.digital poteniometers), non of which fit the bill.

I could do it with a Binary Weighted Ladder, but I would have to calibrate the top end. Does anyone know of a way to do it with a R:2R ladder? Or is there an IC that I don't know about?

Comments

  • kwinnkwinn Posts: 8,697
    edited 2011-04-30 23:51
    Not aware of anything that fits your bill. 1590K is an odd value. There might be a better way to vary the 555 frequency (such as using the control voltage) but more info is required about your application.
  • 44RosinCore44RosinCore Posts: 11
    edited 2011-05-01 00:48
    kwinn wrote: »
    1590K is an odd value.

    Actually I got that wrong. The VR needs to vary from 2.5Meg to 0.
    kwinn wrote: »
    There might be a better way to vary the 555 frequency (such as using the control voltage) but more info is required about your application.

    Another requirement is, the waveform needs to maintain a duty cycle of [very nearly] 50%, as the frequency is varied.

    Here's the original circuit:

    7555Ckt01.gif


    I need a direct replacement of the 2M5 VR with a digitally controlled equivalent. On that I can't budge ;)
    766 x 606 - 9K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-01 00:53
    Might it not be easier (and more accurate) to generate the necessary frequency directly with a Propeller chip, instead of going from digital to analog and back to digital with a 555?

    -Phil
  • 44RosinCore44RosinCore Posts: 11
    edited 2011-05-01 01:02
    Might it not be easier (and more accurate) to generate the necessary frequency directly with a Propeller chip, instead of going from digital to analog and back to digital with a 555?

    -Phil

    Nope, because the idea is to digitally control an existing circuit (not all of which is divulged in the posted circuit diagram).
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-01 01:05
    Since it's late, and since I'm too lazy to calculate it myself, what's the anticipated range of frequencies that you get out of this circuit?

    -Phil
  • 44RosinCore44RosinCore Posts: 11
    edited 2011-05-01 08:07
    ...what's the anticipated range of frequencies that you get out of this circuit?

    -Phil

    Trust me, that's irrelevant as I need to apply the same technique [the one that I am optimistically anticipating ;)] to other parts of the full design that have nothing to do with frequency control. I'm hoping to find a way to implement a digitally controlled variable resistor that can work at the voltages prescribed (~18VDC), that can float in-circuit, has a range of 2M5 divided into 256 equal sized steps, has a fairly tight tolerance (>=2%), doesn't require a bunch of tweaking/trimming, and doesn't cost a bundle.

    One of the reasons for this redesign is that every potentiometer in the value ranges that I need (2M5, 500K & 10K), that I know of (that isn't priced beyond reason) has a tolerence of 10% or above (typically 20%). Also, eventually, I want to be able to control it with a microprocessor. So, what I'm looking for is consistency and computer control.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-01 08:28
    What I trying to lead you to is that there is more than one way to skin a cat. If the resistor is controlling something (e.g. frequency, voltage), you can use that something as feedback to the micro to close your control loop, rather than depending directly upon the questionable precision of a programmable resistor. Once you've crossed that bridge, then perhaps you can replace the resistor with, say, a MOSFET or optoisolator, which can be controlled by other means.

    OTOH, you could also make your own programmable resistor from an 8x analog switch (or eight MOSFETs) and eight binary-weighted 1% resistors. You would put the resistors in series and use the switches to short them selectively. Since the lowest value resistor is ~10K, the switch resistance would be insignificant.

    Incidentally, you haven't stated whether, in general, the "resistor" has to pass current in both directions or just one. That could have a bearing on the final design.

    -Phil
  • 44RosinCore44RosinCore Posts: 11
    edited 2011-05-01 13:11
    If the resistor is controlling something (e.g. frequency, voltage), you can use that something as feedback to the micro to close your control loop, rather than depending directly upon the questionable precision of a programmable resistor. -Phil

    I get that, but in this case the application relies on the unique characteristics of the 7555 timer's output--just the right rise/fall time, and impedance. Also, the fact that it can function at the "high" voltage levels involved is a huge determining factor. Not to mention that I'm actually using a 7556 dual timer and doing a cascade sort of thing to distort the waveform with analog mixing between the two, etc. (with even more DCVRs involved), which would be difficult to reproduce any other way.
    OTOH, you could also make your own programmable resistor from an 8x analog switch (or eight MOSFETs) and eight binary-weighted 1% resistors. You would put the resistors in series and use the switches to short them selectively. Since the lowest value resistor is ~10K, the switch resistance would be insignificant.-Phil

    Yeah, I know--that's the very thing I'm trying to avoid--because, as the value of the resistors increases (up the exponential ladder) the precision also needs to increase. With 8 bits, wouldn't I need something like a .016% resistor* at the top of the ladder? To achieve that, I would need to either, some how, trim the resistors, or add trim pots that would have to be adjusted and which can go out of calibration with time, thermal stress, vibration, etc.
    Incidentally, you haven't stated whether, in general, the "resistor" has to pass current in both directions or just one. That could have a bearing on the final design.-Phil

    True, but I did imply it with the sample circuit--the 2M5 pot will need to handle small currents in both directions. Here's the sample circuit, again (which pretty much typifies all the cases):

    94_1304238173_thumb.gif

    BUT, I did find the AD5291 Digital Rheostat [DR] that can operate at voltages up to 33V, has 1% over all resistance tolerance with 256 steps. BUT it only comes in three values: 20K, 50K and 100K. I think I can get those to work for all the other DRs involved, so that still leaves the 2M5, which needs to be that high, because I need the dynamic frequency range with lack of duty cycle shift.

    * If I did this correctly,
    tolerance (t) of top most resistor (in %) = [(R/255)(P/100)/(128R/255)]*100
    where R = total resistance and P = tolerance of the smallest resistor
    This boils down to: t = P/128
    For a smallest resistor tolerance of 2%, the resister at the 128 times position needs to be:
    2/128 = 0.016%
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-01 14:48
    I suppose you could use a bigger cap and scale your resistors down accordingly to match an available programmable unit.

    Also, you are confusing absolute and relative errors. Percentage is a measure of relative error. Consider the case where you've got two resistors in-circuit: 1.28M and 10K (the top and bottom rungs). Let's say they're both high by 1%, so the top resistor is actually 1.2928M (an absolute error of 12.8K) and the bottom resistor is 10.1K (an absolute error of 0.1K). Summed in series, the net resistance is 1.3029M instead of the nominal 1.29M. And the relative error is (1.3029M - 1.29M) / 1.29M = .01, still only a 1% error.

    -Phil
  • 44RosinCore44RosinCore Posts: 11
    edited 2011-05-01 16:32

    Also, you are confusing absolute and relative errors. Percentage is a measure of relative error. Consider the case where you've got two resistors in-circuit: 1.28M and 10K (the top and bottom rungs). Let's say they're both high by 1%, so the top resistor is actually 1.2928M (an absolute error of 12.8K) and the bottom resistor is 10.1K (an absolute error of 0.1K). Summed in series, the net resistance is 1.3029M instead of the nominal 1.29M. And the relative error is (1.3029M - 1.29M) / 1.29M = .01, still only a 1% error.

    -Phil

    Yes, but .01 is 10K and 10K is a nearly 100% relative error in terms of the 10.1K value. In practical terms, a 1% error on the top resistor causes a non-linearity in the stepped resistance on the order of 1 LSB. So, what I'm trying to say (but faltering because I'm not a trained engineer and thus lack a full vocabulary) is, for there to be a maximum error in the linearity of 2%, the highest resistor needs to be within .016% relative error. Is there a better way of saying that? And, is my math incorrect?
  • ercoerco Posts: 20,260
    edited 2011-05-01 17:35
    Per PhiPi, this is a good application for an multi-analog switch. I like the 4066 quad bilateral switch, see http://mysite.du.edu/~etuttle/electron/elect25.htm about halfway down.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-01 18:55
    ... for there to be a maximum error in the linearity of 2%, the highest resistor needs to be within .016% relative error. ...
    Yes, I see what you mean now by linearity error. Without such constraints, you could not even guarantee monotonicity, let alone linearity. That's the reason many DACs use R-2R resistor arrays, as opposed to binary-weighted resistors.

    So what about raising the cap value in order to use a commercially-available programmable pot?

    -Phil
  • 44RosinCore44RosinCore Posts: 11
    edited 2011-05-01 19:16
    So what about raising the cap value in order to use a commercially-available programmable pot?
    -Phil

    The problem with that is, in order to get the same immunity from duty cycle change across the frequency span, I would have to scale down the 47k5 resistor by a factor of 25 (2500K/100K) to 1.9K and that would raise the current load to around 5ma. This is a very unconventional circuit and the current levels are key to it's operation, so scaling probably would spoil the affect. Plus, it's battery operated, so it would severely reduce the operating time between charges. But, I'm considering giving it a try ;)
  • LawsonLawson Posts: 870
    edited 2011-05-01 19:28
    I get that, but in this case the application relies on the unique characteristics of the 7555 timer's output--just the right rise/fall time, and impedance. Also, the fact that it can function at the "high" voltage levels involved is a huge determining factor. Not to mention that I'm actually using a 7556 dual timer and doing a cascade sort of thing to distort the waveform with analog mixing between the two, etc. (with even more DCVRs involved), which would be difficult to reproduce any other way.

    *snip*

    Why not then simply use a 555 as an output buffer for a Propeller pin? From the looks of the Fairchild Semi datasheet I found, tying the control voltage (pin 5) to <3.3 volts should allow the 555 to level shift input on the trigger and threashold pins (pins 2 and 6) from a propeller. (loading pin 5 with the right size resistor should also work)

    Otherwise I'd suggest taping a white LED to a CdS photo-resistor. With a sufficiently dark enclosure, the photo-resistor should be adjustable (via LED current) from 3.4Mohm to 910Kohm as shown in the schematic. This wouldn't be particularly accurate though, a feedback connection would need to be made back to the controlling processor to measure the actual frequency. (say a 1Mohm resistor from the 555's output [pin 3]) A photo-fet opto-isolator should be able to pull this trick too.

    Lawson
  • TubularTubular Posts: 4,717
    edited 2011-05-01 21:32
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-01 21:53
    Tubular,

    Yes! That's exactly the kind of thing I was trying to get at. Use one of those with feedback from the 555 in a software-controlled PLL. Don't even think about the actual resistance values. The output frequency is all that matters.

    -Phil
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2011-05-01 23:15
    44RosinCore,

    If you absolutely need to use a 555 (or similar flavor) ... then I'm with one of Phil's earlier posts. You can still directly control the 555 from the Propeller digitally! ... Pins 2 and 6 on the 555 are already tied, and if driven externally from a Propeller, then Pin 3 of the 555 shows an inverted state. BTW) Pins 2 and 6 of the 555 are inputs. If you need the voltage swing that the 555 offers, then a simple NPN transistor with a pull-up resistor to the 555's pins 2 and 6 would work AND correct the inversion that takes place.

    Also to cope with higher voltages, you can also use the 555 at your lower voltage and configure it as a level shifter. Use pin 7 as an open collector output with a pull-up resistor to your higher voltage supply. Still as mentioned above pins 2 and 6 would be your input.
  • jeff-ojeff-o Posts: 181
    edited 2011-05-03 12:14
    Could you use multiple digital potentiometers in series?

    That's an awfully large range of adjustment though. Can you change the value of the capacitor so the potentiometer doesn't have to be so big?

    Another idea is to use a servo or stepper controlling a physical potentiometer. Then you can choose whatever value pot you want!
  • 44RosinCore44RosinCore Posts: 11
    edited 2011-05-03 16:10
    You can still directly control the 555 from the Propeller digitally!

    Holy shift register, why didn't I think of that! That will work for the frequency control part of it. And it looks like I can use the AD5292s for the rest of it!

    Thanks for all the help, everybody!
  • 44RosinCore44RosinCore Posts: 11
    edited 2011-05-03 16:23
    Tubular wrote: »

    Interesting idea. I studied the data sheet and it appears that these are only resistive for small signal applications. Anything beyond around a tenth of a volt puts it into constant current mode (thus it's no longer behaving like a resistor). Also, I see no guarantee of consistency of voltage:resistance between devices. The whole reason for this redesign (i.e. going from 20% physical rheostats to, hopefully, 2% or less DRs, is for the adjustments to be consistent for each device I make (and to make MCU control possible).

    Am I wrong?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-03 17:45
    Also, I see no guarantee of consistency of voltage:resistance between devices. The whole reason for this redesign (i.e. going from 20% physical rheostats to, hopefully, 2% or less DRs, is for the adjustments to be consistent for each device I make (and to make MCU control possible).
    And that's the reason for using feedback. That way you don't have to have uniform, precision components.

    -Phil
  • 44RosinCore44RosinCore Posts: 11
    edited 2011-05-03 19:46
    And that's the reason for using feedback. That way you don't have to have uniform, precision components.

    -Phil

    Yes, but how can feedback be applied to the frequency determining resistor in a 555 circuit (the resistor between the Discharge pin and the Threshold/Trigger pins)?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-03 20:47
    Yes, but how can feedback be applied to the frequency determining resistor ...
    Simply by monitoring the frequency and DUTY-cycle modulating one of those FET-output optos to keep the frequency pinned to the desired value.

    -Phil
Sign In or Register to comment.