Raspberry Pi Camera Module

../../../../_images/axon-camera.webp

You can use the Raspberry Pi Camera Module v1 and v2 with the Vicharak Axon. The raspi camera module is a small circuit board that connects to the CSI connector on the Axon and allows you to take photos and videos.

We do not build or design the camera module, but we do test it for compatibility with our Axon. We recommend buying the original camera module from the Raspberry Pi Foundation, or from one of our authorized resellers.

You can find more information about the camera module on the Raspberry Pi Camera documentation.

Buy the Raspberry Pi Camera Module v2.

Axon Camera Guide

  1. Enable overlays options sutiable for your camera.

  2. You can setup camera using python source.

Pre-Requisites

  • Camera ( OV5647 )

  • Vicharak Flex Cable 30 Pin 0.4mm Pitch Cable (Golden Color)

  • Vicharak Camera PCB

  • FPC50 15 Pin 1mm Pitch Cable

Enable Overlays In Axon

../../../../_images/axon-camera-mipi-p.webp ../../../../_images/axon-camera-pcb.webp

Here, you can find which overlay should be turned on for each MIPI Connector.

../../../../_images/axon-camera-detail.webp

Note

In Above Table, Full Mode can support 4 Lane Camera whereas Split mode can support 2 Lane Camera.

Steps to follow for Configuration

  1. Open a terminal window(Ctrl+Alt+T).

  2. Run command sudo vicharak-config in it.

  3. Select Overlays options in it by pressing enter key.

../../../../_images/Overlays_1.webp
  1. You will see Warning Page, click on yes and select Manage Overlays options.

../../../../_images/Overlays_2.webp
  1. Select overlays as per your camera part number ( OV5647 ) by pressing spacebar on keyboard, then select Ok.

../../../../_images/axon-overlay-list.webp
  1. To return back to terminal, press the Esc key until you exit from it.

  2. In order to enable your configuration, Restart your computer or Run command sudo reboot in terminal.

Danger

Make sure that whenever you are going to connect Camera, Device should be power off.

How to Attach Camera to Axon

  1. First, Connect Vicharak Flex Cable To Vicharak CAM PCB Connector.

../../../../_images/axon-camera-start.gif

Danger

Make sure to connect the Vicharak flex cable’s AXON PCB side connector to the AXON board, and the display/camera side connector to the Vicharak CAM PCB.

../../../../_images/axon-camera-2.gif
  1. Attach Camera Module To FPC50 15 Pin 1mm Pitch Cable.

../../../../_images/axon-camera-3.gif
  1. Connect Camera To Vicharak CAM PCB Connector.

../../../../_images/axon-camera-4.gif
  1. Connect Axon Side Vicharak Flex Cable to Axon.

../../../../_images/axon-camera-5.gif
  1. After Using Camera, User can remove camera using twizer.

../../../../_images/axon-camera-6.gif

For Single Camera

Run Camera Using V4l2 Utility

  1. Use v4l2-ctl to capture camera frame data

v4l2-ctl --verbose -d /dev/video<camera_device_number> --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap=4 --set-selection=target=crop,flags=0,top=0,left=0,width=1920,height=1080 --stream-to=sample.yuv

Note

For Single Camera, Default Camera Number would be 11. As you can verfiy by below process.

You can get <camera_device> Number by running below command :

ls -l /dev/video*

=> /dev/video-camera0 -> video<camera_device> e.g. - 11, 31 etc.

  1. Playing Captured File

ffplay -f rawvideo -video_size 1920x1080 -pix_fmt nv12 sample.yuv

Note

If you don’t have v4l2-ctl, then it can be installed by below command:

sudo apt update
sudo apt install v4l2-ctl

Run Camera Using Python Script

  1. Install Python if not already installed. You can download Python from the official website: Python Downloads.

for Debian-based systems (like Ubuntu):

sudo apt update
sudo apt install python3-pip
  1. Install the OpenCV library using pip

for Debian-based systems (like Ubuntu):

pip install opencv-python

Setup

  1. Open a terminal window(Ctrl+Alt+T).

  2. To create a (.py) file in vim editor, Run command vim <file_name>.py in terminal.

  3. Copy this below content into the file and paste it by pressing Ctrl + Shift + v, then press Esc and to save this file, type :wq.

             # !/bin/env python3
             import cv2
             cap = cv2.VideoCapture(<camera_device_number>)
             while True:
                 ret, frame = cap.read()
                 cv2.imshow('frame', frame)
                 if cv2.waitKey(1) & 0xFF == ord('q'):
                     break
             # After the loop release the cap object
             cap.release()
             # Destroy all the windows
             cv2.destroyAllWindows()

Note

For Single Camera, Default Camera Number would be 11. As you can verfiy by below process.

You can get <camera_device> Number by running below command :

ls -l /dev/video*

=> /dev/video-camera0 -> video<camera_device> e.g. - 11, 31 etc.

  1. Open a terminal window(Ctrl+Alt+T).

  2. Navigate to the directory where your Python program is located using the cd command.

  3. Run Python program using the following command:

python3 <file_name>.py

If you have multiple versions of Python installed, ensure you use python3 to run the program for Python 3.x.

Troubleshooting

  • If you encounter any errors related to missing modules or libraries, ensure that Python and OpenCV are properly installed on your system.

  • If the camera frame does not open or the program does not behave as expected, check for any errors in the terminal output and review your program for potential issues.

  • Check Camera I2C address is detected or not.

Note

sudo i2cdetect -y <i2c_bus_number>

I2C Bus number is mentioned in Camera DTS node in device tree file