If you're working with a Raspberry Pi for computer vision or AI projects, getting everything set up can be confusing—especially with newer devices like the Raspberry Pi 5.
This guide compiles all essential commands used for:
Setting up your Raspberry Pi
Configuring network access
Enabling remote control
Troubleshooting camera issues
Capturing images
🧠 1. System Setup & Updates
Before doing anything, your system should be updated:
sudo apt update
sudo apt upgrade
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
🌐 2. Network & IP Configuration
Check IP address
hostname -I
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
👉 This is needed for:
SSH connection
VNC connection
🔐 3. Remote Access Setup
Enable SSH and VNC
sudo raspi-config
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
Then navigate:
Interface Options → Enable SSH
Interface Options → Enable VNC
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
Connect via SSH
ssh pi@<IP_ADDRESS>
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
Example:
ssh pi@192.168.43.25
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
🖥️ 4. VNC (Remote Desktop Access)
Used when you want full GUI access from your laptop.
Steps:
Enable VNC (see above)
Install VNC Viewer on your laptop
Connect using:
<IP_ADDRESS>
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📸 5. Camera System (Important Update)
On modern Raspberry Pi OS:
Camera is enabled by default (libcamera system)
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
👉 You will NOT see "Camera" in raspi-config anymore.
🧪 6. Test Camera
Preview camera
rpicam-hello
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
👉 Works only on GUI (monitor or VNC)
Capture image
rpicam-still -o test.jpg
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
Record video
rpicam-vid -t 5000 -o video.h264
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📂 7. File Management Commands
List files
ls
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
Create folder
mkdir dataset
cd dataset
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
🔁 8. Capture Multiple Images
for i in { 1..10} ; do rpicam-still -o img_$i .jpg; sleep 2; done
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
🖼️ 9. Open Image (on Raspberry Pi GUI)
xdg-open test.jpg
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
🧪 10. Python + OpenCV Setup
Start Python
python3
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
Import OpenCV
import cv2
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
Load image
img = cv2 . imread ( " test.jpg " )
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
Resize image
resized = cv2 . resize ( img , ( 224 , 224 ))
cv2 . imwrite ( " resized.jpg " , resized )
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
Convert to grayscale
gray = cv2 . cvtColor ( img , cv2 . COLOR_BGR2GRAY )
cv2 . imwrite ( " gray.jpg " , gray )
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
Convert to HSV
hsv = cv2 . cvtColor ( img , cv2 . COLOR_BGR2HSV )
cv2 . imwrite ( " hsv.jpg " , hsv )
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
Exit Python
exit ()
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
⚠️ 11. Common Troubleshooting
Camera not working?
Check:
Cable orientation
Proper connection
Correct port (Pi 5 has 2 ports)
No preview?
SSH = No preview
VNC/Monitor = Preview works
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
Restart system
sudo reboot
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
🧠 Key Takeaways
✔ Raspberry Pi OS now uses libcamera
✔ No manual camera enable needed
✔ rpicam-* commands replace raspistill
✔ SSH is for control, not display
✔ VNC gives full desktop access
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
📢 แจ้งเตือน: kenryikegbo/setting up raspberry pi camera for ai projects complete command guide g - ประเด็นร้อน
🎯 Final Thoughts
Once your Raspberry Pi and camera are set up:
👉 You are ready to:
Collect image datasets
Train AI models
Deploy computer vision applications
🔥 If you found this useful
Drop a ❤️
Share with someone learning Raspberry Pi
Follow for more AI + Embedded Systems content
Top comments (0)