• Forums
• Posts
Latest Posts
Active Posts
Recently Visited
Search Results
• Page Extras
• Forum Themes

Author
brownt
Super Member
• Total Posts : 287
• Reward points : 0
• Joined: 2015/11/21 14:58:09
• Location: 0
• Status: offline
0

# logarithmic potentiometer

Using a 50K MCP4341 digital pot and I would like the output to be logarithmic. The input value written to the pot is 0 - 127.

I have tried this, log10(value) * 60, which gives a fast rise at the start and then a slower rise at the end. That is what I want, but I wonder if there is a better way than *60.

Also I would like the option to have a slow rise at the start and a faster rise at the end. How is that done.

qɥb
Monolothic Member
• Total Posts : 2983
• Reward points : 0
• Joined: 2017/09/09 05:07:30
• Location: Jupiter
• Status: online
Re: logarithmic potentiometer 2018/04/16 20:39:59 (permalink) ☼ Best Answerby brownt 2018/04/16 23:19:31
0
brownt
Using a 50K MCP4341 digital pot and I would like the output to be logarithmic. The input value written to the pot is 0 - 127.

I have tried this, log10(value) * 60, which gives a fast rise at the start and then a slower rise at the end. That is what I want, but I wonder if there is a better way than *60.

So you are trying to scale a 0-127 value to give you a 0-127 output with a log curve?
You can't take LOG10 of zero, so "log10(value+1) * 60" would be safer, although that only gets to 126, not 127.

Also I would like the option to have a slow rise at the start and a faster rise at the end. How is that done.

You change from "log" to "antilog", i.e. by using a power function.
something like:
(1.039 ^ value)-1
will give an output of 0 to 127 for inputs from 0 to 127.

This forum is mis-configured so it only works correctly if you access it via https protocol.
The Microchip website links to it using http protocol. Will they ever catch on?
PicForum "it just works"
qɥb
Monolothic Member
• Total Posts : 2983
• Reward points : 0
• Joined: 2017/09/09 05:07:30
• Location: Jupiter
• Status: online
Re: logarithmic potentiometer 2018/04/16 22:24:15 (permalink)
0
n.b., just a lookup table might be better than all this floating point math.

This forum is mis-configured so it only works correctly if you access it via https protocol.
The Microchip website links to it using http protocol. Will they ever catch on?
PicForum "it just works"