Detecting pan and tilt angles

I want to be able to accurately be able to detect the pan and tilt of something like a tripod head. It needs to be repeatable such that if I put the tripod head in the same position I should get the same readings each time. I also need to be able to read the angles in real time.

What would be a good sensor for this? A gyro sensor? A couple of potentiometers?

A rate gyro wouldn't work because of drift. An absolute shaft encoder on each axis would work. A pair of pots would work over a limited range of angles.

I searched at digikey for absolute shaft encoders and it says the cheapest one is $700! Is that right?

For my purposes I do not need full rotations, so it seems like potentiometers might be a possibility. I read that they can have problems with noise, repeatability and quickly wear out. I am kind of surprised about the repeatability problem. It seems like if you had a steady voltage that you should get pretty consistent readings for any given position.

Any idea if the accuracy really is problematic?
Is there a way to deal with the noise?
What kind of resolution could I get using an arduino uno?

An accelerometer will give good, repeatable values if the platform for your pan/tilt will not be moved (or will stay in the same position relative to the earth/gravity). It would be the cheapest and easiest solution.

USDigital.com will have absolute shaft encoders that are around $40. For example this model will output 0 to 5V based on its 0 to 360 degree rotation. Since the internal mechanism is based on reading a magnetic field on the shaft there should be no noise or wear to worry about.

Chagrin:
An accelerometer will give good, repeatable values if the platform for your pan/tilt will not be moved (or will stay in the same position relative to the earth/gravity). It would be the cheapest and easiest solution.

I can see an accelerometer giving a tilt reading but not a pan reading.

Perhaps a three-axis magnetic compass. That would give you a pointing direction relative to the local magnetic field. I don't know ow much accuracy and repeatability you can expect.