I seek your guidance for the following:
I am working on opening and closing my grenhouse curtains -- it already works, however it works on a time basis -- I mean, the code send sends the HIGH signal to the relay for 2 minutes and then shuts it off.
This works like a charm, but in case I face a catastrophe (a curtain cable breaks, or for any reason the curtain goes higher than it should) Arduino will not know something is wrong.
ERGO.... I need to detect the height of the curtain bar (its just a thick metal tube rolling and unrolling the curtains.
What do you guys suggest? if you need pics, let me know and I will post them.
You could use just two mechanical switches, one that is triggered as the curtain is fully opened, and the other that is triggered as the curtain if fully closed.
Such as: http://www.ebay.com/itm/NO-NC-Contact-Short-Hinge-Lever-Actuator-Mini-Micro-Limit-Switch-AC125V-1A-8-Pcs-/230986159681?hash=item35c7d91641
A greenhouse is a wet environment. Micro switches won't be reliable over time.
I would use the fully enclosed reed type switches and a magnet, commonly used on windows and doors in alarm systems.
As the bar is metal (you haven't stated what metal, so I'll assume it's conductive) you could use wiping contacts at the top and bottom of its travel. These are self cleaning and shouldn't require much maintenance if installed properly.
Imagine two springy (phosphor bronze) contacts in a V shape. When the bar goes far enough between them, it will complete the circuit, indicating that it has reached the end of its travel. The contacts slide against the rod and wipe any dirt off, ensuring good electrical contact.
You will have problems with wipe contacts on aluminium due to the oxide on the surface.
Do you actually want a measure of the rod or do you want to detect if it has reached a certain position?
The first is difficult the second is easy using an optical switch.