How to connect tons of sensors to an arduino?

Hello,

I am starting a project that requires using a ton of motion sensors and I am not sure how to connect them up to one arduino. I have yet to buy the parts but I was planning on using "HC-SR501 PIR Sensor Infrared IR Body Motion Module" and hope to use up to 49 sensors to create a 7x7 matrix of them.

How could I go about this? Should I use more than one arduino?

Thank you for your time

Use the forum Google search function in the upper right of this page to search for the key words of your project. You will probably find many similar previous project discussions and code to get you started.

Either use 49 digital pins (the Mega has 54), or fewer, along with a port expander chip.

Mega has 70 digital pins, 16 of them can also do analogRead().

Divide "tons of sensors" by the number of known multiplexers possible to handle it and You get the number of I/O needed. Then divide this number with rhe capacity of the controller You want to use and You will get the number of controllets needed.
Also buy stocks in the copper industry selling all wires needed.

Since each HC-SR501 could cover a circle with 5-7meter radius...
What do you want to with 49 of those sensors.

Doesn't sound like something that can be matrixed. An array of port extenders (3x PCF8575 or MCP23017 can read 48 of them) would work well.

And indeed... 49 PIR sensors, why??

I want to create a 7x7 matrix of motion sensors that will be able to detect when a hand goes over each point, which will trigger an animation to play.

I am not sure if this is the best implementation, but it is the simplest/cheap method I can think of.

a word, or two, come to mind,,, NO, and expensive. how about LDR's or Photosensors?

I can't use Photosensors as lights nearby will be changing constantly so I assumed it would not be viable.
I'm quite an arduino noob so I'm not too familiar with all the things I can do.

so I assumed it would not be viable

Depends on the situation. With photosensors it is easy to accommodate slowly changing light conditions, and have a narrow field of view. Plus, they are cheap and small. Do some experiments!

muyle:
I want to create a 7x7 matrix of motion sensors that will be able to detect when a hand goes over each point, which will trigger an animation to play.

Ah, now it starts to make sense. Typical case of the XY problem.

PIR sensors are not suitable for this. Too great a range, too great a field of vision, and they're long range motion sensors while you are looking to detect the presence of a hand at what I assume is a rather short distance (how far above the sensor should the hand be held?.

The first I am thinking of is distance sensors, that can detect whether there's something above them. Depending on how close you expect the hand to be held, brightness sensors may also work. They work best if the hand is actually covering them, so you go from ambient brightness to near total darkness. Held more than about 20 cm above the sensor and they're not likely to work well (too little drop in brightness), unless you add a bright light source pointing at the sensor - basically turning it into a break beam sensor.

The next issue: how are those sensors going to be placed? If in a square you're reaching over one sensor to get to the other. That's a problem, I'm not aware of a sensor that can distinguish between a hand, an arm, or even someone's body as they reach for the far sensor. So this is not likely to work well, if at all.

So I suppose they'll be spaced in a row at sufficient distance to prevent this from happening. Nonetheless as this means they have to be at least some 15-20 cm apart to avoid too easy false triggering, that'd be a line of like 5-6 meters. That again doesn't sound practical or sensible for a host of other reasons.

jremington:
Depends on the situation. With photosensors it is easy to accommodate slowly changing light conditions, and have a narrow field of view. Plus, they are cheap and small. Do some experiments!

That works well with one, but you're looking at analog inputs and the OP wants 49 of them... No 49 analog inputs on any Arduino.

Would it even be possible to matrix such sensors? 7 digital outputs, 7 analog inputs. An output can be switched off but how about the pull-up resistors that each sensor needs? Maybe two digital outputs per row to switch both ends of the voltage divider on (OUTPUT) and off (INPUT)?

muyle:
I want to create a 7x7 matrix of motion sensors that will be able to detect when a hand goes over each point, which will trigger an animation to play.

Why not experiment with gesture sensors or time of flight sensors (watch the videos).
Leo..

Very interesting sensor, except for the "as long as you move at the correct speed a couple of inches above it" part, as Lady Ada says. I'm guessing the OP is looking for some public display or art work kind of installation, and having to train all your users is a bit of a chore. It's also I2C making connecting 49 of them tricky.

I've done up, down, swipe, hold and remove before with a VL53L0X distance sensor. Worked well. Wouldn't know how to scale that from the 1 I did to 49 of them - have to store a good number of readings (I stored the latest 10 measurements - ints or even floats, so 20-40 bytes - that'd be 980 or even 1960 bytes for 49 sensors) plus the computing that has to be done on those arrays to filter out the motion.

From the video and description of that APDS9960 I get the feeling all gesture detection is also done in software, and they have four channels per sensor. That's a lot of data to keep in memory!