100 Analog inputs for lazer maze

Hello all,
I had the idea of making a laser maze but using an giant number of lasers and photo resistors. However, I want to make sure my idea is feasible before I order $30 in parts. Is there a way to read a large number of analog inputs? They are controlled by a laser, so the difference between high and low is often pretty large, but I have no idea how I would go about this. Switch registers only register on and off values, and I would need to daisy-chain a large number of them. I would prefer to use an uno or pro mini, but a mega isn't out of the question. Would the Atmega 328 even be able to handle all these inputs?

Do you guys have any ideas?
Thanks.

Easy, if you only care about detecting when ANY laser is broken, and don't need to know exactly which one.
But 100 lasers and photosensitive diodes and dev board for $30? I'd like to see what it is you have in mind.

Is there a way to read a large number of analog inputs?

Yes, use cascaded multiplexer chips.

Or multichannel ADC chips.

Two 74HC595 shift registers for 16 chip selects, 8 inputs per chip, 128 analog inputs. No degraded signals going thru multiple analog mux/switch chips.
Only need 5 or 6 IO pins, use fast SPI interface.

Perhaps an 8x8 matrix of LDR could be monitored by a Nano. Each LDR would need a series diode. 8 digital outputs would control 8 rows and 8 analog inputs would read the columns, each column having a pull-up of pull-down resistor to form a voltage divider with the LDR.

If more than 64 LDR are required, duplicate the above and have one as master and the others as slaves.

Well if he's going for 100, there's enough pins for doing 10x10 with 20 I/Os

INTP:
Well if he's going for 100, there's enough pins for doing 10x10 with 20 I/Os

Hmmm... Yes. But Nano has only 8 analog I/O so perhaps 8x13

Well, Nano has 6 analog I/O, 2 analog "I" only. But anywho, I'm wondering where you're getting the push for a Nano

"prefer to use an uno or pro mini, but a mega isn't out of the question"

"2 analog "O" only."
No, 2 are analog Input only.
Anyway, analogRead() is slow, like 110uS to get a 10-bit reading.
Using fast external ADC with SPI interface will be a lot more responsive. If use an 8-bit ADC, one can cycle thru a lot more channels in the time it takes to read internally.
This part can do 200K samples per second, 20X more than the internal part.
With SPI clock divisor set to 8 (vs default of 4), SPI clock runs at 2 MHz, so a byte transfer takes ~4uS. Unfortunately a 3.2MHz SPI clock can not be achieved.
The ADC command-calculation-transfer takes 3 SPI.transfer()s, so ~12uS for a read. Thus 8 samples can be done in the time it takes for 1 internal ADC action, and it's easy to loop thru all 8 register addresses in the 2nd byte sent to the part (see Fig 6.2)

Corrected it while you were typing. I is what I meant.

INTP:
Well, Nano has 6 analog I/O, 2 analog "I" only. But anywho, I'm wondering where you're getting the push for a Nano

"prefer to use an uno or pro mini, but a mega isn't out of the question"

I know the atmega328 dip has only 6 analog input pins but the smd part has 8. So the pro mini may also have 8 but they may not be easily accessible, I don't have one and I can't remember. But I do have Nano and know they are accessible on Nano, that's the reason I suggested it. I think if the OP is willing to consider Pro Mini, they won't consider Nano to be "out of the question".

Wow! I didn't expect to see so many replies to my question! Thanks for all the advice.

I am fine with either nano or pro mini, the only reason I selected those boards was price. I would prefer to try and stay with an uno though, as I already have 2 of those.

I am getting my parts from aliexpress, so they ship from china. This should explain where I can get that magnitude of parts for so cheap.

I don't really understand the function of the MCP3008I/P or MCP32008I/P chips, so if someone could explain it that would be great.

I currently have two 74HC595N switch registers and about 20 LDS cells. Would I be able to do a test run with what I have, and then be able to scale up?

Thank you guys for all the help!

Yes, you could try connecting your 20 LDRs to 5 analog inputs for example. Use 4 digital pins. Connect 5 LDRs from the first digital pin to each of the 5 analog pins. 5 more LDRs from the second digital pin to the 5 analog pins and so on. Also put a 10K pull-down on each analog pin.

To read all 20 LDRs, the sketch would need to do the following. Each digital output begins as an input. For each digital output in turn, change that pin to OUTPUT and HIGH. Then read each of the 5 analog inputs. Then change the digital pin back to LOW and INPUT (not simply to LOW). Repeat the process for the next digital output and so on.

The reason for having all but one of the digital outputs set as INPUT is because this makes them "high impedance" meaning they will not source or sink any (significant) current. In effect they are disconnected from the rest of the circuit and cannot provide a path for current to flow either from 5V or to 0V. That means the LDR attached to them cannot affect the measurement of the LDR you are trying to measure at that moment.

don't really understand the function of the MCP3008I/P or MCP32008I/P chips, so if someone could explain it that would be great.

They are analogue to digital converter chips. Each chip can handle 8 analogue inputs, and you can connect many of these to the same set of pins. This is an alternitave to using cascaded multiplexers to read all your signals.

PaulRB:
Yes, you could try connecting your 20 LDRs to 5 analog inputs for example. Use 4 digital pins. Connect 5 LDRs from the first digital pin to each of the 5 analog pins. 5 more LDRs from the second digital pin to the 5 analog pins and so on. Also put a 10K pull-down on each analog pin.

To read all 20 LDRs, the sketch would need to do the following. Each digital output begins as an input. For each digital output in turn, change that pin to OUTPUT and HIGH. Then read each of the 5 analog inputs. Then change the digital pin back to LOW and INPUT (not simply to LOW). Repeat the process for the next digital output and so on.

The reason for having all but one of the digital outputs set as INPUT is because this makes them "high impedance" meaning they will not source or sink any (significant) current. In effect they are disconnected from the rest of the circuit and cannot provide a path for current to flow either from 5V or to 0V. That means the LDR attached to them cannot affect the measurement of the LDR you are trying to measure at that moment.

Thanks for the explanation! Makes sense, and I will try it when I get a chance.

Thanks to all for the help!