|HOME| |DIY FAQ| |GEO FAQ| |Debugging Page| |Links| |Schematics| |Wiki| |Layouts Gallery| |STORE|
|AMPAGE| |GEOFEX| |AMZ|

Welcome, Guest. Please login or register.
Did you miss your activation email?
December 17, 2014, 09:59:26 PM
977726 Posts in 104059 Topics by 33386 Members
Latest Member: luthiernc
Home Help Login Register
DIYstompboxes.com  |  DIY Stompboxes  |  Digital & DSP  |  Precision current control with Digital Potentiometers 0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 4 Go Down Print
Author Topic: Precision current control with Digital Potentiometers  (Read 26710 times)
MoltenVoltage
Posts: 741


Cascade Range, Oregon


WWW
Precision current control with Digital Potentiometers
« on: October 25, 2010, 09:58:53 PM »

Everyone familiar with the PT2399 knows that you vary the delay time with a resistance.  There are a couple chips floating around that perform this function using a digital potentiometer whose resistance is set based on a tap tempo input.

The problem is that digital potentiometers have even worse tolerances than mechanical ones, sometimes +/- 30%.

Suddenly your calculated delay time can sound like triplets instead of 1/8th notes.

There are some brute force methods of minimizing these errors, none of which are very practical (e.g. hand-sorting large batches of digipots).

I thought that maybe putting 2 100K pots (which read 70K each for a total of 140K) with a resistor in parallel would solve the problem until I made a spreadsheet and found that the errors don't exist at 0 and 100, but they get larger and larger until you get to 50% where they peak.  With a 140K resistance scaled down the error is over 8%, so the problem is slightly less, but not much.  Of course the further off your initial resistance, the greater the error.

I've read all the microchip app notes but can't find anything that solves the problem of precision programmed current control. 

Being a programmer primarily, I assumed that a "digital potentiometer" would have "digital precision", until I had them on the breadboard and read the nominal resistance of a batch of 100K pots at 70-80K average.  This makes consistent precision control of the PT2399 a challenge.

The other thing I've noticed is that I can never get precise reads on the nominal resistance.  It changes from multimeter to multimeter, and when I perform current tests using the nominal resistance and a known voltage, it can be 5% off from the calculated value.

So, the questions remaining are:

1) How to achieve precision resistance values using digital potentiometers

2) How to get consistent readings of the resistance of digital potentiometers

Hopefully 19,000 heads are better than one!  Thanks!
Logged

MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!
JKowalski
Posts: 1137


Chris S.


WWW
Re: Precision current control with Digital Potentiometers
« Reply #1 on: October 25, 2010, 11:53:25 PM »

I've read all the microchip app notes but can't find anything that solves the problem of precision programmed current control. 

Why don't you just use a precision DAC with the required analog components to use the output to control the PT2399 pin?

 It doesn't have to be a resistance change.


I think digital pots are mainly used for controlling volumes of audio signals & similar where total resistance isn't that important...
« Last Edit: October 25, 2010, 11:56:10 PM by JKowalski » Logged
cloudscapes
Posts: 835


Etienne B


Re: Precision current control with Digital Potentiometers
« Reply #2 on: October 26, 2010, 06:18:45 AM »

I second the precision DAC idea. 12 bit is probably enough for something that's foot-tapped. DACs won't give you the three-lug pot digital pots will, but I don't think that's needed with the 2399, if I recall.
Logged

~~~~~~~~~~~~~~~~~~~~~~
{DIY blog}
{www.dronecloud.org}
MoltenVoltage
Posts: 741


Cascade Range, Oregon


WWW
Re: Precision current control with Digital Potentiometers
« Reply #3 on: October 26, 2010, 10:47:15 AM »

Thanks for the responses.

I don't think you can just apply a varying voltage to Pin 6, but I may be wrong.

I looked at the datasheet and it does say that Pin 6 is a VCO frequency adjustment:
"Overall delay time is determined by internal VCO clock frequency, and user can easy to change the VCO frequency by changing the external resistance."

However, Pin 6 is a current drain to ground, and I don't think can just put a voltage onto a pin that is expecting a current drain to ground.

The only other way that I know of to control current using a voltage is with an FET, but then you are just trading one problem for another since they are at least as variable as the digipots.

