Raspberry Pi Camera Module
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
Enable overlays options sutiable for your camera.
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
Here, you can find which overlay should be turned on for each MIPI Connector.
Note
In Above Table, Full Mode can support 4 Lane Camera whereas Split mode can support 2 Lane Camera.
Steps to follow for Configuration
Open a terminal window(
Ctrl+Alt+T
).Run command
sudo vicharak-config
in it.Select
Overlays
options in it by pressingenter
key.
You will see Warning Page, click on
yes
and selectManage Overlays
options.
Select overlays as per your camera part number
( OV5647 )
by pressingspacebar
on keyboard, then selectOk
.
To return back to terminal, press the
Esc
key until you exit from it.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
First, Connect Vicharak Flex Cable To Vicharak CAM PCB Connector.
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.
Attach Camera Module To FPC50 15 Pin 1mm Pitch Cable.
Connect Camera To Vicharak CAM PCB Connector.
Connect Axon Side Vicharak Flex Cable to Axon.
After Using Camera, User can remove camera using twizer.
For Single Camera
Run Camera Using V4l2 Utility
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.
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
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
Install the OpenCV library using pip
for Debian-based systems (like Ubuntu):
pip install opencv-python
Setup
Open a terminal window(
Ctrl+Alt+T
).To create a (
.py
) file in vim editor, Run commandvim <file_name>.py
in terminal.Copy this below content into the file and paste it by pressing
Ctrl + Shift + v
, then pressEsc
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.
Open a terminal window(
Ctrl+Alt+T
).Navigate to the directory where your Python program is located using the
cd
command.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