Interfacing Raspberry Pi with the Camera Module
Aim : To interface the PiCamera module with Raspberry pi.
Apparatus : Raspberry Pi kit, Pi Camera module V1.3, Adapter
Circuit Diagram :
Procedure :
1) Raspberry Pi Board has CSI (Camera Serial Interface) interface to which we
can attach the PiCamera module directly.
2) For enabling the camera in Raspberry Pi, open the raspberry pi configuration
using the following command,
3) sudo raspi-config
4) Select Interfacing options in which select the camera option to enable its
functionality.
5) Reboot Raspberry Pi.
6) Now we can access the camera on Raspberry Pi.
7) Now we can capture images and videos using Pi Camera on Raspberry Pi.
Program Code :
(I) To capture the jpg image :
from picamera import PiCamera
from time import sleep
camera = PiCamera()
camera.start_preview()
sleep(5)
camera.capture(‘/home/pi/Desktop/image.jpg’)
camera.stop_preview()
(II) To record the video :
from picamera import PiCamera
from time import sleep
camera = PiCamera()
camera.start_preview()
camera.start_recording(‘/home/pi/Desktop/video.h264’)
sleep(5)
camera.stop_recording()
camera.stop_preview()
Output :
Result :
The still image is captured by camera and the video has been recorded for
the duration of 5 seconds.
Conclusion :
The interfacing of Picamera module (version1.3) has been successfully done
with Raspberry Pi. From this experiment, we have studied to capture the image as
well as record the video.