Welcome to IMX 415 Camera Module repository
1. Camera Driver Course
Raspberry Pi 5 IMX415 Camera Driver Tutorial
1. Applicable Scope2. Hardware Description3. Step 1: Confirm the Kernel Version4. Method 1: Directly Use the Pre-compiled Product in the Repository5. Method 2: Compile on the Pi 55.1 Install Compilation Dependencies5.2 Prepare the Source Code5.3 Compile the Kernel Module5.4 Compile the Device Tree Overlay5.5 Install the Compiled Products6. Modify /boot/firmware/config.txt7. Verify the Camera7.1 Preview the Camera7.2 Take a Photo7.2.1 rpicam-still7.3 Video Recordingrpicam-vidError Solution7.4 Web Page Camera Preview7.4.1 Run the Script7.4.2 Web Page Access8. 6.12 Kernel Backup Usage9. Re-adaptation When Switching Other Raspberry Pi Kernels10. Common Problems10.1 After installation, modinfo imx415 shows the old path or the old version10.2 An error of Invalid module format or disagrees about version of symbol is reported when loading10.3 The overlay does not take effect11. Notes
Friendly reminder: If you want to add a bracket, you need to insert all 4 screws at the same time first, and then tighten the screws.
Notes:
Contact surface position: The metal contacts at the end of the ribbon cable must face the spring contacts or contact array inside the FFC connector.
Blue stiffener: The blue stiffener plate is usually located on the non-contact surface of the ribbon cable. In a standard installation, the metal contacts and the blue plate are usually located on opposite sides of the ribbon cable.
Silkscreen marking: The plane where the silkscreen text on the ribbon cable (such as AWM-20624) is located is usually the back side. During installation, it should face away from the contact surface (the gold or silver metal part).
The metal must face the side against the PCB, otherwise the ribbon cable may burn out.
Then connect the other end to the metal contacts of the main board.


Note: On the IMX415 side, there is a DIP switch labeled IR-CUT, which is used to control the infrared function on and off. Set it to the ON position to turn on the infrared. It is normal for the screen to appear reddish. Set it to the OFF position to turn off the infrared function, and the screen will show normal colors.