Chris, were you thinking of an FET when you said "required analog components"?
Logged

MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!
pjwhite
Posts: 206


Paul W.


WWW
Re: Precision current control with Digital Potentiometers
« Reply #4 on: October 26, 2010, 01:05:04 PM »

I'll offer a third vote for a DAC.  Even an 8-bit DAC would probably be good enough.  You could use a current-output DAC, but a voltage-output DAC with a resistor in series with the output would probably work as well.

Looking at the data sheet for that delay chip, it appears that the delay time is not related linearly to the control resistance.  I also doubt that the numbers given in the data sheet for delay vs resistance are very accurate or consistent from one device to the next.  The VCO must use one of the external capacitors in the oscillator circuit, and the frequency accuracy would be directly tied to the tolerance of this cap.

If you're looking to get precise control of the delay time, I would say that you should find a pin on the PT2399 where you can pick up the VCO frequency output and measure it against a crystal controlled reference.  Then, using successive approximation, adjust the VCO control DAC until you get the exact frequency you want.

I don't think there's any way that blindly setting a resistance value on the VCO control pin will ever give you an exact 100.00ms delay.
Logged
octfrank
Posts: 120


WWW
Re: Precision current control with Digital Potentiometers
« Reply #5 on: October 26, 2010, 09:58:03 PM »

I would vote against a DAC here, given the VCO uses a single resistor to set speed and the speed increases as the resistance decreases I would guess it is some form of current starved VCO in which case the speed is controlled by the current allowed to flow through pin 6. Pin 5 says it is a clock out so monitoring that and adjusting the current allowed to flow through pin 6 would probably be the best solution.
Logged

Frank Thomson
Experimental Noize
cloudscapes
Posts: 835


Etienne B


Re: Precision current control with Digital Potentiometers
« Reply #6 on: October 27, 2010, 05:49:40 AM »

I did it once by driving an NPN with an AVR's PWM (like a DAC) which in turn starved the 2399's VCO. worked like a charm, though a lot of biasing was needed. and I wasn't doing tap so wasn't interested in acuracy.
Logged

~~~~~~~~~~~~~~~~~~~~~~
{DIY blog}
{www.dronecloud.org}
MoltenVoltage
Posts: 741


Cascade Range, Oregon


WWW
Re: Precision current control with Digital Potentiometers
« Reply #7 on: October 27, 2010, 11:42:47 PM »

Monitoring the pin 5 output is a great idea, as I checked that it varies proportionally to the Pin 6 resistance BUT the clock is between 1 and 17Mhz.  Calculating those speeds is beyond the reach of my 40MIPS chip.

Maybe some sort of high speed phase lock loop system could resolve those speeds - in a manner similar to the FM tuner auto-tune function?  Just thinking out loud with very little practical knowledge of how those systems work.
Logged

MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!
JKowalski
Posts: 1137


Chris S.


WWW
Re: Precision current control with Digital Potentiometers
« Reply #8 on: October 28, 2010, 12:56:51 AM »

Monitoring the pin 5 output is a great idea, as I checked that it varies proportionally to the Pin 6 resistance BUT the clock is between 1 and 17Mhz.  Calculating those speeds is beyond the reach of my 40MIPS chip.

Maybe some sort of high speed phase lock loop system could resolve those speeds - in a manner similar to the FM tuner auto-tune function?  Just thinking out loud with very little practical knowledge of how those systems work.

Yeah, a phase locked loop would work. That would basically give you the ability to clock the PT2399 externally.

PLL's are pretty finicky circuits to design. But it is doable. Another plus with PLLs is that you can stick a frequency divider chip in the loop to multiply the frequency input - enabling you to input much lower speeds to get the right high speed clock output on the PT2399. So you can probably use your aforementioned 'chip'.
Logged
MoltenVoltage
Posts: 741


Cascade Range, Oregon


WWW
Re: Precision current control with Digital Potentiometers
« Reply #9 on: October 28, 2010, 03:17:02 AM »

