I need suggestions for a cheap method for detecting the state (is it pressed down, or not) of a valve, See picture:
cca. 1.5Cm diameter and 10cm high metal tube, with a shiny metal valve in it. the valves default position is on the picture, and it can move downwards ~1.5cm, still leaving about 0.5cm place unter it. It closed from both up and down, so there is dark in the casing.
I need the cheapest and fastest (Should be digital, because rading the analog inputs need time) method for sensing even if the valve moved a little bit (altough it has only 2 states, i would like to know its being pressed before it is pressed totally)
I can only access the tubing from down.
What i can think about is using two led diodes. One emits while the other is tied between ground and the base of an NPN BJT such that incident light upon the photodiode produces voltage on the BJT’s base. Because the valves down is shiny, i think that the voltage will alter if the valve gets closer to this ledpair sensor.
Any other , possibly better ideas?