Raspberry PI Camera Tutorial – How to install a Raspberry PI Camera

In this tutorial I will show you how to install a camera on your Raspberry PI. The setup process is very simple and it works the same way for any version of the Raspberry PI, from version 0 to version 4

The Raspberry Pi Camera comes with a white and blue ribbon.

You need to connect the ribbon to the CSI connector to the Raspberry PI board. The blue side facing the back of the board.

I used a 3D Printed case for the Raspberry PI camera, downloaded from Thingiverse, but you should be able to buy a Raspberry PI Camera case cheaply off Amazon.

Now it is time to power on the camera

Once the Raspberry PI is powered on, open a terminal window.

And we execute:

$ sudo apt update
....and next

$ sudo apt full upgrade

This is to ensure that the Raspberry PI is running in the latest version of Raspbian and it has all the latest patches/updates available to date.

After this, we need to execute the following in the terminal

$ sudo raspi-config

You will need to select the Interfacing OptionsP1 Camera. Then select Finish and reboot.

Taking a picture using Raspistill

Now the Raspberry PI Camera should be set up, let’s do a quick test with Raspistill. Let’s open a terminal window again and try the following:

raspistill -v -o test.jpg

My Raspberry PI camera took this decent photo:

Recording a video with Raspivid

Taking a picture is very nice, but much better is to record a video. To do that, we can use raspivid.

$ raspivid -o vid.h264

This records a 5 second video.

If you want a longer video, then you need to pass the -t parameter with the number of milliseconds

raspivid -o vid.h264 -t 30000

This records a 30s video.

Creating a Livestream

Now the fun part starts. To see what the camera is recording in realtime we can try:

raspivid -o – -t 0 -n | cvlc -vvv stream:///dev/stdin –sout ‘#rtp{sdp=rtsp://:8554/}’ :demux=h264

This creates an RTSP stream from the Raspberry PI camera that is accessible from the local network.


It is not a difficult to install a Raspberry PI camera. Watch the video below to see how I did the install of my own Raspberry PI camera:

If you can’t wait until my next article in this series, why not subscribe to my Youtube Channel and see how I am getting on with this build? What are you waiting for?