View Single Post
  #3   Spotlight this post!  
Unread 05-02-2013, 08:01
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Equation for converting potentiometer voltage into angle?

Assuming a linear potentiomenter and straightforward mechanical motion, the formula is just the equation for a line:
y = mx + b
Read the voltage as x.
Multiply it by a scaling constant m.
Add an offset constant b.
The corresponding angle is y.

To determine the constants, read the voltage at two known angles. Put the voltage and angle in for x and y. Now you have two equations with two unknowns, and you can solve for m and b.



Or you can do what Garrett suggests and not worry about angles at all. Just use voltage in your programming. You don't need to say "put the angle at 30 degrees". You can say "move until the voltage is 1.36" instead.