First Look at the Raspberry Pi Camera with CS Mount Lens

Raspberry PI Camera
en.pdf24.org    Send article as PDF   
Back at the end of December 2013 I discovered and purchased a Raspberry Pi Camera Board with a CS Mount Lens already fitted and is supported in the latest version of Raspbian, Raspberry Pi’s preferred operating system. The ArduCAM Group have released an add-on camera module for Raspberry Pi which is fully compatible with official one. The camera duly turned up a fortnight later in a small box which had been packed with great care. I finally organised myself to check the Raspberry Pi Camera module a few days ago.

RaspberryPI Camera

The Camera attaches to Raspberry Pi by way of one of the two small sockets on the board upper surface. This interface uses the dedicated CSI interface, which was designed especially for interfacing to cameras. The CSI bus is capable of extremely high data rates, and it exclusively carries pixel data.

The camera fitted easily and works straight out of the box, as advertised.

Setting Up the Camera:

To get the camera up and running just follows these instructions:

  1. Be aware that the camera can be damaged by static electricity. Before removing the camera from its grey anti-static bag, make sure you have discharged yourself by touching an earthed object such as a PC Case. Carefully remove your Raspberry Pi Camera module from its antistatic packaging.
  2. Install the Raspberry Pi Camera module by inserting the cable into the Raspberry Pi. The cable slots into the connector situated between the Ethernet and HDMI ports, with the silver connectors facing the HDMI port. Take care and make sure that the ‘Blue Taped Side’ of the camera cable end faces the Ethernet port. I suggest you take the time to watch James Adams’ video below.
     
    [yout
  3. Boot up your Raspberry Pi.
  4. Open up a Terminal Window and from the prompt, run “sudo raspi-config“.
raspberry-pi-camera-installation-1

If the “camera” option is not listed as shown above, you will need to run a these commands to update your Raspberry Pi.

  • Run “sudo apt-get update“, which updates the list of available packages and their versions, but it does not install or upgrade any packages.).
  • Next run “sudo apt-get upgrade“, which actually installs newer versions of the packages you have. After updating the lists, the package manager knows about available updates for the software you have installed.
  • When finished run “sudo apt-get autoremove“, to remove all of the redundant packages after the latest upgrade.
  1. Navigate to the “Camera” option, and enable it.
raspberry-pi-camera-installation-2
  1. Select “Finish” and reboot your Raspberry Pi.
raspberry-pi-camera-installation-3

If all has gone to plan your Raspberry Pi Camera should now be ready to use.

There are two ‘main’ commands you’ll need to use the Raspberry Pi Camera board to take pictures and video. From the command line . . .

The following command allows you to take still pictures:

raspistill

The following command allows you to take video:

raspivid

Both also have a large set of subcommands that will allow you to change the input and output variables of the picture (e.g. name, format, delay period, video length, effects etc.).

Taking a Photograph:

Lets start testing the newly installed Raspberry Pi Camera by taking some photographs.

The default save folder for images take with the Raspberry Pi Camera is “/home/pi“. Open the “File Manager” too view outputted files as they’re taken, and use “LXTerminal” too issue the camera commands.

raspistill“, runs a command line application that allows you to capture images with your camera module. Below is an example of this command in use.

To capture an image in jpeg format, type “raspistill -o image.jpg” at the prompt. “my_image.jpg” will be the name of the image you have taken just taken with the camera.

my image

If you want the camera to actually take a picture you’ll need a few basic subcommands as follows, these need to be inputted after the main command, with a space in between:

  • -o” or “-output“, which specifies the output file name and format.
  • -t” or “-timeout“, which specifies the amount of time that the preview will be displayed in milliseconds (ms). This is set to 5 seconds (5000ms) by default, and the raspistill will capture the final frame of that 5 second period. Or in other words it commands the camera to run for a specific time period, and then take JPG capture at end if requested.

If you want the Raspberry Pi to list the full list of subcommands, simply issue the “raspistill” command without the subcommands attached to the command.

Listed below outlines the available subcommands to use with the “raspistill” command.

Usage: RaspiStill [options]

Image parameter commands:

