bosone Posted April 26, 2005 Report Share Posted April 26, 2005 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 Quote Link to comment Share on other sites More sharing options...
Screaming_Rabbit Posted April 26, 2005 Report Share Posted April 26, 2005 Officially it has to be 10k and that's the answer Thorsten gave in other postings regarding Pot-resistance. But I've seen postings where other users took 5k pots and they worked. So... trial and error :-\Greets, Roger Quote Link to comment Share on other sites More sharing options...
bosone Posted April 26, 2005 Author Report Share Posted April 26, 2005 perhaps i was not clear: the pots will be rated 10K, but they will work at half their range (let's say, they will do only hald turns instead of full turns...) Quote Link to comment Share on other sites More sharing options...
Screaming_Rabbit Posted April 26, 2005 Report Share Posted April 26, 2005 ... well that's a behaving like a 5k pot then... no? ;)Greets, Roger Quote Link to comment Share on other sites More sharing options...
moebius Posted April 26, 2005 Report Share Posted April 26, 2005 ... well that's a behaving like a 5k pot then... no? ;)Greets, RogerNo, it isn't! ;DPots 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 Quote Link to comment Share on other sites More sharing options...
Screaming_Rabbit Posted April 26, 2005 Report Share Posted April 26, 2005 Anyway, you must be joking, Roger ;)M.. NOOOOOOOOO I wasn't joking, I was stupid enough to believe what I was writing 8)Thank U for clearing up, Moebius! You know, I still have enough to learn :)@Bosone: Sorry for the missleading :-\Greets, Roger Quote Link to comment Share on other sites More sharing options...
Wise Posted April 27, 2005 Report Share Posted April 27, 2005 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 Quote Link to comment Share on other sites More sharing options...
TK. Posted April 30, 2005 Report Share Posted April 30, 2005 This is not required, WiseThe 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 powerHigher resistances will lead to jittering output valuesBest Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Wise Posted April 30, 2005 Report Share Posted April 30, 2005 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 Quote Link to comment Share on other sites More sharing options...
TK. Posted April 30, 2005 Report Share Posted April 30, 2005 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. Quote Link to comment Share on other sites More sharing options...
bosone Posted May 1, 2005 Author Report Share Posted May 1, 2005 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. Quote Link to comment Share on other sites More sharing options...
bosone Posted May 6, 2005 Author Report Share Posted May 6, 2005 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? Quote Link to comment Share on other sites More sharing options...
Wise Posted May 6, 2005 Report Share Posted May 6, 2005 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 railOPA337, single op, rail to rail, stable downto gain 1just some examples.../Wise Quote Link to comment Share on other sites More sharing options...
moebius Posted May 6, 2005 Report Share Posted May 6, 2005 ...yeah,probably only thing to look for is the gain stability issue.Bye, Moebius Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.