Note
Welcome to the SunFounder Raspberry Pi, Arduino & ESP32 Community on Facebook!
Get technical support and troubleshooting help.
Learn and share projects, tips, and tutorials.
Access early product previews and updates.
Enjoy exclusive discounts and giveaways.
👉 Join us here: [here]
Camera Module
Note
The Pironman 5 series does not include a camera module. You will need to prepare one yourself or purchase it from our official website:
In this section, you will learn how to test the camera module by capturing photos and recording videos.
By the end of this section, you will have a fully installed and functional camera module ready for your projects.
Test the Camera
Raspberry Pi OS (Bookworm and later) uses the libcamera stack. After booting into the system, run the following command to check if the camera works:
libcamera-hello
If you see a preview window, the camera is working correctly.
Take a Photo
libcamera-jpeg -o test.jpg
This will capture a still image and save it as test.jpg.
Record a Video
libcamera-vid -t 10000 -o test.h264
-t 10000means recording for 10 seconds.-o test.h264saves the output as H.264 video.
To convert the video to MP4 format:
ffmpeg -i test.h264 -c copy test.mp4
Python Example
You can also control the camera with Python using the picamera2 library.
Install dependencies:
sudo apt install python3-picamera2 -y
Create a Python file:
nano camera_test.py
Then paste the following code:
from picamera2 import Picamera2
import time
picam2 = Picamera2()
picam2.start()
time.sleep(2)
picam2.capture_file("image.jpg")
Save and exit nano by pressing CTRL+O, then ENTER, and CTRL+X.
Run the script:
python3 camera_test.py