Connecting the Ribbon Cable
First, you need to use the Raspberry Pi camera FFC ribbon cable to connect the Raspberry Pi camera to the Raspberry Pi development board. The interface where the ribbon cable connects is called the CSI (Camera Serial Interface) interface.
The CSI interface on the Raspberry Pi board is located next to the USB and Ethernet interfaces. First, we pull off the black cover of the CSI interface, then insert the blue end of the ribbon cable facing the Ethernet interface, and press down the black cover to secure it.
Similarly, connect the camera end, ensuring the blue end of the ribbon cable is facing the same direction as the back of the camera.
Activating the Camera
SSH into the Raspberry Pi terminal and update the system.
sudo apt-get update
sudo apt-get upgrade
sudo raspi-config
Open the camera feature on the Raspberry Pi.
After opening, use the reboot command to restart the Raspberry Pi. At this point, the camera should be usable on the Raspberry Pi.
Checking Connection Status
vcgencmd get_camera
supported=1
detected=1, libcamera interfaces=0
The vcgencmd command checks the camera. Supported indicates whether the camera is supported; if it is 0, you need to check the system upgrade. Detected indicates whether the camera is properly connected; if it is 0, please check if the camera connections are correct and whether the camera and baseboard are installed correctly. Libcamera interfaces indicate whether the libcamera driver is functioning normally;
Real-Time Monitoring
sudo apt-get install motion
# Modify the configuration file:
sudo nano /etc/motion/motion.conf
daemon on # Change off to on
width 640
height 480 # Change according to camera resolution
framerate 50 # Frame rate
stream_maxrate 200
stream_localhost off # Set to off to allow access for all users in the local network
# Restart motion
sudo service motion restart
# Start
sudo motion
Access: http://192.168.1.100:8081