View Single Post
  #11   Spotlight this post!  
Unread 15-05-2004, 12:02
MikeDubreuil's Avatar
MikeDubreuil MikeDubreuil is offline
Carpe diem
FRC #0125 (Nu-Trons)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Boston, MA
Posts: 967
MikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond repute
Send a message via AIM to MikeDubreuil
Re: Making a Sensor Board

Quote:
Originally Posted by SilverStar
For example if a rotatable device is connected to the potentiometer, as the device rotates the resistance and the input value would change.
What is important to remember is that the Operator Interface and Robot controller don't read resistance, they read voltage. So when connecting a potentiometer you are really reading the voltage drop between the the wiper and the terminals A or B.

Ascii Art time:
Code:
|~~~~~~~~|~~~~~~~~~~|
A        W          B
You would connect positive to A and Ground to B. The input to the controller would be the Wiper (W).

You can turn the pot's wiper, sometimes called the slider and vary the resistance between point A and W. To calculate the voltage drop you use Kirchoff's Voltage Law.

R1 = Resistance between A and W in Ohms
R2 = Resistance between W and B in Ohms
V = 5V, which is supplied by the OI or RC
X = voltage drop across A and W

X = V * (R1/(R1+R2))

Example:
You are using a 100K potentiometer and it is turned about 3/4 of a turn. Let's assume it is a single turn 360 degree pot. You whip out your multimeter and read 75K across A and W and 25K across
W and B. Using Kirchoff's Voltage law the equation would be (X=5*(75K/(25K+75K))) which would equal 3.75 volts.

What does this mean to the programmers?
That voltage is sent through an ADC or Analog to Digital converter. The ADC has a resolutiuon of 10 bits (2^10 = 1024). That 5 volt signal is represented as a number from 0 to 1024. So what would our 3.75V potentiometer read like in your program?

V = input voltage
x = digital value in base 10

x = (V * 1024)/5

So for our 3.75V example: (x = (3.75 * 1024)/5), which equals 614. Your program would read 614 as the input if your 100K potentiometer was at 3/4 of a turn.
__________________
"FIRST is like bling bling for the brain." - Woodie Flowers