1. Applicable Scope
This tutorial uses the kernel version of the latest official image as an example, namely the 6.18.34 kernel. The network drive also provides the imx415.ko and imx415.dtbo files compiled for the 6.6.31 and 6.12.25 kernels corresponding to our factory image. Check your corresponding kernel and download the corresponding kernel files for the operation.
This tutorial is applicable to:
- Raspberry Pi 5.
- Current kernel
6.18.34+rpt-rpi-2712, source branchrpi-6.18.y. - The IMX415 driver and overlay in the repository
pi5/src/. - The pre-compiled products for
6.18.34+rpt-rpi-2712inpi5/6.18.34/imx415/. - If your system is still
6.12.25+rpt-rpi-2712, usepi5/backup-rpi-6.12/instead.
Repository file version relationship:
| File | Kernel Version | Purpose |
|---|---|---|
pi5/6.18.34/imx415/src | 6.18 source | Compile and use on 6.18.34 |
pi5/6.18.34/imx415/imx415.ko and pi5/6.18.34/imx415/imx415.dtbo | 6.18.34 | Pre-compiled product for 6.18.34, can be installed directly |
pi5/6.12.25/imx415/ | 6.12 source | Compile and use on 6.12.25 |
pi5/6.12.25/imx415/imx415.ko and pi5/6.12.25/imx415/imx415.dtbo | 6.12.25 | Pre-compiled product for 6.12.25, can be installed directly |
pi5/6.6.31/imx415/ | 6.6.31 | Compile and use on 6.6.31 |
pi5/6.6.31/imx415/imx415.ko and pi5/6.6.31/imx415/imx415.dtbo | 6.6.31 | Pre-compiled product for 6.6.31, can be installed directly |
2. Hardware Description
- The IMX415 module connects to the MIPI CSI interface of the Pi 5.
- The default I2C address in the repository
pi5/src/imx415.dtsiis0x1a.
3. Step 1: Confirm the Kernel Version
uname -rCommon version:
xxxxxxxxxx6.18.34+rpt-rpi-2712If other versions are output, first confirm whether the current kernel matches the repository source. When the kernel version does not match, the driver may report Invalid module format or fail to load.
4. Method 1: Directly Use the Pre-compiled Product in the Repository
Only when uname -r is exactly 6.18.34+rpt-rpi-2712 can you directly use:
xxxxxxxxxxpi5/6.18.34/imx415/imx415.kopi5/6.18.34/imx415/imx415.dtboCopy the files to the Pi 5:
xxxxxxxxxxscp pi5/6.18.34/imx415/imx415.ko pi@<pi-ip>:~/scp pi5/6.18.34/imx415/imx415.dtbo pi@<pi-ip>:~/You can refer to the file transfer tutorial for the transfer. The purpose of this step is mainly to transfer the files to your main board for convenient operation. Transfer them to the corresponding directory, and the subsequent commands also need to be modified according to your actual path.
Install on Pi 5:
xsudo mkdir -p /lib/modules/$(uname -r)/updates/dkmssudo cp ~/imx415.ko /lib/modules/$(uname -r)/updates/dkms/sudo depmod -asudo cp ~/imx415.dtbo /boot/firmware/overlays/If the system uses the old path /boot/overlays/, copy to:
xxxxxxxxxxsudo cp ~/imx415.dtbo /boot/overlays/Verify the module version:
xxxxxxxxxxmodinfo imx415 | grep -E 'filename|vermagic'Expected:
xxxxxxxxxxfilename: /lib/modules/6.18.34+rpt-rpi-2712/updates/dkms/imx415.kovermagic: 6.18.34+rpt-rpi-2712 SMP preempt mod_unload modversions aarch645. Method 2: Compile on the Pi 5
It is recommended to compile yourself to avoid inconsistency between the pre-compiled product and the current kernel source.
5.1 Install Compilation Dependencies
xxxxxxxxxxsudo apt updatesudo apt install git make gcc bc bison flex libssl-dev device-tree-compiler \ raspberrypi-kernel-headers libcamera-dev libcamera-appsCheck whether the kernel header files are available:
xxxxxxxxxxls /lib/modules/$(uname -r)/buildIf /lib/modules/$(uname -r)/build does not exist, first install raspberrypi-kernel-headers, or download the complete kernel source.
5.2 Prepare the Source Code
On the Pi 5:
xxxxxxxxxxmkdir -p ~/imx415cd ~/imx415Copy the files under the repository pi5/src/ to this directory:
xxxxxxxxxximx415.cimx415.dtsiimx415-overlay.dtsMakefilesync-from-kernel.sh5.3 Compile the Kernel Module
xxxxxxxxxxmake modulesEquivalent command:
xxxxxxxxxxmake -C /lib/modules/$(uname -r)/build M=$(pwd) modulesAfter success, it generates:
xxxxxxxxxximx415.ko5.4 Compile the Device Tree Overlay
xxxxxxxxxxmake dtboIf /lib/modules/$(uname -r)/build lacks the complete DTS directory, you need to download the complete kernel source:
xxxxxxxxxxgit clone --depth 1 --branch rpi-6.18.y \ https://github.com/raspberrypi/linux ~/linuxIf your own Raspberry Pi differs from the one we provide, you can also directly download the files from https://github.com/raspberrypi/linux to obtain them.
xxxxxxxxxxlinux/drivers/media/i2c/imx415.clinux/arch/arm/boot/dts/overlays/imx415.dtsilinux/arch/arm/boot/dts/overlays/imx415-overlay.dtsThe Makefile and sync-from-kernel.sh must be in the same directory as imx415.c, imx415.dtsi, and imx415-overlay.dts.
Or you can go to this webpage to download the files of the corresponding version, and then transfer them to the main board.
Then use the complete kernel source path to compile the dtbo:
xxxxxxxxxxmake dtbo KERNEL_SRC=/home/pi/linuxAfter success, it generates:
xxxxxxxxxximx415.dtbo5.5 Install the Compiled Products
xxxxxxxxxxsudo cp imx415.ko /lib/modules/6.18.34+rpt-rpi-2712/sudo cp imx415.ko /lib/modules/6.18.34+rpt-rpi-2712/kernel/drivers/media/i2c/sudo cp imx415.dtbo /boot/firmware/overlays/cd /lib/modules/6.18.34+rpt-rpi-2712/kernel/drivers/media/i2c/sudo xz -z imx415.kosudo depmod -aConfirm the module again:
xxxxxxxxxxmodinfo imx415 | grep -E 'filename|vermagic'The vermagic must contain the current uname -r.
6. Modify /boot/firmware/config.txt
xxxxxxxxxxsudo nano /boot/firmware/config.txtSingle camera:
xxxxxxxxxx[all]dtoverlay=imx415,cam0Dual camera:
xxxxxxxxxx[all]dtoverlay=imx415,cam0dtoverlay=imx415,cam1
After saving, reboot:
xxxxxxxxxxsudo reboot7. Verify the Camera
After the operation and reboot, view the media devices:
xxxxxxxxxxls -l /dev/video*Test the image:
xxxxxxxxxxrpicam-hello -t 0For multiple cameras, you can specify:
xxxxxxxxxxrpicam-hello -t 0 --camera 17.1 Preview the Camera
xxxxxxxxxxrpicam-helloEntering this command in the terminal will display the preview window for about 5 seconds.
xxxxxxxxxxrpicam-hello -t 0Running this command in the terminal will keep displaying the preview window. You can exit using the window close button and the Ctrl+C key!
7.2 Take a Photo
xxxxxxxxxxrpicam-jpeg -o test.jpgDisplay a 5-second preview, then capture the image and save it as the test.jpg file.
xxxxxxxxxxrpicam-jpeg -o test.jpg -t 2000 --width 640 --height 480Display a 2-second preview, then capture the image and save it as the test.jpg file. The width of the image is 640 pixels and the height is 480 pixels.
7.2.1 rpicam-still
This command can be used to save files in different formats:
xxxxxxxxxxrpicam-still -e png -o test.pngrpicam-still -e bmp -o test.bmprpicam-still -e rgb -o test.datarpicam-still -e yuv420 -o test.data- Raw image capture
xxxxxxxxxxrpicam-still -r -o test.jpg- Time-lapse shooting
Continuously capture images at an interval of 2 seconds, with a total capture duration of 30 seconds, and save each image with a filename format similar to image0001.jpg:
xxxxxxxxxxrpicam-still -t 30000 --timelapse 2000 -o image%04d.jpg7.3 Video Recording
rpicam-vid
A command used to record video on the Raspberry Pi using a camera module.
Example: Record 10 seconds of video and write it to the test.h264 file.
xxxxxxxxxxrpicam-vid -t 10000 -o test.h264Play the video
xxxxxxxxxxvlc test.h264Note: If the test.h264 file cannot be played and an error is reported, please try the following method to solve it.
Error Solution
Modify the frame rate at which H264 plays per second.



