Wednesday, February 22, 2017

Installing the Raspberry Pi Camera

Installing the Camera

If you have any HATS on your Raspberry Pi, then remove them before you install the camera cable. You can put them back on afterwards. In our case we had to remove the motor driver board.

Be careful not to touch the camera PCB components, they are static sensitive. Ground yourself before you start if possible.

On the Raspberry Pi B+, 2 and 3, the camera port is between the audio port and the HDMI port. On the original Raspberry Pi B, it is between the Ethernet port and the HDMI port. To open the port, use two fingers and lift the ends up slightly. Note that there is another port on the Pi board that looks just the same, but that other one is not meant for the camera - use the one labelled camera!

The cable has to be inserted with the right orientation: the blue side needs to face the Ethernet port, and the silver side faces the HDMI port. Insert the cable so that almost no blue is showing. The photo below shows the beginning of the insertion.

To close the port and keep the cable in place, push the top of the port while holding the cable with the other hand. Give the cable a GENTLE tug to check that it is installed correctly. Note that the cable at the camera end has a similar connector but is a bit stiffer, so may require a bit more effort to open and close.

Enabling & Testing the Camera

You need to enable camera support using the raspi-config program you will have used when you first set up your Raspberry Pi. From the command line:

sudo raspi-config

Use the cursor keys to move to the camera option, and select 'enable'. On exiting  raspi-config, it will ask to reboot. The enable option will ensure that on reboot the correct GPU firmware will be running with the camera driver and tuning, and the GPU memory split is sufficient to allow the camera to acquire enough memory to run correctly.

To test that the system is installed and working, try the following command:

raspistill -v -o test.jpg
The display should show a five-second preview from the camera and then take a picture, saved to the file test.jpg, whilst displaying various log messages.

If you have SSH'ed in, then you wont see the preview. To view the jpg image you can use gpicview. Note that you will need X forwarding set up (i.e. ssh -XY on a Mac).

gpicview test.jpg
You will then see something like:

Your picture will probably be a bit more interesting! I hadn't mounted the camera at this stage. To mount the camera on Alexa M, I used one of these:

This shows the camera attached and half mounted.

No comments:

Post a Comment