Raspberry Pi Camera

I received a Raspberry Pi camera in the post yesterday and the first thing that surprised me was the size, or rather the lack of it! Fitting the camera connector to the board proved to be a problem with my Pi in its case. I have come to the conclusion it’s better to take it out of the case to fit the lead. Make sure you apply pressure along the pressure strip. I failed to do this and spent an hour trying to find out what the problem was.

First thing once you have the camera connected is to boot up the Raspberry Pi and connect the camera. This can either be done before starting the desktop, or after by starting LXTerminal. In either case enter

sudo raspi-config

Select the Camera option and enable. On exiting this menu option you will need to select Reboot.

Set up the camera to work under Python by installing PiCamera.

sudo apt-get update
sudo apt-get install python-picamera

An offline version of the documentation is available with

sudo apt-get install python-picamera-docs


Open IDLE from the desktop and at the Python prompt or at the top of a Python script) enter:

import picamera

This will make the library available to the script. Now create an instance of the PiCamera class:

camera = picamera.PiCamera()

The LED will light up on the camera board.

And take a picture:


if no warning messages are shown then you can assume all is well.


Raspberry Pi and GPS


I had an Adafruit Ultimate GPS board that I used successfully with my Arduino and wanted to try it with the Raspberry Pi. My GPS unit is fitted with a battery backup and what I overlooked was that the settings were saved. The Arduino Sketch I was using only required the RMC sentence, but gpsd requires a few more and without these extra sentences will not work correctly.

Settings are only saved with the backup battery connected , so to reset the unit just remove the battery. However the RTC will lose the current time and so I connected the GPS up to an Arduino, ran the test sketch from Adafruit with the line un commented to allow All Data to be sent.

To connect the GPS to the Pi a USB to TTL adaptor is used, these can be obtained on eBay for very little. Four connections are needed, 5 volts, ground, Tx and Rx (the Ultimate GPS board had 5 volt tolerant inputs). Cross the Tx and Rx connections.

I used the tutorial on the Adafruit site to install the software gpsd. Two things that I discovered was that the programs provided in gpsd will not work unless you have a fix. The easiest way is to use an Active Aerial and these come with a long enough lead to hang out of a window. The second seems to be a well documented problem that is easy to find an answer for on Google after you have spent some time trying to get the system to work. Although gpsd should start at boot up it doesn’t seem to, the cure is to first of all stop gpsd with

sudo killall gpsd

Then to restart it with

Sudo gpsd /dev/ttyUSB0 -F /var/run/ gpsd.sock

Then start the graphic interface with