# Detect position of walkers along a path using IR transceivers

I am working on a project that the position of people walking along a path needs to be known. I'm a hobbyist so I don't know what options I may have.

I want to use IR sender and receivers to detect the position of people. I need to use around 20-25 sensors (one every 50cm). The easiest solution that may come to mind is to connect each IR receiver to one pin of my Arduino, but it requires too many pins and also huge amount of wires. To use less pins and wire I thought I could use an arrangement like analog keyboard, similar to the following image, keys representing IR sensors.

But this way only one input can be detected. Is there any way to detect multiple inputs using only a few wires?

• Three wires, called Load (out), Clock (out) and Data (in). (Plus power and ground). And a bunch of Parallel In Serial Out shift registers, in a daisy chain. I expect you can figure out where to go from there...
– user16324
Jan 1, 2016 at 18:56

Use resistors spaced apart by a factor of at-least 2

eg: 1K, 2.2k, 4.7K, 10K, 22K, 47K, 100K, then combinations will non-ambiguous.

7 resistors per 10-bit ADC input is about all that seems likely to work well. use 680 ohms for the fixed resistor.

• That's a cool way to do it with only 2 wires! Jan 1, 2016 at 22:18
• only 2 wires per for only 7 switches, each additional set of 7 switches needs another wire, Jan 1, 2016 at 22:56
• Thanks a very cool idea, If I use 1K, 2K, 4K, 8K, 16K, 32K, 64K resistances I can read the input and with minor coding detect active sensors. Jan 7, 2016 at 5:52
• you'd need 0.05% (precision) resistors if you go with exact multiples of two, using the E12 sizes i suggested allows use of much cheaper 2% parts. Jan 8, 2016 at 4:09

You can arrange your sensors in a matrix orientation, then depending on your scan rate, you can very quickly check each sensor to see if it's active. You could handle 25 sensors with 10 digital pins in this way.

Energize each row in turn, and while energized, check the values of Columns 1-5.

simulate this circuit – Schematic created using CircuitLab

• I suggest you add (30) diodes to that to avoid ghosting, also check connections Jan 1, 2016 at 22:38
• Excellent suggestion @jasen. Here's a great explanation of ghosting/masking for anyone interested: dribin.org/dave/keyboard/one_html Jan 2, 2016 at 1:25