Jump to content

Reducing the range of analog pots...


bosone

Recommended Posts

hI!

in the new midibox i will build, i'd like to use an old analog PC joystick, which mounts  10Kohm pots.

the problem is that the pots are not used in the full extension, so that, for example, i can set the minimum to be at 0 Ohm, but the maximum will reach for example only 4 or 5 KOhm.

but since mios is such a wonder, i imagine that will exist a method for "rescaling" the pots range, so that even if the pot reach 4Kohm the CC ouput will be 127...

where should i look in the mios code? is there a way to do this form the control surface after i will upload the standart

Link to comment
Share on other sites

... well that's a behaving like a 5k pot then... no?  ;)

Greets, Roger

No, it isn't! ;D

Pots are used as a potential dividers in a Midibox.

Using 10k or say 5k pot between +5v and GND give a full scale between these voltages to be converted by ADC. But if you think of a 10k pot which only moves the half way...

Anyway, you must be joking, Roger ;)

M

Link to comment
Share on other sites

One way to make this if it's just a couple of pots is to take a rail-to-rail OP amp and set it up as a non-inverting amp with a gain of 2. And maybe a trimpot to trim the gain. This way you don't have to take care of the scaling in mios.

Just a thought. MIOS AIN is 10 bit => 1024 steps full range. And your range is 0 to lets say 2.5 V => 1024/2 = 512 steps. Then to scale, just devide with 4 (not exactly, but maybe enough?)

So:

1: Take the 10Bit value from AIN (MIOS has a function called MIOS_AIN_10BitGet or something similar)

2: Just rightshift 2 times, this equals a devision with 4 (correct me if i'm wrong)

3: Then you have your aprox 7bit value  ;D

/Wise

Link to comment
Share on other sites

This is not required, Wise

The internal ADC of the PIC doesn't measure the resistance of the pot, but a voltage at the slider ("middle pin"). Regardless if you are using a 1k, 5k or 10k pot, the voltage at the slider is always within the 0V - 5V range, and this is ok for the PIC.

Resistances between 1k and 10k are ok.

Lower resistances will consume too much power

Higher resistances will lead to jittering output values

Best Regards, Thorsten.

Link to comment
Share on other sites

I know that MIOS doesen't read the resistance. But Bosone said that the joy-pot was rated 10k, but the maximum reading(at middle pin) was 4-5kohm. This is half the range of 10k, thus just 5/2 = 2.5V maximum. Range 0-2.5V at the slider (the pot will not go mecanicly from 2.5-5V). Or is it something i'm missing here ?

Regards Wise

Link to comment
Share on other sites

Isn't there a mechanical way to fix this?

However, the software solution is to multiply the value by 2, and the easiest way to realize this is to left-shift the 16bit value which is stored in MIOS_PARAMETER[23] - search for USER_AIN_NotifyChange (which is mostly located in main.asm) and add:


USER_AIN_NotifyChange
        clrc
        rlf MIOS_PARAMETER2, F
        rlf MIOS_PARAMETER3, F
[/code]

this will do the trick.

Best Regards, Thorsten.

Link to comment
Share on other sites

actually i was reather optimistic....

i managed to finally mount the joystick with the appropriate 10K resistors, and measured with an ohmmeter.

the range of the pots is about 0-1.3K ohm.

i know it is very small, but i cannot arrange the mechanism in any other way. anyway, the joystick will be only an addition, and it dont need to be extremely precise. i even looked for other kind of 10K pots, with limited range, but i didnt find them...

so, i hope to find a software solution.

i think that multipling the analog input by 8 could work.

Link to comment
Share on other sites

i finally came to the conclusion that using a rail to rail op amp would be the best solution.

in this way, i can make a switch to choose between the joystick or 2 normal 10K pots.

unfortunately, my search for a cheap joystick controller with 10K pots did not succed. i looked at elfa seller (http://www.elfa.se/en/) but while the joystick cost 11 euro, shipping is 30, so it is not viable......

so, the final question: which kind of rail to rail opamp with 2 separate input should i look for?

Link to comment
Share on other sites

so, the final question: which kind of rail to rail opamp with 2 separate input should i look for?

Any dual rail-to-rail OP should do the job. Since high bandwith, CMRR, max gain, offset etc is not a issue for you i think anyone is good enough.

If you want to use the op for a gain of 1, it should be marked something as : "stable downto a gain of 1", but I don't think this is a problem in this case.

TS1852IN , dual rail to rail

OPA337, single op, rail to rail, stable downto gain 1

just some examples...

/Wise

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...