So, last week I bought myself a Raspberry Pi camera. This new acquisition was partially because I really want to build a cool timelapse camera to take star trail photographs with but also to integrate into my BAM. Currently, the USB microscope I’m using costs around £30, has a 800×640 CCD and plastic lenses that could best be described as ‘crap’. The Raspberry Pi camera however costs £17 and has a functional resolution (for video) of XXX. So using the Raspberry Pi camera would be a huge benefit.
Now, much like everything else I ever do on Raspberry Pi, using the camera module requires browsing 6 different how to guides and trying to come up with some combined version of events. So to help out others, I’ve prepared my own little how-to, trying to bring all that I’ve learned together.
Step 1: Plug it in
This is pretty simple to be honest, the most important thing to remember is that the CCD is sensitive to static – so don’t do this while wearing your favourite synthetic fleece and earth yourself before picking anything up (touch a radiator or pipe).
The Camera consists of a bulky circuit board and a thin ribbon cable. If you can’t work out which one of these needs to be plugged in then I suggest you return the camera to sender, as you are clearly out of your depth.
- The camera is going to be connected to the serial connector behind the network port. The first thing you need to do is open this up by pulling on the sides of the plastic tab that is in the port. It should pop up, but not off.
- Now insert the ribbon cable into the connector with the shiny connectors facing away from the network port
- With the ribbon cable in the connector, press the plastic tab back down. This will lock the cable in place and ensure a strong connection.
Step 2: Turn it on
I am going to assume that you have a Raspberry Pi ready to run with a brand new SD card with Raspbian on it. If you don’t then go to this link, download NOOBS, install it to an SD card, install Raspbian then come back here.
- At start up you should be presented with a big blue config screen. Navigate down the option titled ‘Camera’ and enable the camera.
- Exit out of the config window and reboot the RPi
- Once it has loaded again, you should be presented with a command line. The clever among you might also have turned on ‘Boot To DeskTop’ back at step 1, in which case you’ll need to load up LX Terminal to get a command line.
- To test the camera you can start it using the command
- Bask in your victory for the the 5 seconds that the camera now stays on
Step 3: Playing around
The camera has two distinct modes – video and stills. I won’t bore you with a long technical explanation of the differences (because monkeys with a basic grasp of language can probably work that out!) but it is important to note that these modes represent the two core commands for running the camera.
These commands are the prefix for a range of additional options. At the end of step 2 for example, I used the command
raspivid -d : the
-d there denoted running the camera in demo mode. All of the commands are documented in some detail in this document and to be honest I can’t clarify or summarise it better than the authors have already done. To give you a flavour of the sort of commands you can construct, below is the one I used for a time lapse series of photos.
raspistill -q 75 - t 14400000 -tl 5000 -o /home/pi/images/image%06.jp -n
As lovely as the RPi camera is, it’s not perfect. In my playing with it this week, I’ve discovered that it’s a bit of a pain to make run on start-up; the exposure time is capped at 1/3s; and there are some weird bugs. I may post again on how to solve some of these for specific applications when I manage to actually sort out sensible work arounds.