I already tried using a 4017 to divide the clock frequency (I was going to cascade 2 to divide by 100), but the clock output of the PT2399 gets really lousy below about 10MHz - very non-sinusoidal with extra peaks, and it just gets worse from there down to 1MHz.  As a result, the 4017 gets the count wrong.  I assume a PLL circuit would have the same problem.  I doubt a schmitt trigger could even clean it up, as the clock's waveform distortion gets really severe at the lower speeds.  I suppose I could chart the count errors and make a table for the dsPIC to read, but that seems like a very in-elegant answer.

I also tried putting a voltage into pin 6 (with and without a series resistor) and it wouldn't delay at all until the voltage got near zero, then it was just acting as a current drain again.

Logged

MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!
ElectricDruid
Posts: 139


Tom W.


WWW
Re: Precision current control with Digital Potentiometers
« Reply #10 on: October 28, 2010, 12:13:35 PM »

Interesting problem.

The 'Use a DAC' approach is definitely viable. Here's a couple that'd do the job:

http://www.maxim-ic.com/datasheet/index.mvp/id/4806
http://www.analog.com/en/digital-to-analog-converters/da-converters/ad5398a/products/product.html

These are both 'current sink' DACs, so could be connected directly to the PT2399.

Alternatively, the datasheet for the Microchip MCP4821/4822 series DACs has details on building a programmable current source:

http://ww1.microchip.com/downloads/en/devicedoc/21953a.pdf (page 25)

This would work with a lot of other DACs too.

Hope this gives you a few ideas!

Regards,
Tom
Logged
slacker
Posts: 5553

Ian M. - England


Re: Precision current control with Digital Potentiometers
« Reply #11 on: October 28, 2010, 12:42:47 PM »

According to Merlinb you can control it with voltage in the range 0 - 2.5 volts, have a look here http://www.diystompboxes.com/smfforum/index.php?topic=87543.0 never tried it myself.

Not that I have any programming skills, but my thought was to use the clock out for error correction, but it seems like that's probably not doable.
Here's another idea that will probably work, very brute force though. Use a digipot, or whatever to control pin 6, then have another output from you uC that sends a pulse to the input of the PT2399, and another to read from the output. Set the digipot to some resistance say 1k, fire a pulse through the PT2399, calculate how long it took. Repeat over a range of resistances. Don't know what you'd do with data after you'd collected it, presumably you could use it to do some sort of lookup table or for error correction. I guess you could do this each time the pedal was turned on or store it somehow.

Probably be easier if we all just stopped trying to make the old PT2399 do stuff it's not designed to do and embraced something like the FV-1.
« Last Edit: October 28, 2010, 12:44:35 PM by slacker » Logged
puretube
Posts: 7208


but, err, I`m not really here...


WWW
Re: Precision current control with Digital Potentiometers
« Reply #12 on: October 28, 2010, 03:08:42 PM »

Probably be easier if we all just stopped trying to make the old PT2399 do stuff it's not designed to do and embraced something like the FV-1.

This! +/- 1 clock-pulse...  icon_smile
Logged

MoltenVoltage
Posts: 741


Cascade Range, Oregon


WWW
Re: Precision current control with Digital Potentiometers
« Reply #13 on: October 28, 2010, 03:52:22 PM »

I went back and did some more tests (since I don't always get the best results at 3 a.m.), and found that the 4017 actually does a decent job of dividing the clock output across the range that matters for a tap input.  I calculated an error of between 1 and 3 percent, but some of that could very well be due to my frequency counter.

It's worth noting that the 4017 hits a very definite ceiling at 10MHz, at which point it just stops counting.

I was hoping the FV-1 would work, but I really want something that can do at least 1 second of delay, and the PT2399 is the only practical solution I can find.

Also, since tayda sells the PT2399 for $.54 each (thanks frequency central!), it makes it a very attractive component.

Now I just hope the relationship between delay time and clock frequency is linear.  icon_eek

Sincerest thanks for all the feedback!
Logged

MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!
puretube
Posts: 7208


but, err, I`m not really here...


WWW
Re: Precision current control with Digital Potentiometers
« Reply #14 on: October 28, 2010, 04:11:43 PM »

I was hoping the FV-1 would work, but I really want something that can do at least 1 second of delay, and the PT2399 is the only practical solution I can find.

...makes 2 seconds if using the Mark Hammer/Bill Rupert/puretube - trick... (=1st channel out to 2nd channel in)

