Question about digital pots and PICs

Started by pappasmurfsharem, August 29, 2013, 11:55:29 PM

Previous topic - Next topic

pappasmurfsharem

I'm wanting to tap tempo a particular tremolo pedal.

My assumption is I need an equal value digital pot to replace the real pot (which is used as a variable resistor in this particular pedal)

I assume I would also need to go about programming a PIC so that it's calibrated to how the pedal responds to varying degrees of resistance.

Looking at these DigiPots on mouser http://www.mouser.com/Semiconductors/Integrated-Circuits-ICs/Digital-Potentiometer-ICs/_/N-6j752?P=1z0yz4qZ1z0z7v3Z1yzmno6&Ns=Taps%20per%20POT|1

Questions:
1. Is there a particular digital interface I should be looking for.
2. Does number of "TAPS per pot" mean the "resolution" of the pot, how many possible subdivisions the digital pot can be set to?
3. What PIC would be a good starting point?
"I want to build a delay, but I don't have the time."

Gurner

#1
1. Up/Down is the simplest (i.e. if you've never programmed before), then SPI ...with I2C being the most involved (not massively complicated, but you'll have to sit down ina quiet corner for a little while & wrap your head around it all!)
2. Yes.
3, Any PIC that has at least SPI interface built in.....I'm quite partial to PIC16F1824 (which was fairly new up until I stopped dabbling about a year ago - but there may be newer PICs out there now)  ...but there are heaps of suitable PICs out there

Bear in mind you'll need a digipot with a log characteristic (not linear) ....they are less common & more expensive.




pappasmurfsharem

Quote from: Gurner on August 30, 2013, 06:31:05 AM
1. Up/Down is the simplest (i.e. if you've never programmed before), then SPI ...with I2C being the most involved (not massively complicated, but you'll have to sit down ina quiet corner for a little while & wrap your head around it all!)
2. Yes.
3, Any PIC that has at least SPI interface built in.....I'm quite partial to PIC16F1824 (which was fairly new up until I stopped dabbling about a year ago - but there may be newer PICs out there now)  ...but there are heaps of suitable PICs out there

Bear in mind you'll need a digipot with a log characteristic (not linear) ....they are less common & more expensive.

Any reason a log is needed? The pot in the pedal is linear
"I want to build a delay, but I don't have the time."

Digital Larry

I'm a bit concerned here.

The original pot is probably controlling a 3-cap phase shift LFO.  (post or link a schematic if you can).  There's not necessarily a straightforward relationship between this pot's resistance and the LFO frequency, although by general rules as the pot goes down in value the speed goes up.  My recommendation would be to have the PIC generate your LFO waveform directly.
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

R.G.

Quote from: pappasmurfsharem on August 29, 2013, 11:55:29 PM
1. Is there a particular digital interface I should be looking for.
Any works, as long as the uC either has the interface built in, or you can do the programming to make the bits be the right timing (this is called 'bit-banging' in the uC biz).

Quote2. Does number of "TAPS per pot" mean the "resolution" of the pot, how many possible subdivisions the digital pot can be set to?
Yes - taps per pot means "number of positions the pot can be set to".

Quote3. What PIC would be a good starting point?
In general, this depends on other things.

As a general comment on the problem, D.L. has the right idea. Once you have taken the step over the uC threshold, generate the LFO directly in the uC unless there is some huge reason not to do so. There are a number of new PICs with numerically-controlled-oscillator hardware built in that make this vastly easier to do than it used to be.  The magic secret in applying microcontrollers usually lies in reading the lists of pins, peripherals, and speeds and picking the cheapest one that has just enough to do your job. After that, it's all a simple matter of programming (that's a programmer's cynical joke about management's perspective, btw).

For what you're doing, you have other problems. The speed of a phase shift LFO is not simple to compute. You need to either build it, then measure what the component tolerances give you, or adjust the parts with trimmers, or to use super-precision parts and the dollars that implies. For something like tap tempo, generating the frequency digitally based on a sensed tap interval is far simpler in concept once you can program. As an aside, the proper taper for the pots in a phase shift oscillator is reverse audio to spread the knob rotation out to linear - which of course doesn't matter at all if a uC is generating the timing.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

