Getting Up and Running with the Raspberry Pi Camera Board

Posted by Christian on May 14, 2013

Courtesy of Andy Laing, a committed Raspberry Pi pi-oneer at element14, these notes are intended to help users get the Raspberry Pi camera working on any Model A or Model B Raspberry Pi computer.

(Update: You can use these same notes for the new Raspberry Pi B+ or the Raspberry Pi A+)

First, please download the latest Raspbian image (2013-02-09-wheezy-raspbian.img) and install it onto your SD card. Please ensure that your SD card is at least 4 GB in size.

Then, connect the Camera module to the CSI port on the Raspberry Pi computer.

Configure the Raspberry Pi Computer

On first boot, you will be presented with the ‘raspi-config’ menu. There are two options we need to set before we start installing the camera software:

  1. Expand the filesystem to fill the SD card

  2. Set the memory split to allocate 128 Meg to the GPU

  3. Once complete select Finish and then select Yes to reboot the Raspberry Pi computer

Once rebooted you can login to your Raspberry Pi using the following credentials

Username: pi Password: raspberry

Update the Operating System to the Latest Version

pi@raspberrypi ~ $ sudo apt-get update

pi@raspberrypi ~ $ sudo apt-get upgrade -y
(This update will take several minutes to complete)

Updating the Firmware on the Raspberry Pi

Updating the firmware on your Raspberry Pi computer will install all of the drivers necessary to run the camera module.

  1. Installing the git-core package
    pi@raspberrypi ~ $ sudo apt-get install git-core -y

  2. Download the ‘rpi-update’ script
    pi@raspberrypi ~ $ sudo wget -O /usr/bin/rpi-update

  3. Change the permissions in the ‘rpi-update’ script so we can run it
    pi@raspberrypi ~ $ sudo chmod +x /usr/bin/rpi-update

  4. Execute the ‘rpi-update’ script to update the firmware on the Raspberry Pi
    pi@raspberrypi ~ $ sudo rpi-update
    (This will take several minutes to complete)

Update the Boot Configuration File

Edit the /boot/config.txt boot file to add in the following two lines at the bottom of the file:


Also make sure that the following line is present within the file (This line was added when the GPU memory allocation was set to 128 meg). If it is not then add the following line at the bottom of the file:


You can edit this file on the Raspberry Pi using one of the following commands:

pi@raspberrypi ~ $ sudo vi /boot.config.txt


pi@raspberrypi ~ $ sudo nano /boot.config.txt

Setup for the camera software should now be complete. You can reboot your Raspberry Pi computer using:

pi@raspberrypi ~ $ sudo reboot

Using the Camera Software

Once your Raspberry Pi computer has rebooted, you can login again and run the camera software to take photographs or record video.

  1. Online help (gives you all of the command-line options available)
    pi@raspberrypi ~ $ /opt/vc/bin/raspicam
  2. Taking a simple photograph
    pi@raspberrypi ~ $ /opt/vc/bin/raspicam –o file.jpg
  3. Recording a simple video
    pi@raspberrypi ~ $ /opt/vc/bin/raspivid –o file.h264
    Please note that when recording video the camera module will not record any sound – this unit will only capture HD video images only.
  4. Taking some time lapsed images (in this case the images are 30ms apart)
    pi@raspberrypi ~ $ /opt/vc/bin/raspicam –tl 30 –o file%d.jpg
    Note the filename – the %d will be replaced with an integer (creating file1.jpg, file2.jpg etc). This software will continue taking images until you press ‘CTRL-C’ to terminate the program.
  5. Using the image effects when taking photographs or capturing video This command will take a picture in ‘negative’
    pi@raspberrypi ~ $ /opt/vc/bin/raspicam –ifx negative –o negative_image.jpg

For a full list of image effects when taking photographs type:

pi@raspberrypi ~ $ /opt/vc/bin/raspicam

To read the help screen and all available command line options.

For a full list of image effects when recording video type:

pi@raspberrypi ~ $ /opt/vc/bin/raspivid

To read the help screen and all available command line options.



Add comment

Please register or log in to post a comment.