Capacitive Sensor with only one pin?

Hello everybody,

I recently try to make my own touchscreen and that for i need a lot of individual capacitive sensors to get data from. I already tried to use the Capacitivetouch library but i don't have enough pins to take a send and a receive pin for every one of the sensors... Do you think it would be possible to put one pin high, wait a very short amoung of time and then read the digital data from the same pin and if this time changes than somebody must be touching the snsor?

I've attached a simple sketch where I want to try this idea but it seems like the arduino is too slow to measure this small time difference. Could somebody help me maybe with this? Maybe there is a way with less programming necessary so it can be made faster and able to read the right data?

Thank you for your help :smiley:

touch01.ino (306 Bytes)

I could imagine this may work with a single analog pin: use a short time to charge the capacitor, then switch to input, read back, and see how far you got. But you're bound to run out of analog pins sooner than you run out of digital pins, even if you use two of those at a time.

Would it be possible to have one of the two signals shared with all the other sensors? That would require n+1 pins for n sensors, rather than 2n. That's a win for any n>1.