pappasmurfsharem

Quote from: Digital Larry on August 30, 2013, 08:59:20 AM
I'm a bit concerned here.

The original pot is probably controlling a 3-cap phase shift LFO.  (post or link a schematic if you can).  There's not necessarily a straightforward relationship between this pot's resistance and the LFO frequency, although by general rules as the pot goes down in value the speed goes up.  My recommendation would be to have the PIC generate your LFO waveform directly.

Its the Earth Quaker Devices Hummingbird, which is basically a modified VOX Repeat Percussion.
http://analogguru.an.ohost.de/193/schematics/Vox_RepeatPercussion.gif

http://tagboardeffects.blogspot.com/2013/04/earthquaker-devices-hummingbird.html
I can't open the tagboard link at work to get the pull image path.

There doesn't appear to be a scheme for this, I saw it on the other forum but a scheme was never posted.

Quote from: R.G. on August 30, 2013, 10:22:35 AM
Quote from: pappasmurfsharem on August 29, 2013, 11:55:29 PM

For what you're doing, you have other problems. The speed of a phase shift LFO is not simple to compute. You need to either build it, then measure what the component tolerances give you, or adjust the parts with trimmers, or to use super-precision parts and the dollars that implies. For something like tap tempo, generating the frequency digitally based on a sensed tap interval is far simpler in concept once you can program. As an aside, the proper taper for the pots in a phase shift oscillator is reverse audio to spread the knob rotation out to linear - which of course doesn't matter at all if a uC is generating the timing.


I just assumed I would just set the digipot to all 256 variable settings and aproximate the tempo at each resistance change.
"I want to build a delay, but I don't have the time."

R.G.

Quote from: pappasmurfsharem on August 30, 2013, 11:23:01 AM
Its the Earth Quaker Devices Hummingbird, which is basically a modified VOX Repeat Percussion.
Ah.

Yes, that's a different animal. If it meets your needs to have one of 256 speeds and pick the closest one to whatever was tapped, sure. Easy peasey.

Use the uC to read the tap switch, calculate the time between taps to use. The timing will be in discrete steps, and will depend directly on the timing capacitance.

Note that there will be some error in the process of setting timing. the timing depends directly on both the settable pot (and any series resistances) and the value of the timing cap. The timing cap is an NP electrolytic, which has maybe 10% tolerance to start with, and changes as it ages. Unless you build in a way to read the actual timing you get and do some corrections, the timing you get will be in error by typically half of a 1/256th step on top of the 10% tolerance error in the cap. If this error budget is OK, you're fine.

Tremolo, phaser, and other runs-all-the-time LFO effects have issues with the accuracy of tap tempo setups that delays don't, as the perceived accuracy of a delay is only measured over the length of a delay plus repeats ( a couple of seconds, maybe) while the runs-all-the-time stuff has to stay accurate and any errors accumulate if they're measured against the beat of the song. If you're just looking for a handy alternative to pot-turning with no particular implied accuracy, this isn't an issue.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Gurner

#7
Quote from: pappasmurfsharem on August 30, 2013, 08:52:48 AM
Quote from: Gurner on August 30, 2013, 06:31:05 AM
1. Up/Down is the simplest (i.e. if you've never programmed before), then SPI ...with I2C being the most involved (not massively complicated, but you'll have to sit down ina quiet corner for a little while & wrap your head around it all!)
2. Yes.
3, Any PIC that has at least SPI interface built in.....I'm quite partial to PIC16F1824 (which was fairly new up until I stopped dabbling about a year ago - but there may be newer PICs out there now)  ...but there are heaps of suitable PICs out there

Bear in mind you'll need a digipot with a log characteristic (not linear) ....they are less common & more expensive.