[edit]: insert:  icon_rolleyes
« Last Edit: October 28, 2010, 04:14:18 PM by puretube » Logged

MoltenVoltage
Posts: 741


Cascade Range, Oregon


WWW
Re: Precision current control with Digital Potentiometers
« Reply #15 on: October 29, 2010, 12:03:23 PM »

Since the FV-1 has 32K ram, doesn't that limit the total time @ 44.1kHz to about .72 seconds, whether you are using one channel or two, or does each channel have its own 32K ram bank?

Logged

MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!
Kindly Killer
Posts: 24


Re: Precision current control with Digital Potentiometers
« Reply #16 on: October 29, 2010, 01:51:57 PM »

I just hacked my second Fab Echo with the Taptation kit from the store. The first one is spot on - perfect sync, but the layout and footswitch I used are not really road-worthy.

Which inspired me to do another, nicer one, which of course is out of sync to the point that is neither fish nor foul - tap doesn't work but it's not quite as good as a DMM, soo....

I'm wondering - the delay times on mine are a little short of what they are supposed to be; would it work to just put a trimpot inline with the wire that goes to pin 6 of the pt2399? Or is it off by a different amount at every time.
Logged
slacker
Posts: 5553

Ian M. - England


Re: Precision current control with Digital Potentiometers
« Reply #17 on: October 29, 2010, 02:09:15 PM »

It will be out by different times for different speeds. Adding a trim will just let you add a fixed amount of time, you might find a setting of the trim that is good enough for a range of times, but it will never be exact.
Logged
Taylor
Posts: 3944

The clean energy source of the future.


Re: Precision current control with Digital Potentiometers
« Reply #18 on: October 29, 2010, 02:38:03 PM »

I was hoping the FV-1 would work, but I really want something that can do at least 1 second of delay, and the PT2399 is the only practical solution I can find.

...makes 2 seconds if using the Mark Hammer/Bill Rupert/puretube - trick... (=1st channel out to 2nd channel in)

Don't see the explanation of your trick other than the parenthetical statement there, but that's not the way to get 2 seconds. Converting a-d-a twice doesn't make any sense when you can just lower the sampling rate to 16k, which is what you're doing with the stereo trick anyway, except with higher fidelity.


Since the FV-1 has 32K ram, doesn't that limit the total time @ 44.1kHz to about .72 seconds, whether you are using one channel or two, or does each channel have its own 32K ram bank?



Yes, but you don't need to sample that high. The FV1 is way nicer sounding at 1 second(32k sample rate) than the PT2399 is at the same length. With a little filtering you can get a nice clean 2-second delay, as noted above, by using a 16k xtal. I have actually played around with getting much more time out of the chip than that even - with software sample rate reduction you can get a usable 8 seconds out of it, or if you're nasty, a whole minute.  Smiley

You might say you want more fidelity than 32k sample rate will give you, but the PT2399 just plain does not give more fidelity than the FV1 at 1 second. And no guitar speaker goes to 16k anyway.

BTW, Karl, I have no problem with you and don't want to stir anything up - just curious if this is homework for a commercial device?
« Last Edit: October 29, 2010, 02:42:12 PM by Taylor » Logged

MoltenVoltage
Posts: 741


Cascade Range, Oregon


WWW
Re: Precision current control with Digital Potentiometers
« Reply #19 on: October 29, 2010, 03:04:41 PM »

You're right about the long delay times on the PT2399, they do sound pretty lousy (at least in the rebote), but the short delay times sound really good, the chip is very inexpensive, and there already exist multiple layouts and projects.

Maybe I'm wrong, but I don't think a 16K sampling rate translates directly into a max audio frequency of 16 kHz.  You also have to look at the bitrate which, if I understand Frank right, is limited to 14 bits on the FV-1.

The other reason I hesitate to develop a controller for the FV-1 is that I think most people are intimidated by having to code the FV-1 themselves (I'm not in any hurry to learn another device).  If there were out-of-the-box presets that were long pure delays, I would be much more motivated to come up with something.  hint hint Frank!
« Last Edit: October 29, 2010, 06:26:23 PM by MoltenVoltage » Logged

MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!
Pages: [1] 2 3 4 Go Up Print 
« previous next »
Jump to: