Answeredlogarithmic potentiometer

Author
brownt
Super Member
  • Total Posts : 231
  • Reward points : 0
  • Joined: 2015/11/21 14:58:09
  • Location: 0
  • Status: offline
2018/04/16 19:21:26 (permalink)
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.
#1
qɥb
Monolothic Member
  • Total Posts : 2130
  • Reward points : 0
  • Joined: 2017/09/09 05:07:30
  • Location: Jupiter
  • Status: offline
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.
 

PicForum "it just works"
#2
qɥb
Monolothic Member
  • Total Posts : 2130
  • Reward points : 0
  • Joined: 2017/09/09 05:07:30
  • Location: Jupiter
  • Status: offline
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.
 

PicForum "it just works"
#3
Jump to:
© 2018 APG vNext Commercial Version 4.5