Any reason a log is needed? The pot in the pedal is linear

My mistake ...I read your first line...saw you wanted to make a tremolo & figured you were rolling your own - I shoulda read your whole post!

I went through a whole digipot learning process about two years ago - if you want a low part count tremolo using a PIC & a digipot, you do need a log taper, but obviously if you are wanting to put a digipot in place of an existing linear pot in a circuit, then yes, it should be linear too!

Galego

Quote from: Gurner on August 30, 2013, 04:46:34 PM
My mistake ...I read your first line...saw you wanted to make a tremolo & figured you were rolling your own - I shoulda read your whole post!

I went through a whole digipot learning process about two years ago - if you want a low part count tremolo using a PIC & a digipot, you do need a log taper, but obviously if you are wanting to put a digipot in place of an existing linear pot in a circuit, then yes, it should be linear too!

Are there logarithmic digipots? And why would you need them? Just make a lookup table with values to simulate a logarithmic curve and you can use a linear digipot.

Gurner

#9
Quote from: Galego on August 31, 2013, 11:41:04 AM
Quote from: Gurner on August 30, 2013, 04:46:34 PM
My mistake ...I read your first line...saw you wanted to make a tremolo & figured you were rolling your own - I shoulda read your whole post!

I went through a whole digipot learning process about two years ago - if you want a low part count tremolo using a PIC & a digipot, you do need a log taper, but obviously if you are wanting to put a digipot in place of an existing linear pot in a circuit, then yes, it should be linear too!

Are there logarithmic digipots? And why would you need them? Just make a lookup table with values to simulate a logarithmic curve and you can use a linear digipot.

Yes there are LOG digipots out there (they aren't as common & therefore cost a little more)  ...& yes, sure you can use a lookup table to make a linear pot more akin to a pseudo-log pot, but that just adds overhead to your code ....*but* the main reason for not going the lookup table way is because you lose an HUGE amount of resolution - your 256 tap linear pot becomes something crazily low resolution like a 32 tap log pot.

A useful maxim in life that I try to follow, is to buy the thing you need in the first place vs. trying to make do (especially when it's only $1 more)

Digital Larry

Gurner beat me to it, but simple example...

I want a 60 dB digit pot, 1 dB steps.

-60 dB = 1/1000.

1 step on a 256 step linear pot would be 20 log(1/256) = -48 dB.  That's with > 4 times as many steps!  You can do it but you won't get the range and the steps won't be spaced nicely like you want them.  The first 50% of the taps on a linear are spent just getting to - 6dB.
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

R O Tiree

The other snag with digital pots is that, for many of them, the current through the "wiper" pin must not exceed 1mA, or thereabouts. If it does so, then the chip fries itself. You can get chips with higher spec max currents but, once again, it will cost you.
...you fritter and waste the hours in an off-hand way...

R.G.

Digital pots have their own issues.

When you step asynchronously from the signal voltage, the pot moves between output levels at a rate that may as well be instantaneous compared to audio. This is something like a hard contact switch making or breaking. The signal voltage level changes instantly, and that's heard as a -gritch-. It's less with digital pots, but still there. You can minimize this if you change gains only when the signal level is nearly at a zero crossing, and indeed, some specially-designed digital pots do this for you.

But even with that going on, if you are slewing between two levels and update the pot value to a new one every so often, there is a perceptible change in gain on a regular basis. Good ears hear this. So a series of -gritch- noises at a regular timing or more subtly a gain change on a regular basis can be heard as what has been called "zipper noise".

The slickest way I ever saw to sidestep these issues was to go ahead and do the digitpot, but use it to make a DC voltage signal, and then use an analog control circuit to drive a center tapped LDR as a linear servo to follow the digipot output. The LDR is slow enough to give no noise and slew smoothly.

This adds some complexity of course.  :)

Might be simpler to do a switched capacitor variable resistor and change gain that way; at least if you keep the switching frequency above the Nyquist limit, you won't hear it. There are complexity issues with that too.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.