Multiple cameras on a single raspberry pi board
Hello everybody, currently i am doing a project which requires using multiples cameras on a single raspberry pi board. I was wondering if it is possible to use multiple cameras on a single raspberry pi board ? and if it's possible then how to use it.
Re: Multiple cameras on a single raspberry pi board
No it is not possible on the Raspberry Pi
Use two Pi's and the network maybe...
Gordon
Use two Pi's and the network maybe...
Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering
Re: Multiple cameras on a single raspberry pi board
Do you have in mind using the dedicated hi-res camera connected to the special connector on the RPi board?
If so, Gordon's answer is correct.
But if you were able to use general-purpose usb-connected cameras, would the os stop you connecting multiple cameras via a usb hub? (Not sure - punting a slightly different question for experts to tackle... )
If so, Gordon's answer is correct.
But if you were able to use general-purpose usb-connected cameras, would the os stop you connecting multiple cameras via a usb hub? (Not sure - punting a slightly different question for experts to tackle... )
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
Re: Multiple cameras on a single raspberry pi board
You can only use one csi camera module per pi,
But using a usb camera as well would work ok for a total of two cameras.
Usb cameras use a lot of cpu, so using two of them isn't advisable.
But using a usb camera as well would work ok for a total of two cameras.
Usb cameras use a lot of cpu, so using two of them isn't advisable.
Re: Multiple cameras on a single raspberry pi board
Is the objective to capture video simultaneously from multiple cameras at normal frame rates?
If so use multiple RasPi/camera combinations and feed the compressed streams over a network.
It's the simplest and possibly the cheapest option, with best performance.
If slow frame rates are acceptable, or only one camera will be running at video rate at any time, then there may be two options:
a. Several USB cameras, only one of which is open at any time
b. If some custom circuitry and camera management software development is an option for you you may be able to multiplex several PiCams onto the one CSI port.
This is by no means a recommendation. I can't say it will work, but it may be a place to start.
If so use multiple RasPi/camera combinations and feed the compressed streams over a network.
It's the simplest and possibly the cheapest option, with best performance.
If slow frame rates are acceptable, or only one camera will be running at video rate at any time, then there may be two options:
a. Several USB cameras, only one of which is open at any time
b. If some custom circuitry and camera management software development is an option for you you may be able to multiplex several PiCams onto the one CSI port.
This is by no means a recommendation. I can't say it will work, but it may be a place to start.
Re: Multiple cameras on a single raspberry pi board
if i would to connect 2 raspberry pi boards each with their own pi cameras, is it possible to save the jpegs into one storage ? lets say an external hard disk ? if i am wrong, please point me to the right direction as i am new in electronics. Please and tq ! 

