Use 3 cameras: both balenaFin CSI available ports and one USB for image capturing

Hi there everybody,

We plan to use balenaFin as the board to develop a new project.

  • In this project we require 3 cameras in total and the GPIO’s are not available to be used with an ArduCam module since they are used as IO’s.

  • If I connect a 3’rd USB camera, one CSI camera stops working.

  • The cameras will be used individually, not all at once.

  • Can someone come with an idea about what to do and what to use?

Thanks

Hi,

I have no idea about your question, but it appears you are using ArduCam with the Balena Fin. Do you mind sharing which version (1.0 or 1.1) of the fin, and which ArduCam? I have not managed to get the ov9281 ArduCam working with v1.1 and would be interested in learning from someone who has.

Alon

Hi @sicabboy, unfortunately no one in the team has tried setting up 3 concurrent cameras on the fin. I have asked the team internally if they have any ideas why adding the 3rd camera would disable one of the CSI cams. In the mean time could you give us an exact rundown of the hardware you are using. Fin version (1.0 or 1.1) and links to the various cameras you are using. It might be possible for our team to quickly source these and do some testing on it, to see if we can reproduce the behaviour.

Work in progress. I will let you know the outcome once all tests are done. Keep an eye on this post.
ArduCam is this one: https://www.uctronics.com/multi-camera-adapter-module-for-raspberry-pi-board-8mp.html
and Fin is 1.1

Hi @shaunmulligan
Thanks for taking time to answer.
The hardware is:

Fin version 1.1
USB camera: https://www.amazon.com/gp/product/B01DRJXDEA
CSI camera’s: https://www.robotshop.com/en/raspberry-pi-camera-module-v2.html

Looking forward to hear the results you’ll get!

Hello @sicabboy,

Thanks for the information. I have a few questions that would help narrow down the issue:

  • Do you have both RPi camera modules connected to the multi-camera adapter or connected directly to the CSI ports on the Fin?
  • What exactly are you observing when one of the CSI cameras stop working? Do they still show as an I2C device?
  • What OS are you using?

Cheers,
Nico.

Hi @ntzovanis,

Wait. Just to make the things clear a little bit:

  • So far the only try we had tested was with 2 CSI Fin ports and a USB. When connecting the USB, CAM1 CSI stopped working.USB and CAM0 were working good.
    In the above configuration ArduCam adapter was NOT used.

  • When not using the multi-camera adapter there is no point in scanning for I2C devices, isn’t it?

  • Raspbian GNU/Linux 9 (stretch), Kernel version: armv7l

As an extra comment, we are also trying to connect 3 cameras using V.2.2 multi-camera board module. with no success so far. So if you guys around know some resources regarding this, it will be helpful.

Thanks @sicabboy for the clarification.

I’ll get some HW to test this setup and see if I can reproduce the issue. In the meantime, if you only have CAM1 connected, does it also stop working when connecting the USB camera?

Cheers.

Hello @sicabboy,

Just to let you know that I received all the hardware to try and reproduce the issue. I will give it a try in the next day or two and get back to you.

Cheers,
Nico.

1 Like

Hey @sicabboy, I was able to test a similar setup:

2 x Raspberry Pi Camera Module v2.1
1 x ELP USB camera
Latest Raspbian version for the balenaFin.

With the above setup I was able to have the 3 cameras plugged and working. I’d like you to try the following:

1- Plug the two cameras on CAM0 and CAM1 and run vcgencmd get_camera
3- Plug the USB camera and run vcgencmd get_camera

That would help me understand if the camera is still being recognized or not after plugging the USB camera

Unfortunately I got supported = 2 detected = 2 without USB camera connected and with USB camera connected.

@sicabboy if you have console access to the device, can you try running the following with the 3 cameras plugged:

raspistill -cs 0 -o image0.jpg
raspistill -cs 1 -o image1.jpg

Let me know if you see an output for both cameras.

@ntzovanis I can see the output for both cameras.

For the above commands, images are saved in /home/pi/filename.jpg

Even if when using vcgencmd get_camera I get supported=2 detected=2,
writing a script like this and replacing the X with 0, 2, or 3 worked to display the images from all 3 cameras (2xCSI and 1xUSB) when running the script for one camera at a time.

Can you find a reason why the regular notation like 0, 1, 2 doesn’t work in this case?

    import cv2

try:
    cap = cv2.VideoCapture(X)
    cap.release()
    cv2.destroyAllWindows()
    cap = cv2.VideoCapture(X)
except Exception as error:
    print(error)

while True:
    try:
        print('Capturing ....')
        _,img = cap.read()
        cv2.imshow("frame",img)
        wait_key = cv2.waitKey(1)
    except Exception as error:
        print(error)
cap.release()
cv2.destroyAllWindows()

Hello @sicabboy,

I’m not sure I fully understand your last comment. You mean that running that code with three cameras connected gets you images for all of them (using X = 0, 2 and 3)? And it doesn’t work if you use X= 0, 1 and 2?

I’ll try running that code in my local setup to see the results.

Hi @ntzovanis,

What I mean is that it works when the address for second camera is 2 and not 1.

Have you tried running the script yourself?

Hello @sicabboy

I’ve tried running your script and am getting the right output for X = 0, 1 and 2 (2 being the USB camera). What cameras correspond to X = 0, 2 and 3 in your setup?