To setup the Pi camera carefully follow the steps below:

First make sure the Pi is turned off, then locate the Pi camera connector on the board.  The Pi camera connector is the long white connector between the HDMI port and ethernet adapter.  The connector is marked with the word CAMERA on the board.

 

Be careful not to use a similar connector at the end of the board above the SD card holder.  This connector is for the official Pi LCD display and will not work with the camera!

Gently pull up on the ends of the white plastic connector to open it.  The connector can swing back after it raises up.

Insert the camera cable with the metal pads on the cable facing towards the metal pads inside the connector.  The blue tape on the back of the cable should be facing towards the ethernet port above it.

 

Make sure the cable inserts all the way into the connector until you feel it touch the bottom of the board.  The cable should be straight and level, not crooked or at an angle.  Also ensure the connection is free of dust, debris, hair, etc.

 

Make sure to plug the cable in as shown or else the camera will not work!

Gently press down on the ends of the white connector until it slides back into the closed position.  The cable should be firmly attached to the Raspberry Pi.

The cable should look like this once connected.

Once the Pi camera is connected power on the Pi and connect to it in a command line terminal.  You will now need to enable the camera by using the raspi-config tool.  After logging in to the Pi run the following command:

sudo raspi-config

Once the raspi-config tool loads you will see a screen similar to the following:

Choose the Enable Camera option, then confirm the selection by choosing Enable in the dialog that appears:

Now exit the tool by selecting the Finish option from the main menu.  In the dialog that appears asking to reboot select the Yes option so the Pi reboots.

After the Pi reboots log back in and test that the camera works by using the raspistill command.  Run the following command:

raspistill -o cam_test.jpg

You should see the red LED on the camera board light up as a photo is taken:

If you see the command fail with an error go back and carefully check you have enabled the camera using raspi-config, and that the camera cable is firmly connected to both the Pi and camera board.  Sometimes the cable and connector on the camera board itself needs to be removed and reinserted to get a good connection.  Also try running the rpi-update utility to update the Pi firmware and try again.

After the raspistill command successfully runs you should be able to copy the cam_test.jpg off the Pi and view it on your computer.  Congrats the Pi camera is setup and ready to use!

NoIR Filter Camera

The Pi NoIR filter camera is a special version of the Pi camera that doesn't have an infrared (IR) light filter.  This means the camera can pick up infrared light that's invisible to humans.  This is useful for seeing in seemingly complete darkness--if there's a source of infrared illumination, like from IR LEDs, then the Pi NoIR camera will be able to get a good image.

Here's an example of the NoIR camera image under normal lighting:

Now the same setup with almost no light at all in the room (you can only see the cat's eyes reflecting the camera's red LED!):

And finally the setup with six IR LEDs next to the camera providing illumination:

You can see the Pi NoIR camera is very handy for security cameras and other projects that need to see in the dark!

Field of View

The stock Pi camera has a somewhat narrow field of view.  The camera was originally designed for cell phones and similar applications so it has about a 35mm film lens equivalent field of view.  Here's an example of the stock camera view with a few objects about two feet in front of the camera:

If the field of view is a too narrow you might consider putting a tiny wide-angle lens adapter in front of the Pi camera.  For example this wide-angle cell phone camera adapter is an inexpensive and easy way to increase the field of view.

You'll need to mount the wide-angle lens in front of the Pi camera lens (don't try to attach it directly to the Pi camera lens!).  You can 3D print an enclosure specifically designed to accomodate the wide-angle lens, or just cut a hole in a small cardboard box and build your own simple case.

With the wide-angle adapter this is how the same image setup appears:

You'll notice some distortion and vignetting at the edges which is normal for using a wide-angle adapter like this.  However the field of view is noticeably larger and better able to view the surrounding room.

This guide was first published on Nov 05, 2015. It was last updated on Nov 05, 2015.

This page (Pi Camera Setup) was last updated on Nov 03, 2015.

Text editor powered by tinymce.