Connecting multiple cameras to a raspberry pi?


#1

Anyone know how I could connect multiple cameras to a Raspberry pi? I want to connect many webcams to a single device, hopefully a Pi. If not, another processor would work also. For now, I’ll only start with about 5-10 cameras, but eventually will need 100 or more.

Looking to use one of these cams:



#2

Things I’m seeing online say “not so much.”

You could build lots of IP camera modules using Pi Zero W + USB Webcam or Pi Camera Module. You’d avoid the “sending my data to China” issue with most affordable IP cameras.


#3

Thanks for the feedback. I’ve pondered with the Pi Zero W, but it’s difficult to buy them in bulk for an affordable price. I’d have to go to Micro Center every day and pick one up for $5 each. Also, the camera module is fairly expensive.
I was thinking of using a slightly more powerful PC? Like a NUC. Could this work?


#4

How about web enabled security cams? lots of them run a version of linux under the hood, and if you buy second hand may not be much more expensive than the bare camera module.


#5

That sounds much more expensive. It’d also be difficult to find the number of second hand cameras I’d need.
I need the cost of each camera not to exceed $5. The processor running all the cameras is open to consideration in regards to price.


#6

That’s gonna be tricky.


#7

As far as I can tell, multiple USB cameras present as multiple /dev/video* files; the first camera would be /dev/video0, the second /dev/video1, etc.

This appears to be the solution for capturing from multiple USB cameras…

This is how I found that page…
https://www.google.com/search?q=fswebcam+multiple+cameras

Feedback appreciated.


#8

what are you trying to do with these cameras?

for something like a security system compressing and streaming to disk, even a powerful desktop will struggle once you get into the dozens, don’t think any single computer will handle 100.

of course resolution, framerate matter a lot.

something like this gets close to your price point, and could handle uploading images or maybe even streaming to the cloud, although 100 in close proximity may tax your wifi/router…


#9

Well, the cameras I linked above cost $1.50 (<1MP) and $5 (20MP). I would like to find something in between that range.


#10

Frame rate is low on the priority list. Resolution should be at least 1 or 2 MP. Nothing for security purposes.

The product you linked looks interesting. Although it would be great for any use case, I want to avoid the wifi route to eliminate some potential technical difficulties, since the device will still require power somehow.


#11

Hmm. I think I’ve used this before… it seems familiar. I never got the Pi to load more than 1 camera, though. I didn’t really trouble shoot it much longer than about 30-45 minutes. But, if this really works, you think I could run 4 USB hubs (individually powered, 10 port) for a total of 40 USB cameras?


#12

No way. The Pi has a single USB2.0 controller with a theoretical bandwidth of 480Mbps. Realistic throughput with a single device tops out around 40MBps.

Raw 15FPS 1MP stream from a single camera is already 45MBps. MJPG compression can drop that around 10X, and if you can force your camera to lower the framerate to something super low that will help also.

But in reality you’re also going to have issues with bus contention trying to run more than a couple cameras simultaneously.


#13

@nacho (somewhat) addressed that concern…

You did not answer @halachal’s question…

You’ve specified hardware requirements (very very cheap cameras; very cheap computer) but have mentioned nothing about what you are trying to accomplish1. Without knowing what you are going to do with a stream of image data from 40 cameras the only way to answer your question is through mind-reading. I chose downhill skiing as my elective the semester mind-reading was offered so, pending further disclosure, I am not able to answer.

1 I suspect Beef over Chicken.


#14

Yeah the only way I could see this working is if you’re ok replacing “frame rate” with “timelapse interval”.


#15

whoops! yup it’s for inventory management. BEEF OVER CHICKEN!!


#16

yes I didn’t really think of that. i think that’s a good idea. the cameras don’t have to be really time. it could process an image once every 15 or 30 mins and I think that would still be sufficient, though it would be great if real time were an option


#17

In which case it may work. There are obstacles but the only way to find them is groping in the dark. In other words, you’re headed for the deep end of the pool wee tadpole.

I strongly suggest you do not go cheap on the hubs. I have crossed paths with “powered” hubs that: do not meet the USB specification (e.g. 0.5 amps per port), that are destroyed by over-current instead of cutting power to the offending device, failed to reliably deliver the expected data rate. When I last searched for a port I focused on the chipset. The theory being if the manufacturer went to the effort of using a good quality USB host chipset they probably worked through the other details as well.


#18

Just dropping from 30 FPS to one a second, or every other second is a huge savings.


#19

So what if you just did a master slave controllers. Have 1 web cam hooked to 1 pi, then use another pi as a master/supervisory controller.