As I know, you can use a potentiometer only as an analog I/O and get only the voltage.

How can I use this voltage to get my shooter angle for example?

Assuming that your potentiometer has a linear output, all you need to do is create a linear equation. The way that it was accomplished on our team was we would measure the voltage and the actual angle at two positions, then solve for m and b, from there.

Oh, Ok

Thank you !

Even if the potentiometer reading isn’t linear (i.e. there is a linkage that connects the potentiometer to a point on the arm), it’s fairly simple to get a good equation. Plot several calibration points in Excel, then use the “Add Regression Line…” option by right clicking on the graph. Then select the various equation types until you have a line that best-fits the data. Selecting the ‘Show Equation on Chart’ will give you the equation to program.

Just make sure the potentiometer readings are on the X axis.

Depending on the quality of your Potentiometer you can use a simple formula to compute it’s voltage reading to it’s degree. I’ve used this with fairly good results. It all depends on much accuracy you require.

For example, let’s take a 340 degree single turn pot…

Roughly we know it’s voltage is from 0v to 5v…

So if it we take 5v / 340 that means it’s 0.0147 volts/per degree.

Take your voltage reading and divide it by your volts per degree to get your angle.

300 degree pot would be 0.0166 volts per degree.

270 degree pot would be 0.0185 volts per degree.

Also be careful of the potentiometer you purchase. 10k resistive ones work well, but you really want to make sure you purchase a linear pot and not an audio pot. Pots for audio are not even close to linear…

I like your way of thinking

I’ll use that

That’s because they are logarithmic

http://en.wikipedia.org/wiki/Potentiometer#Resistance.E2.80.93position_relationship:_.22taper.22

We had 3 pots on our robot this year, all connected to our climbing arm. For us, it wasn’t a question of developing an equation that would convert between voltage and angle… it was figuring out what values matched the specific angles we wanted. For that, we had a “test” mode, where the pot values were spit out on the console. We simply manually moved the arm to where we wanted and read the values at that point! It took a little fine tuning, but those values could then be fed directly into our PID loop to get the arm to perform exactly the same for every climb.

Most commercially available ‘log’ pots, like the ones you get at radioshack and Fry’s, have more of a two-stage adjustment, as it’s cheaper to make two parallel sections of resistive material than to actually taper the resistive material in a logarithmic fashion.

More info here: http://sound.westhost.com/pots.htm#taper