Viewfinder project

Hi,

I have been asked to create a viewfinder (as in the things you look through on piers: https://colleenleslie.files.wordpress.com/2012/09/viewfinder-bw.jpg) where at certain angles, triggers something to happen on a PC. I am looking into using the arduino for getting the angle data of the viewer into a PC.

The viewer needs to turn 180 degrees and I need to be able to differentiate specific angles.

Initially I thought a rotary encoder would be good for this but it then occurred to me that they might not give out enough data to be able to calculate each degree. Then I thought maybe a potentiometer would work.

Does anyone have any experiences with this kind of thing? Am I best off using a rotary encoder or a potentiometer or is there something better?

Thanks!

How about switches? Maybe you could put a cam on the viewer, that activates a switch when the viewer is pointed at the right point of interest?

Thanks for the reply. I'm not sure how the cam would activate a switch?

The issue I have with switches is that I'd need to get them in the correct position physically which could be fiddly. If I used a rotary encoder or pot then I'd be able to tweak the numbers in code if the physical viewfinder is slightly off position.

If the viewfinder is not steel, perhaps you could use a compass sensor to avoid having to do any mechanical construction . . . . but accuracy and/or resolution may be insufficient.

Example:

You could use a gyro sensor like this:-
http://playground.arduino.cc/Main/MPU-6050

The only thing is that it would have to be powered up either in a fixed direction or some sort of micro switch is needed to set the initial angle. This is the same problem you would have if you used an incremental rotary encoder.

Initially I thought a rotary encoder would be good for this but it then occurred to me that they might not give out enough data to be able to calculate each degree.

If you chose the right type then yes it would.

Otherwise you could use an absolute rotary encoder, either a mechanical switch one:-
http://uk.farnell.com/bourns/eaw0j-b24-ae0128l/encoder-rotary-128pos-8-bit/dp/9358234

or a magnetic one:-
http://uk.farnell.com/ams/as5040-assu/encoder-magnetic-rotary-10bit/dp/1630800

I think a gyro sensor may be a little more complicated that I'd like.

I'm leaning now towards a normal potentiometer - the viewfinder will only turn 180 degrees. Will a pot will give me sufficient data?

A pot will give "sufficient data" but be electrically noisy and thus unreliable. That will get worse with wear.

But a servo pot will be fine. Only problem is the cost, here is one that is quite low cost for what it is:-
servo pot

If your total angle is limited to less than 270 degrees then a pot will be perfect. The Arduino can read 1024 steps over the full potentiometer travel which gives you a maximum feasible resolution of 0.27 degrees. In practise, you won't get this resolution but I would expect you can get down to 1 degree reliably.

The ultimate rotary encoder is the MA3, made by US Digital. It can turn complete rotations and it has a very accurate output. Kind of pricey but I would choose this if this is for a permanent outdoor installation - a pot will wear and corrode very quickly.

Luckily it is for a one day event so I don't need to worry about the pot wearing. Also, price is not particularly an issue.

Thanks for all the help. I'm going to look into using a pot and see where I get.