Re: Multiple cameras on a single raspberry pi board
If you connect both Pis to the same wireless/wired/mixed
network , you can set up the other one as network drive.
ghans
network , you can set up the other one as network drive.
ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Re: Multiple cameras on a single raspberry pi board
thank you for replying, i am interested in option b, since we are looking into capturing jpegs instead of video. theoretically speaking, how many pi cameras can be multiplexed into one CSI port ? and how complicated will the custom circuit be ? Please and thank you !PiGraham wrote:Is the objective to capture video simultaneously from multiple cameras at normal frame rates?
If so use multiple RasPi/camera combinations and feed the compressed streams over a network.
It's the simplest and possibly the cheapest option, with best performance.
If slow frame rates are acceptable, or only one camera will be running at video rate at any time, then there may be two options:
a. Several USB cameras, only one of which is open at any time
b. If some custom circuitry and camera management software development is an option for you you may be able to multiplex several PiCams onto the one CSI port.
This is by no means a recommendation. I can't say it will work, but it may be a place to start.
Re: Multiple cameras on a single raspberry pi board
Yes. For just two Pis + cams:paddi2013 wrote:if i would to connect 2 raspberry pi boards each with their own pi cameras, is it possible to save the jpegs into one storage ? lets say an external hard disk ? if i am wrong, please point me to the right direction as i am new in electronics. Please and tq !
Connect the two Pis with a network (could be just a Cat5 cable).
Mount a USB hard disk on one of the Pis and share the mount point as a network drive.
Mount the network drive on the second Pi.
On each Pi specify a file on the HD mount point as output for your jpgs.
There are various ways it could be done.
Re: Multiple cameras on a single raspberry pi board
Since you wrotepaddi2013 wrote:thank you for replying, i am interested in option b, since we are looking into capturing jpegs instead of video. theoretically speaking, how many pi cameras can be multiplexed into one CSI port ? and how complicated will the custom circuit be ? Please and thank you !PiGraham wrote:Is the objective to capture video simultaneously from multiple cameras at normal frame rates?
If so use multiple RasPi/camera combinations and feed the compressed streams over a network.
It's the simplest and possibly the cheapest option, with best performance.
If slow frame rates are acceptable, or only one camera will be running at video rate at any time, then there may be two options:
a. Several USB cameras, only one of which is open at any time
b. If some custom circuitry and camera management software development is an option for you you may be able to multiplex several PiCams onto the one CSI port.
This is by no means a recommendation. I can't say it will work, but it may be a place to start.
I don't think option b is for you at this stage.i am new in electronics
How often do you want to capture a jpeg, from how many cameras? How far away from the Pi would these cameras be?
One Pi per camera allows each camera to be far apart (100m cable between Pis)
Re: Multiple cameras on a single raspberry pi board
I don't think option B is actually possible.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
- RaTTuS
- Posts: 10748
- Joined: Tue Nov 29, 2011 11:12 am
- Location: North West UK
- Contact: Twitter YouTube
Re: Multiple cameras on a single raspberry pi board
multiple RPI's + Cmaera
and depending on frame / data rates either another RPI running a NAS sever or another box entirely or one of the RPI's holding the store
and depending on frame / data rates either another RPI running a NAS sever or another box entirely or one of the RPI's holding the store
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: Multiple cameras on a single raspberry pi board
Quite possibly so, but could you give some clues as to why not?jamesh wrote:I don't think option B is actually possible.
At the most basic, can't the entire interface be multiplexed with tri-state bus drivers to slow-switch from one camera to another?
Allowing something like this:
Code: Select all
selectcamera 1
rapistill -o img1.jpg, -t 5000
selectcamera 2
rapistill -o img2.jpg, -t 5000
selectcamera 3
rapistill -o img3.jpg, -t 5000
No sync, no on-the-fly switching. Full init after each switch.
Re: Multiple cameras on a single raspberry pi board
The underlying software/HW driving the camera would have a hissy fit, not knowing what on earth was going on.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Re: Multiple cameras on a single raspberry pi board
OK.jamesh wrote:The underlying software/HW driving the camera would have a hissy fit, not knowing what on earth was going on.
Is there some key initialisation at boot? Presumably raspistill doesn't init the camera / IF from scratch, it assumes a known state that a mux would prevent. Is that it? Could a kernel mod potentially re-apply initialisation with switching?
Is the CSI interface never quiescent? Obviously switching the bus when active is a no-no.
Speculating, perhaps initialisation of the video core also initialises the camera at a low level and can't be repeated with the system up, because it's a monolithic operation that would break other things, like display. If it's not possible to init just the CSI / camera, and if init is adaptive to responses from specific camera modules, then it would be impossible init all cameras as one by routing the same commands to all, and impossible to init the current camera without a reboot.
Last edited by PiGraham on Wed Jul 17, 2013 9:26 am, edited 1 time in total.
Re: Multiple cameras on a single raspberry pi board
There are two connections to the camera - i2c for controlling it and CSI-2 for data back. Neither of those channels are expected to be multiplexed, so all the code would need to change to be able to know which camera was doing what at any one time. I seriously doubt it could handle switching between multiplexed camera in any rational and useful way. Preview would be impossible at any sane fps for example.
Note that the ISP can actually control two cameras, but to do that it has two CSI-2 ports, but the second port is not available on the Raspi.
All this control is done by the ISP in the VC4, nothing in Linux space.
Note that the ISP can actually control two cameras, but to do that it has two CSI-2 ports, but the second port is not available on the Raspi.
All this control is done by the ISP in the VC4, nothing in Linux space.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Re: Multiple cameras on a single raspberry pi board
I was certainly not suggesting multiplexing a frame rate. I'm not that crazy!jamesh wrote:I seriously doubt it could handle switching between multiplexed camera in any rational and useful way. Preview would be impossible at any sane fps for example.

