Determining position of hand on 1 axis (what sensor?)

Hi guys,

I am working on a project to create a pipe of 75 cm long with a addressable LED-strip underneath it. I want it to react to your hand when you hold it above the pipe. I am trying to light up the LED's that are underneath your hand when you move your hand above the pipe (distance between 1 and 10 cm).

I have tried an ultrasonic distance sensor, but that is not very reliable. Next to that my goal is to embed the sensor in the pipe.

Currently I am looking into using/multiplexing around 20 PIR sensors(passive infrared sensors, I use the hc-sr501). Unfortunately it seems to also detect other things than my hand.

I was wondering whether anyone knows a better way to determine the position of my hand so I can use it to address the right LED's. I have attached a rough sketch to visualize the concept.

Can you put a light sensor under the LEDs? Without a finger there, little light should come out the back of the LED. With a finger over the LED, the finger will light up from the LED and illuminate the phototransistor or PIN photodiode.

Just pulse the LEDs with a very short pulse, too short for you to see, but the phototransistor will see it. You can even have it calibrate for no finger when it first turns on.

I would start by mounting several infra-red LEDs and several phototransistors along the length of the pipe and pointing upwards from the pipe. They could either be mounted by drilling holes in the pipe or hidden behind the pipe. By pulsing the LEDs in turn and monitoring the levels of signals received by the phototransistors it should be possible to estimate the position of the hand over the pipe (horizontally at least).

Borrow a capacitance meter that can measure fractions of a pF.
Play around with some bits of wire, copper tape or aluminium foil and see how close your hand needs to be to register a reading above the static value.
At 10 cm I see a 0.02 pF rise in capacitance.
At 1cm this climbs to 0.8pF.

To be usable by an Arduino you need to use something like a 4060 oscillator/divider counter. The two electrodes provide the capacitance in an RC oscillator that runs in the low MHz or high kHz zone. The divider/counter turns this into a low frequency square wave that Arduino can handle.

The thing still works if you cover the electrodes with sticky tape. You can even have them inside the pipe providing that it is made of plastic or some non-conductive material.

Capacitance won't be even close to linear.

You don't need high precision parts to measure capacitance. I used to sell capacitance meters that used a couple of 555 timers. I recently tested one I still have from 1986 on a meter that goes down to 10uV, and found that my old capacitance meter measures pretty stably down to 0.01pF.

Click for full image