-?, –help : This help information
-w, –width : Set image width <size>
-h, –height : Set image height <size>
-q, –quality : Set jpeg quality <0 to 100>
-r, –raw : Add raw bayer data to jpeg metadata
-o, –output : Output filename <filename> (to write to stdout, use ‘-o -‘). If not specified, no file is saved
-v, –verbose : Output verbose information during run
-t, –timeout : Time (in ms) before takes picture and shuts down (if not specified, set to 5s)
-th, –thumb : Set thumbnail parameters (x:y:quality)
-d, –demo : Run a demo mode (cycle through range of camera options, no capture)
-e, –encoding : Encoding to use for output file (jpg, bmp, gif, png)
-x, –exif : EXIF tag to apply to captures (format as ‘key=value’)
-tl, –timelapse : Timelapse mode. Takes a picture every <t>ms

Preview parameter commands:

-p, –preview : Preview window settings <‘x,y,w,h’>
-f, –fullscreen : Fullscreen preview mode
-n, –nopreview : Do not display a preview window

Image parameter commands:

-sh, –sharpness : Set image sharpness (-100 to 100)
-co, –contrast : Set image contrast (-100 to 100)
-br, –brightness : Set image brightness (0 to 100)
-sa, –saturation : Set image saturation (-100 to 100)
-ISO, –ISO : Set capture ISO
-vs, –vstab : Turn on video stablisation
-ev, –ev : Set EV compensation
-ex, –exposure : Set exposure mode (see Notes)
-awb, –awb : Set AWB mode (see Notes)
-ifx, –imxfx : Set image effect (see Notes)
-cfx, –colfx : Set colour effect (U:V)
-mm, –metering : Set metering mode (see Notes)
-rot, –rotation : Set image rotation (0-359)
-hf, –hflip : Set horizontal flip
-vf, –vflip : Set vertical flip

Extra Command Settings:

Exposure mode options:

off, auto, night, nightpreview, backlight, spotlight, sports, snow, beach, verylong, fixedfps, antishake, fireworks

AWB mode options:

off, auto, sun, cloud, shade, tungsten, fluorescent, incandescent, flash, horizon

Image Effect mode options:

none, negative, solarise, sketch, denoise, emboss, oilpaint, hatch, gpen, pastel, watercolour, film, blur, saturation, colourswap, washedout, posterise, colourpoint, colourbalance, cartoon

Metering Mode options:

average, spot, backlit, matrix

Download a copy of the RaspiStill Subcommand List.

 

Still Capture Examples:

By default, captures are done at the highest resolution supported by the sensor. This can be changed using the “-w” and “-h” command line options.

Taking a default capture after 2s (note times are specified in milliseconds) on viewfinder, saving in image.jpg

raspistill -t 2000 -o image.jpg

Take a capture at a different resolution.

raspistill -t 2000 -o image.jpg -w 640 -h 480

Now reduce the quality considerably to reduce file size

raspistill -t 2000 -o image.jpg -q 5

Force the preview to appear at coordinate 100,100, with width 300 and height 200 pixels.

raspistill -t 2000 -o image.jpg -p 100,100,300,200

Disable preview entirely

raspistill -t 2000 -o image.jpg -n

Save the image as a png file (lossless compression, but slower than JPEG). Note that the filename suffix is ignored when choosing the image encoding. 

raspistill -t 2000 -o image.png –e png

Add some EXIF information to the JPEG. This sets the Artist tag name to Boris, and the GPS altitude to 123.5m. Note that if setting GPS tags you should set as a minimum GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, GPSAltitude and GPSAltitudeRef.

raspistill -t 2000 -o image.jpg -x IFDO.Artist=Boris -x GPS.GPSAltitude=1235/10

 

Filming a Video:

Now we have taken our first photographs with the newly installed Raspberry Pi Camera, now lets tes the camera’s video capturing capabilities.

As with taking a still photograph, the default save folder for images take with the Raspberry Pi Camera is “/home/pi“. Open the “File Manager” too view outputted files as they’re taken, and use “LXTerminal” too issue the camera commands:

raspiVid“, runs a command line application that allows you to capture images with your camera module.

To take a video of my rabbit, we issue the following command in order to take a 15 seconds video in h464 format.

raspivid -o bunny.h464 -t 15000

In this example we use “-o bunny.h464” to specify we want the file to be named bunny, and for it to be in h464 format. We use “-t 15000” to specify that we want the video to be 15 seconds long.

As with the “raspiStill” command there are a large number of subcommans available to you.

Listed below outlines the available subcommands to use with the “raspiVid” command.

Usage: RaspiVid [options]

Image parameter commands

