# Realizing sinusoidally time varying resistance by digital potentiometer

#### shivashankar_p

Joined Nov 10, 2015
50
I need to implement a time-varying resistor for one of my studies. The Resistance must be of the form R=R0+Rm*sin(W*t), with R0-Rm>0. I am planning to implement this with a digital potentiometer (controlling it with a sinusoidal signal). I haven't tried this yet, and I am wondering whether this is a right way to implement this.

#### crutschow

Joined Mar 14, 2008
34,062
I am planning to implement this with a digital potentiometer (controlling it with a sinusoidal signal).
What resistive resolution do you need?
Obviously the sinusoidal signal would need to be in binary format to control the digital potentiometer.
How will you generate this digital signal?

#### Ian0

Joined Aug 7, 2020
9,523
If you have a digital pot with up-down inputs rather than binary inputs, then you could use an analogue reference sinewave and a comparator.

#### DickCappels

Joined Aug 21, 2008
10,124
In another thread, somebody recently recommended using a multiplying DAC such as the low cost Analog Devices DAC08 and drive the reference input with a sine wave.

#### crutschow

Joined Mar 14, 2008
34,062
In another thread, somebody recently recommended using a multiplying DAC such as the low cost Analog Devices DAC08 and drive the reference input with a sine wave.
The TS wants a time-varying resistance, not voltage.

#### crutschow

Joined Mar 14, 2008
34,062
If you have a digital pot with up-down inputs rather than binary inputs, then you could use an analogue reference sinewave and a comparator.
How would that generate a sinewave change in the resistance value?

#### Alec_t

Joined Sep 17, 2013
14,228
What are typical values for R0 and Rm? Are we talking milliOhms, kilOhms, MegOhms? .....?
What frequency?

#### Irving

Joined Jan 30, 2016
3,810
I need to implement a time-varying resistor for one of my studies. The Resistance must be of the form R=R0+Rm*sin(W*t), with R0-Rm>0. I am planning to implement this with a digital potentiometer (controlling it with a sinusoidal signal). I haven't tried this yet, and I am wondering whether this is a right way to implement this.
Is this a physical resistance or a theoretical one for use in a simulation?

#### Ian0

Joined Aug 7, 2020
9,523
How would that generate a sinewave change in the resistance value?
I should have mentioned it needs a dual pot.
One pot plus the comparator make a delta-sigma modulator. The other pot gives the variable resistance.
It requires the type of digital pot with a clock and up/down input.

#### shivashankar_p

Joined Nov 10, 2015
50
What resistive resolution do you need?
Obviously the sinusoidal signal would need to be in binary format to control the digital potentiometer.
How will you generate this digital signal?
I am still not sure of the exact specifications. Mostly, I may choose a 5K POT with 256 steps for a maximum resolution.
I am thinking of using a Arduino for the digital sinusoidal signal.

#### shivashankar_p

Joined Nov 10, 2015
50
What are typical values for R0 and Rm? Are we talking milliOhms, kilOhms, MegOhms? .....?
What frequency?
In Kilo-Ohms.

#### shivashankar_p

Joined Nov 10, 2015
50
Is this a physical resistance or a theoretical one for use in a simulation?
Physical resistance for some experiments.

#### shivashankar_p

Joined Nov 10, 2015
50
I should have mentioned it needs a dual pot.
One pot plus the comparator make a delta-sigma modulator. The other pot gives the variable resistance.
It requires the type of digital pot with a clock and up/down input.
View attachment 256510
Thanks for the suggestion.

I am thinking of using an Arduino and a MCP41 POT. What do you think about that? It seems to be a simple and straightforward compared to UP/DOWN.

#### Irving

Joined Jan 30, 2016
3,810
Arduino + MCP41 etc. seems a reasonable approach within its limitations. Can you give more info regarding purpose of the 'resistor'? Also likely current & voltage levels?

#### Ian0

Joined Aug 7, 2020
9,523
Thanks for the suggestion.

I am thinking of using an Arduino and a MCP41 POT. What do you think about that? It seems to be a simple and straightforward compared to UP/DOWN.
A better solution if you have a method of generating a digital sinewave.

#### crutschow

Joined Mar 14, 2008
34,062
To generate the digital sinewave, you could put a look-up table with 128 bytes of amplitude for a 0-90° sine into EEPROM storage (90/128 degree steps).
You can then use those to generate a 256 step DAC output of a 360° sinewave.

#### Ian0

Joined Aug 7, 2020
9,523
To generate the digital sinewave, you could put a look-up table with 128 bytes of amplitude for a 0-90° sine into EEPROM storage (90/128 degree steps).
You can then use those to generate a 256 step DAC output of a 360° sinewave.
A few years ago, I would have written the code to reverse the first 128 steps for the second 128, then negate the first 256 for the second 256, and it would save be 384 bytes of memory. How much is 384 bytes of memory these days?
Now I think nothing of using a 4096 step look-up table with 16-bit coefficients.

#### crutschow

Joined Mar 14, 2008
34,062
Now I think nothing of using a 4096 step look-up table with 16-bit coefficients.
I'm naturally conservative in using a micro's resources, but using a full look-up table is likely not a problem for most micro's today.
But since the TS it proposing using an 8-bit digital pot I see no reason to store more than one byte per step for 512 bytes total.