I was only thinking that the init, acg, capture, shutdown sequence might be directed to one of N cameras. Preview frame rate would not be an issue, if it worked at all, since it would still be just one camera, one data stream.
Select a camera, run raspistill for some seconds to get an image and shutdown, then repeat for a different camera. While the one camera was running it would have the system to itself. Switching would be with camera off.
I can see that there may be some vital initialisation that is a once only thing (from boot) beyond linux control.jamesh wrote:All this control is done by the ISP in the VC4, nothing in Linux space.
Last edited by PiGraham on Wed Jul 17, 2013 9:34 am, edited 1 time in total.
Re: Multiple cameras on a single raspberry pi board
If you had an analogue multiplex between the N camera's then this would be possible.
On my desk I often hot plug the camera's for testing and just run raspivid. (I do not encourage this though, the CSI connector is not developed to work like this and if you had a discharge through the connector you can break it)
But the main issue is getting an analogue multiplex between multiple 1GBit CSI channels, maybe there is a device out there that would enable this... You'd also have to multiplex between the I2C because only one must respond at a time and they'll all have the same I2C device address.
Gordon
On my desk I often hot plug the camera's for testing and just run raspivid. (I do not encourage this though, the CSI connector is not developed to work like this and if you had a discharge through the connector you can break it)
But the main issue is getting an analogue multiplex between multiple 1GBit CSI channels, maybe there is a device out there that would enable this... You'd also have to multiplex between the I2C because only one must respond at a time and they'll all have the same I2C device address.
Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering
Re: Multiple cameras on a single raspberry pi board
That's the basic idea, but witch electronically to swap our one camera and use another.gsh wrote:If you had an analogue multiplex between the N camera's then this would be possible.
On my desk I often hot plug the camera's for testing and just run raspivid. (I do not encourage this though, the CSI connector is not developed to work like this and if you had a discharge through the connector you can break it)
But the main issue is getting an analogue multiplex between multiple 1GBit CSI channels, maybe there is a device out there that would enable this... You'd also have to multiplex between the I2C because only one must respond at a time and they'll all have the same I2C device address.
Gordon
1Gb switching could be tricky!
Why analogue? CSI is all digital, isn't it?
What is the lane data rate? Is the 1Gb/s the lane data rate, or the channel data rate?
This from VLSI hints the switching should be feasible. It seems multiple simultaneous streams is possible, but obviously that would require access to closed code and data.
Re: Multiple cameras on a single raspberry pi board
No CSI is not digital... it's a low voltage differential signal.
Lane frequency is as high as 1Gbit
Gordon
Lane frequency is as high as 1Gbit
Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering
Re: Multiple cameras on a single raspberry pi board
I see what you mean. We would need a lvds PHY in and out.gsh wrote:No CSI is not digital... it's a low voltage differential signal.
Lane frequency is as high as 1Gbit
Gordon
There are chips for that. http://www.ti.com/product/sn65lvds125
HDMI switching chips like AD8190 might do the job.
Re: Multiple cameras on a single raspberry pi board
Not sure that would work right either, the CSI spec includes dynamic impedance control which switches line termination in and out to reduce power consumption, not sure you'll find anything similar other than a specific CSI interface...
Gordon
Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering
Re: Multiple cameras on a single raspberry pi board
i am looking to use around 6 to 12 cameras with the raspberry pi, do u guys know what is the best way to do it ? and also by minimizing the cost ? Please and thankyou
- RaTTuS
- Posts: 10748
- Joined: Tue Nov 29, 2011 11:12 am
- Location: North West UK
- Contact: Twitter YouTube
Re: Multiple cameras on a single raspberry pi board
best bet will be 1 RPcamera and 1 Modela A / seatpaddi2013 wrote:i am looking to use around 6 to 12 cameras with the raspberry pi, do u guys know what is the best way to do it ? and also by minimizing the cost ? Please and thankyou
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: Multiple cameras on a single raspberry pi board
Option 1:paddi2013 wrote:i am looking to use around 6 to 12 cameras with the raspberry pi, do u guys know what is the best way to do it ? and also by minimizing the cost ? Please and thankyou
Model A + PiCam + WiFi dongle = N x (£20 + £16 + £10)
WiFi router / AP = £25
12 cameras = £577
Option 2:
Model B + N x USB camera = £30 + N x £16
12 port powered USB hub = £35
12 cameras = £257
Option 3:
Model B + WIFi £30 +£10
Wireless IP cameras N x £35
12 cameras = £460
You may have issues with power supply to 12 USB cameras, but since you only need one of 12 active at any time, and a powered hub *should* be able to supply all ports, you may be OK. Perhaps budget for a good quality brand hub, rather than the cheap generic price I put in there.
I suggest Model B for the USB system for the extra RAM.
I can't give you any assurances that it will work. Start with the hardware compatibility list for webcams.
It certainly won't work if you attempt to activate more than one camera at once.
I don't think you answered the question about how far apart these cameras are going to be. Option 1 gives you much longer distances than option B.
Not all cameras are equal. You will get much better images from a PiCam than a cheap WiFi IP cam (worst) or a webcam.(medium)
There will be other issues to consider, such as ease of installation.
I suspect this is some sort of CCTV system. WiFi will be easier to install. IP cams will be simplest and neatest. You will need some sort of custom case for Pi/PiCam. USB cams will probably not reach to where you want them due to short cable runs.
PiCam WIFi will give you range and top quality images in good light.
If you want good night imaging you should really go for a CCTV camera with switchable IR block filter and a high sensitivity CCD sensor, but then you are getting much more expensive.