Tested on:Raspberry Pi 2; Raspberry Pi B+; Python 2.7; Raspbian pre Jessie
Prerequisites:Raspberry Pi with Raspbian Jessie and internet connection (see steps 1-7 in the Introduction)
Hardware:Raspi Camera or
PiNoir module and IR-lamp for night vision
0

Raspberry Pi camera and night vision with PiNoir

Boot the Raspberry Pi, enter

in the terminal and enable the camera. Shutdown the Raspberry Pi and open the connector closest to the ethernet port. Pull both sides gently… Then, put the cable into the connector with the blue side of the camera cable facing the ethernet port and close the connector, see

Raspberry Pi with camera closeup

The blue side of the camera cable plug points to the ethernet port

Snapshots from the terminal
To make a snapshot named mypic.jpg, enter

Show the help for more options like the image size and many others with

Videos from the terminal
To take a 5 second long video named myvideo.h264, enter

Change the viewpoint by adding the option -vf for vertical or -hf for horizontal mode.
The video duration is set by adding the option -t followed by the number of miliseconds.
The terminal help shows all valid options:

Using the camera in python
First, install the python drivers with

For python3, use

Sample python script
This script will create two snapshots, image1.jpg and image2.jpg with a 5 second pause between them. Then, a 5 second long video named myvideo.h264 is recorded.

Watch the video
Watch the video on your Raspberry Pi with the omxplayer from the terminal or copy the video onto your host computer with scp and watch it there.

Default parameters

All these parameters can be set in python! Additionally, see the picamera documentation, the raspberrypi.org camera usage tutorial or the picamera GitHub repository.

Night Vision!
The IR night vision camera PiNoir can be setup like the original Raspberry Pi camera. They look almost identical, besides the PiNoir being black:

Raspberry Pi camera(left, green) and PiNoir(right, black)

Raspberry Pi camera(left, green) and PiNoir(right, black)

For having night vision by using the IR light sensibility of the PiNoir, an IR lamp like this is required:

Assembled IR lamp for using the PiNoir camera of a Raspberry Pi

Assembled IR lamp for using the PiNoir camera of a Raspberry Pi


The PiNoir and the IR lamp in action

Links
PiCamera documentation: http://picamera.readthedocs.org/en/release-1.9/
Raspberrypi.org camera usage tutorial: http://www.raspberrypi.org/documentation/usage/camera
PiCamera GitHub repository: https://github.com/waveform80/picamera

Knight of Pi

Johannes Bergs aka Knight of Pi. Diploma in Bioinformatics, some Webdesign and Python coding then. Living in the beautiful city of Vienna.

Comment

Time limit is exhausted. Please reload CAPTCHA.