7.4 Web Page Camera Preview
Use a Python script file to implement a web page preview of the camera image.
7.4.1 Run the Script
Code path: /home/pi/Camera_Web_Preview/
xxxxxxxxxxcd /home/pi/Camera_Web_Preview/python3 mjpeg_server.py
7.4.2 Web Page Access
Devices on the same local area network can enter :8000 in a browser to view the real-time camera image!
xxxxxxxxxxExample:Raspberry Pi IP: 10.42.0.1Web page access: 10.42.0.1:8000

xxxxxxxxxxIf you want to set it to start automatically on boot, you can search for information online and set this script file to start automatically on boot!
8. 6.12 Kernel Backup Usage
If the current kernel of the Pi 5 is:
xxxxxxxxxx6.12.25+rpt-rpi-2712Use pi5/backup-rpi-6.12/:
xxxxxxxxxxmkdir -p ~/imx415cd ~/imx415Copy the source code under pi5/backup-rpi-6.12/, then:
xxxxxxxxxxmake modulesmake dtboIf the headers lack DTS:
xxxxxxxxxxgit clone --depth 1 --branch rpi-6.12.y https://github.com/raspberrypi/linux ~/linuxmake dtbo KERNEL_SRC=/home/pi/linuxThe installation and configuration steps are the same as for 6.18.
9. Re-adaptation When Switching Other Raspberry Pi Kernels
Prepare a complete kernel source that matches the current kernel, then:
xxxxxxxxxxcd ~/imx415make modules KERNEL_SRC=/home/pi/linuxmake dtboNote: pi5/src/imx415.c has been adapted to the devm_v4l2_sensor_clk_get interface of 6.18. If you sync from the 6.12 source to the 6.18 kernel, you need to refer to the driver in the 6.18 kernel, and you cannot directly mix the old source.
10. Common Problems
10.1 After installation, modinfo imx415 shows the old path or the old version
Execute:
xxxxxxxxxxmodinfo imx415 | grep -E 'filename|vermagic'If it shows 6.6.31 or 6.12.25, it means the system loaded the old module. Delete the old file and install the matching version:
xxxxxxxxxxsudo rm -f /lib/modules/$(uname -r)/updates/dkms/imx415.kosudo cp imx415.ko /lib/modules/$(uname -r)/updates/dkms/sudo depmod -a10.2 An error of Invalid module format or disagrees about version of symbol is reported when loading
The kernel module does not match the current kernel version. Recompile using the source corresponding to the current uname -r.
10.3 The overlay does not take effect
Check:
xxxxxxxxxxls -l /boot/firmware/overlays/imx415.dtbocat /boot/firmware/config.txt | grep dtoverlaydmesg | grep -i overlayYou must reboot after modifying config.txt.
11. Notes
- Do not directly install
pi5/imx415.koorpi5/imx415.dtboon 6.18.34. Download or compile the kernel files of the corresponding version and install them onto the corresponding version. - After a kernel upgrade,
imx415.koandimx415.dtbomust be recompiled. - After installing to
/lib/modules/$(uname -r)/updates/dkms/, you must executesudo depmod -a. - The dtbo path should be selected as
/boot/firmware/overlays/or/boot/overlays/according to the actual boot partition of the system.