Electronic – arduino – Is it possible to measure multiple photodiodes on one pin

arduinoinfraredphotodiode

I'm trying to use multiple photodiodes to detect passing objects. Currently, pins are at a premium. Is it possible to use an array of photodiodes on one or two pins? VCC and ground are not counted. The schematic below is how I currently measure one photodiode.

Thanks in advance!

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

You could use an array of analog switches driven with something like a 4017 to sequentially - and mutually exclusively - connect the diodes to the Arduino's analog input. Use a single pin to generate the 4017 clocks, keep track of them, and there'll be a direct correlation between the clock number and its corresponding diode. With a little extra glue logic you could use the 10th clock, say, to hard reset the 4017 after each run and then you'd never get out of sync.

Here's the basic idea without the glue logic:

enter image description here You could also configure a shift register as a ring counter and extend the number of diodes sensed.