-?, –help : This help information
-w, –width : Set image width <size>. Default 1920
-h, –height : Set image height <size>. Default 1080
-b, –bitrate : Set bitrate. Use bits per second (e.g. 10MBits/s would be -b 10000000)
-o, –output : Output filename <filename> (to write to stdout, use ‘-o -‘)
-v, –verbose : Output verbose information during run
-t, –timeout : Time (in ms) before takes picture and shuts down. If not specified, set to 5s
-d, –demo : Run a demo mode (cycle through range of camera options, no capture)
-fps, –framerate : Specify the frames per second to record
-e, –penc : Display preview image *after* encoding (shows compression artifacts)

Preview parameter commands

-p, –preview : Preview window settings <‘x,y,w,h’>
-f, –fullscreen : Fullscreen preview mode
-n, –nopreview : Do not display a preview window

Image parameter commands

-sh, –sharpness : Set image sharpness (-100 to 100)
-co, –contrast : Set image contrast (-100 to 100)
-br, –brightness : Set image brightness (0 to 100)
-sa, –saturation : Set image saturation (-100 to 100)
-ISO, –ISO : Set capture ISO
-vs, –vstab : Turn on video stablisation
-ev, –ev : Set EV compensation
-ex, –exposure : Set exposure mode (see Notes)
-awb, –awb : Set AWB mode (see Notes)
-ifx, –imxfx : Set image effect (see Notes)
-cfx, –colfx : Set colour effect (U:V)
-mm, –metering : Set metering mode (see Notes)
-rot, –rotation : Set image rotation (0-359)
-hf, –hflip : Set horizontal flip
-vf, –vflip : Set vertical flip

Extra Command Settings:

Exposure mode options :

off,auto,night,nightpreview,backlight,spotlight,sports,snow,beach,verylong,fixedfps,antishake,fireworks

AWB mode options :

off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,flash,horizon

Image Effect mode options :

none,negative,solarise,sketch,denoise,emboss,oilpaint,hatch,gpen,pastel,watercolour,film,blur,saturation,colourswap,washedout,posterise,colourpoint,colourbalance,cartoon

Metering Mode options :

average,spot,backlit,matrix

Download a copy of the RaspiVid Subcommand List.

 

Video Capture Examples:

Image size and preview settings are the same as for stills capture. Default size for video recording is 1080p (1920×1080)

Record a 5s clip with default settings (1080p30)

raspivid -t 5000 -o video.h464

Record a 5s clip at a specified bitrate (3.5MBits/s)

raspivid -t 5000 -o video.h464 -b 3500000

Record a 5s clip at a specified framerate (5fps)

raspivid -t 5000 -o video.h464 -f 5

Encode a 5s camera stream and send image data to stdout

raspivid -t 5000 -o –

Encode a 5s camera stream and send image data to file

raspivid -t 5000 -o – > my_file.h464

 

Final Thoughts:

I am extremely happy with my purchase. The Raspberry Pi Camera Module with CS Mounted Lens from ArduCAM Group has amazing image quality, including in low light situations as well. For a price of US$30.00, it is a steal.

I would like to locate a Zoom style lens to suite the camera. A Zoom Lens would really make a great companion to this Raspberry Pi Camera Module. Thus far I can only seam to find Infra-red Lenses that fit the bill…

In the future I think I will purchase the Infra-red version of the camera from ArduCAM Group. And I have quite a collection of CS Mount IR Lenses which would be well suited to the camera already gathering dust.

So if you have a Raspberry Pi and you want to add a camera to the package, then the Raspberry Pi Camera Module from the ArduCAM Group will take some beating when it comes to quality of build and image. And not forgetting price..

Previous Post
Raspi Forklift

Set-Up the Initial Software Configuration for the BrickPi

The BrickPi is an add-on board from Dexter Industries that gives your Raspberry Pi LEGO® Mindstorms NXT Compatibility. The BrickPi helps you connect LEGO® Mindstorms sensors, motors, and parts to ... Read more

Next Post

Opto-pi: Raspberry Pi Opto-Isolator Board

I have just backed this project on Kickstarter, and feel that if you are a Raspberry Pi owners looking to use higher voltages with your mini PC, then you might ... Read more

Short URL: http://tinyurl.com/gonmcvr

Leave a Reply

Your email address will not be published. Required fields are marked *



Do NOT follow this link or you will be banned from the site!
error: Content is protected !!