View Full Version : Resistance to Analog Input Value.

Josh Hambright
04-01-2003, 06:21 PM
What is the resistance that equals 1 on the analog input...

Like how can i figure out what resistance would change the value by 1...without cracking out a multimeter and a robot controller and the dashboard program.

Joe Ross
04-01-2003, 09:09 PM
The Analog inputs accept values from 0 to 5v. The potentiometers we use are from 0 to 100k. The robot controller displays values from 0 to 255. 100k/255 equals the answer that you want.

However, that is an approximation, and not a very good one at that. Pull out that multimeter :p

04-01-2003, 11:07 PM
Also, no resistor is going to be accurate enough to let you get an exact value. Most resistors have either gold or silver bands indicating either 5 or 10% error, respectively. Thus, a 50k ohm resistor could be anywhere between 45k (approx value 115) and 55k (approx value 140). Or maybe it's the other way around...

In any event, don't count on being able to get +/- 1 for accuracy.

Mike Betts
04-02-2003, 06:42 AM
Also, realize that, while voltage to counts is linear, resistance to counts is not linear. This is due to the input impedance of the analog input changing the ideal resistor divider of the pot.

For most users, this is not a problem but you seem to be doing some precision work if you are asking for 1 count.

Lastly, remember that there is a quantization error involved...

Josh Hambright
04-02-2003, 07:15 AM
No i'm not trying to count from one...but we ran out of digital inputs...so i am going to use analog inputs to detect switches for autonomous mode selection...

Basicly its the same principle as a Digital to Analog Converter.. or along those lines....

I have a rotary switch and i'm going have a different resistor on each switch, Basicly then you can sense the value of the analog input that its hooked upto and it will return a value, basicly i am making a pot that has predetermined values instead of constantly changing values...i didn't explain it very well...

I am then going to have bigger resistors in serise with it to add a bunch of resistance to give more then one bank of selection...

I just have to calculate all the values now...


Its really simple and straight forward but for us it'll be the first custom circuit we will ever actualy have on our robot and it came to me during english class this week so i wanna get it to work.

04-02-2003, 08:17 AM
If you have room on the OI it would be eaiser to add a thumbwheel switch there, but here is how you can do what you're asking.

You will form a voltage divider for each output of the rotary switch. The voltage divider is two resistor in series, with one end pulled up to +5V and the other grounded. You take the output from the node between the two resistors.

^ +5
X R1
|--------------o Vout
X R2
- Ground

Vout = 5(R2/(R1 + R2)). So if you wanted it to be 2.5V you would use two resistors of the same value. To be consistent, the total resistance should be at least 100k ohms. You will have to figure out what the standard resistance values are, but heres how you could set up 9 discrete levels:

R1 R2 Vout
90k 10k 5(10/100) = 0.5V
80k 20k 5(20/100) = 1.0V
70k 30k 5(30/100) = 1.5V
60k 40k 5(40/100) = 2.0V
50k 50k 5(50/100) = 2.5V
40k 60k 5(60/100) = 3.0V
30k 70k 5(70/100) = 3.5V
20k 80k 5(80/100) = 4.0V
10k 90k 5(90/100) = 4.5V

You could also get some small 100k trim pots and tune them for each input. Then you would only need one per value instead of two resistors. They have a small screw that you turn so they shouldn't slip once set. All of this is way more trouble than its worth, try and work the switch into the OI if you can.

Josh Hambright
04-02-2003, 10:04 AM
I thought about using trimmer pots... These should work about right... I dont need a ton of programs right now with the system i came up with last hour (once again in english class) I think i have 5 banks with 6 in each bank:)

I'll prototype it and hook it up and see if it works...if not i'll use trim pots.

Al Skierkiewicz
04-04-2003, 02:24 PM
Radio shack has a really nice six position rotary switch, you can use. Just wire the switch with five 20K ohm resistors in series across each pin of the switch. Attach one end to +5 volts and the other end to power supply common. Take the wiper (common terminal) and attach it to an analog input. All the way down will be zero volts, all the way up will be 5 volts and you will have four values in between approx 1 volt apart.

Josh Hambright
04-05-2003, 09:40 PM
Thank for the advice Al,

Thats basicly what we came up with (including the radioshack rotary switch).
I came up with something that was a bit more complicated and had like 30 different programs and still worked...but then someone else on the electrical team made another one when they were board...that used regular toggle switches and wired the whole thing in serise so that as you flipped the switches you got more resistance...

If i have time to get mine done we'll use mine but it looks like we may just go with the simpler one:)

thanks for all the help everyone.

Al Skierkiewicz
04-06-2003, 08:27 AM
If you bring the Radio Shack Switch over to our pit I will show you how to modify it for 11 positions. This is what we did and then it was just a matter of soldering in ten 10K resistors and two wires.

Josh Hambright
04-06-2003, 02:04 PM
Excelent i will make sure to stop by or send the other electronics kid over:)

Thanks for all the help


Al Skierkiewicz
04-06-2003, 03:27 PM
I saw you in Chicago going down for the award. I didn't know it was you. Hope you do well for Chairmans at Nationals, you have some stiff competition with Huskie Brigade and others.

Lloyd Burns
04-15-2003, 03:12 PM
One thing to remember is that the analog inputs are different on the OI and the RC. RC = voltage input, OI = charging current from +5V to the input.

The RC is as described in this thread, but the OI essentially measures resistance from +5V to the analog input, by measuring the time it takes to charge a known capacitance over a given voltage change, through the resistance.

This is becasue they can then use joysticks --- the same way that the Apple II, ][+, //e, //c and all did in the early 1980's, and similar to the IBM PC and PCJr of the same era.

I did a check on the then current '98 control system, with a ten turn pot going into both types (at different times), and reading the debug values at various positions of the correctly wired pot.. The was a small nonlinearity with the OI. I have not done it with the black boxes, to see if IFI has improved the sytem.