Overview

How the Raspberry Pi 2 Fulfilled a Long-Cherished Wish

No Comments

One of my hobbies is photography. I took my first steps as a small boy with the camera my father gave to my mother as a present in the 1960s.

Agfa2

This camera didn’t have an exposure meter, so my father gave me some hints as to which aperture to adjust depending on the lighting conditions. He stuck a small note with instructions for my mother into the camera’s protection cap.

Zettel

This note is nearly 50 years old, and if you take a look at my father’s handwriting you can imagine why he is still the one who always writes the place cards for our family celebrations!

Later I was permitted to use my father’s first Nikon camera, and again I learned a lot about shutter speed, picture composition, depth of field or ISO numbers.

Apart from regular motives and scopes, I loved to experiment with new things, e.g. long-time exposures, double exposures or black and white, just to mention a few examples.

The Wood Effect

When in the 1980s one of my favourite bands – U2 – released their fourth studio album The Unforgettable Fire, I saw something I had never seen before.

You need to click on the link to see the cover. For legal reasons I will refrain from linking to it directly.

On the cover you can see the band standing in front of a castle in Ireland. The picture is a black-and-white infrared photo taken by the dutch photographer Anton Corbijn, and it showed me for the very first time what is commonly known as the Wood Effect.

It is named after his discoverer Robert Williams Wood, and it makes us aware that all plants reflect sunlight, which they need for photosynthesis. Otherwise they would get burned. Speaking of “burned”: The album’s title was named after an art exhibition that showed pictures taken by survivors of the atomic bombing of Hiroshima and Nagasaki.

I realised, though, that experimenting with infrared pictures would be very expensive. After all I was just a teenager with average pocket money, and I also had football on my mind!

From Analogue to Digital to Analogue

Eventually, digital photography arrived, and it is amazing to see the high quality of photos taken with today’s mobile phones. Along with digital photography came new interesting aspects such as panoramic photography, High Dynamic Range (HDR) or time-lapse photography. The current generation of mobile phones can handle all these aspects quite well.

The cover I looked at in 1984 was on an LP record. It is amazing that today many analogue things are en vogue again. This applies not only to vinyl, but also to analogue photography, which is seeing a renaissance.

The Project

When a new model of the Raspberry Pi was released early this year, its accessories and in particular its NoIR camera caught my attention. The camera is called „NoIR“ because it is able to take infrared photos. NoIR means that there is no notch filter that blocks infrared light.

Light is electro-magnetic radiation, but only a limited range can be perceived by humans. The shorter ultraviolet wavelength and the longer infrared wavelength are invisible to us.

But a camera’s sensor can catch these wavelengths. Therefore a notch filter is used to block these wavelengths and only to let through the wavelengths that we can perceive, so that a photo looks exactly like the motive we saw before.

Coming back to the Pi 2. I ordered the Pi 2 and accessories and planned to take infrared photos with it. The equipment included the Pi 2 itself, a microSD card for the operating system, the camera, a case, and a power supply. Taking photos outside at a later point in time would additionally require a power bank and the already existing WiFi adapter.

The Pi 2

The Pi 2, as compared to the previous model, comes with a 900 MHz quad core ARM Cortex-A7 processor and one gigabyte of main memory. The previous model only features a 700 MHz single core ARM1176JZF-S processor and only half as much main memory. Due to its higher performance, the power consumption is at a maximum of  4 W, whereas the previous model has a power consumption of  2,5 to 3 W. Its dimensions are equal to the previous model:

85mm x 56mm x 17mm (L x W x H)

Connections

The Installation of the Operating System Raspbian

I decided to use the operating system that is officially supported by the Raspberry Pi Foundation – Raspbian.

An image, which is nearly one gigabyte large, can be downloaded here: http://downloads.raspberrypi.org/raspbian_latest

In order to write it on the microSD card, we need a tool. For Windows we can use a SourceForge project Win32 Disk Imager:
http://sourceforge.net/projects/win32diskimager/

The unpacked image is written to the microSD card with Win32 Disk Imager.

Win32DiskImager

Afterwards we can boot for the first time. In order to do so, the Pi 2 needs to be connected to a router with an ethernet cable and of course to the power network.

PuTTY

To establish a connection to the Pi 2 over SSH, I use PuTTY.  In the administrator’s user interface of my router I can read out the IP address the Pi 2 was assigned.

PuTTY

After opening the connection I need to log in with the standard user pi and the standard password raspberry.

pi_looged_in

The First Configuratoin with raspi-config

The configuration tool raspi-config is useful for the first and most important settings.

sudo raspi-config

sudo is used for executing commands with higher user authorisation. It stands for superuser do.

config_expand

Expand Filesystem

We need to choose this first menu item in order to assign the entire disk space to Raspbian. This task is executed during the next boot sequence.

Enable Boot to Desktop/Scratch

We choose the option to boot directly to the desktop so we can connect to the Pi 2 with RDP later but also still use PuTTY.

Internationalisation

Change Locale

In an English system we don‘t need to change anything. But in a German system we set the locale to de_DE.UTF-8 and determine this to be the standard locale.

Change Timezone

We set the timezone to Europe, Berlin.

We can find this entry in /etc/timezone.

Europe/Berlin

Change Keyboard Layout

 We choose this menu item to change the keyboard layout.

Overclock

We choose the given option Pi2 to overclock the Pi 2.

The settings can be configured manually in boot/config.txt:

#uncomment to overclock the arm. 700 MHz is the default.
arm_freq=1000

And further below:

# Additional overlays and parameters are documented /boot/overlays/README
core_freq=500
sdram_freq=500
over_voltage=2

Advanced Options

There are two settings important to us.

Memory Split

We can set the portion of main memory the GPU is to be assigned.

The setting can be configured manually in /boot/config.txt:

gpu_mem=256

Update

We update this tool to the current version. After that we leave the tool and perform a reboot:

sudo reboot

APT

APT is the package manager of Debian und thus of Raspbian, too. The list of available packages and their current versions are updated as follows:

sudo apt-get update

In order to update the installed packages, we use the command as follows:

sudo apt-get upgrade

You can combine both commands. They are then processed successively:

sudo apt-get update && sudo apt-get upgrade

Remote Desktop

Next we install the package xrdp, using the package manager, to access the Pi 2 via remote desktop:

sudo apt-get install xrdp

After a reboot we are able to access the Pi 2 from Windows via RDP.

RDP

Desktop

The Camera

There are two models for the Pi 2: the „normal“ one and the NoIR version. As mentioned before, the NoIR lacks a notch filter and thus is able to detect the infrared spectrum. At first glance the name may be a bit deceptive.

Kamera

Some Specifications

  • Dimensions: 25 x 20 x 9 mm
  • Weight: 3g
  • Sensor: 2592 x 1944 equivalent to 5 megapixels
  • Fixed focus: from 1 metre to infinity

More information: https://www.raspberrypi.org/documentation/hardware/camera.md

Connecting and Activating the Camera

The camera is connected by means of a flat cable. Before connecting, you need to make sure that the camera was activated with raspi-config.

Loading the Actual Firmware

sudo rpi-update

After that, you need to reboot.

raspistill and raspivid

There are two programmes that you can control via scripts (bash or Python). raspivid is the programme for making videos with the camera. Thus I confine myself to raspistill to take photos.

To just take a simple snapshot, you can use the following command:

raspistill –o click.jpg

To get an overview of possible parameters, you can use the command:

raspistill –?

Some important parameters in a nutshell:

Parameter shortParameter longDescription
-?–helpDisplay help information
-w–widthWidth of the picture
-h–heightHeight of the picture
-q–qualityJPG quality 0 – 100
-r–rawIntegrates raw data into the metadata of the JPG file
-o–outputName of the output file
-tl–timelapseTimelapse mode in milliseconds
-sh–sharpnessSharpness of the picture -100 to 100
-co–contrastContrast of the picture -100 bis 100
-ISO–ISOISO sensitivity
-ev–evExposure value
-hf–hflipFlip the picture horizontically
-vf–vflipFlip the picture vertically

The RAW Mode

To obtain raw data from the camera und process it digitally later, we can take photos with the parameter –r. The camera doesn’t offer a direct raw file output, but the JPG has the raw data integrated in its metadata. This is why, at the beginning, we will get a much huger JPG file than before.

But there is a converter raspi_dng, that is able to convert JPG+RAW to DNG. In order to transfer the exif data from JPG to DNG we also need an exif tool, a library and Git.

All these packages can be installed in one go:

sudo apt-get install git libimage-exiftool-perl libjpeg62-dev

Then raspiraw needs to be downloaded from GitHub and compiled.

git clone https://github.com/illes/raspiraw.git
Cloning into 'raspiraw'...
remote: Counting objects: 14, done.
remote: Total 14 (delta 0), reused 0 (delta 0), pack-reused 14
Unpacking objects: 100% (14/14), done.

A subdirectory raspiraw was created. We change into this directory and execute the make utility.

cd raspiraw
make

Subsequently we copy the compilation to /usr/local/bin, so that we can use the command directly in the console next time.

sudo mv raspi_dng /usr/local/bin/raspi_dng

The process is as follows. First we take a photo with raw data:

raspistill –r –o raw.jpg

With the compiled raspiraw we can extract the raw data from the metadata of the JPG and convert it into the Adobe DNG format:

raspi_dng raw.jpg raw.dng

During this step no exif data has been copied, which is why we can use the previously downloaded exif tool to do so.

exiftool -tagsFromFile raw.jpg raw.dng -o raw.exif.dng

The Bash Script

For outdoor projects a little bash script had to be written. It was supposed to take three photos with ev -10, 0 an +10. Using these three photos, we could create a HDR later.

#!/bin/bash

if (( $EUID != 0 )); then
echo 'Please run this script as root!'
exit
fi

ts=$(date +'%Y-%m-%d-%H:%M:%S')
echo 'Timestamp='$ts

directory=/usr/local/bin
filename=$directory/img-$ts-hdr1.jpg
echo 'Taking photo#1'
raspistill -w 2592 -h 1944 -o $filename -ev -10
filename=$directory/img-$ts-hdr2.jpg
echo 'Taking photo#2'
raspistill -w 2592 -h 1944 -o $filename -ev 0
filename=$directory/img-$ts-hdr3.jpg
echo 'Taking photo#3'
raspistill -w 2592 -h 1944 -o $filename -ev +10
echo 'Done!'

There are no limits to the developer, e.g. you directly upload your photos to your Fritz!Box at home.

The Pi 2 on Outdoor Mission

In order to implement an outdoor project, I needed a mobile power supply, i.e. a powerbank, a WiFi adapter to telecontrol the Pi 2 from my mobile phone and an empty filmstrip as a replacement for a filter. The whole thing looked as follows:

Raspi_Powerbank

WiFi Configuration

In order to enable access to a WiFi network, we have to connect to the Pi 2 via remote desktop and then use a tool called wpa_gui. If you want to take photos outside you need to connect the Pi 2 to a WiFi hotspot on your mobile phone.

wpa_gui

Just click on Scan to see the available networks in reach.

scan_result

We choose the network with the desired SSID and double-click on it. We fill in the password on the following property page and click on Add.

x40_handy

Now we are able to connect to the corresponding WiFi network.

wpa_gui_done

The SSH Client App

Finally we need an SSH client app, which will allow us to access the Pi 2 and let us execute scripts. I use JuiceSSH for that purpose.

JuiceSSH

And now I present my first infrared photo, nearly 30 years after I saw the U2 cover. Unfortunately I didn’t have a castle and a band available, so our garden had to suffice. I took the filmstrip as a filter.

Erstes_IR

Then I used a small tripod that is actually used for a microphone, and instead of the negative strip I used an 850 nm screw filter, which I held in front of the camera’s lens. The result looked as follows:

Zweites_IR

Here we see the Pi 2 with a tripod during an outdoor shooting:

Außeneinsatz

And this is the photo it took:

Pi_Stahlwerk

The Defined Conversion

Unfortunately the joy about the results were clouded by the great and constant effort it took to bring the camera and myself into position. However the results were so good that I didn’t want to stop.

So I started investigating on the defined camera conversion, in which the notch filter is removed and replaced by a defined filter instead. From this very moment the camera can only take infrared photos. This is why I needed a second Nikon camera body, so that I could use my Nikon lenses. I purchased a smaller model that was overhauled by the manufacturer.

I found an alternative for converting the camera, which was half as expensive as before, so I decided to convert my camera into super colour infrared (580 nm). The decision which filter to take was difficult, because in the beginning I just wanted to take black-and-white infrared photos, but I realised that colour infrared photography also has its merits. Since you are able to digitally edit and transform photos into black and white I decided to use this filter.

All infrared photos need to be edited digitally because the camera with a 580 nm filter produces pictures with a reddish tint. You need to correct the white-balance manually and switch blue and red channels within a channel mixer tool. Not every software can handle these conditions well, and as Adobe products are too expensive, I looked for open source software. By the way, with Adobe Lightroom it is not possible to adjust the white-balance manually. You need to create a DNG camera profile for infrared photos to be able to do so.

The photographer who converted my camera develops his photos digitally and exclusively with open source software, for example darktable. So I set up a virtual machine with Linux, took photos – and marveled at the outcome.

Here are my first results after one week.

Stahlwerk Becker, 500 m away from home:

IR_Stahlwerk

Stahlwerk Becker again, alongside the water axis, colour infrared:

IR_Farbe

BuGa Area, Düsseldorf:

IR_BuGa

BuGa Area Düsseldorf, workshop for handicapped worker:

IR_WFAA

The Pi 2 project truly fulfilled my long-cherished wish. It is an ideal playground for small and big kids, and I believe that single-board computers should be part of every good school education. Let’s see what I will use it for next time.

If you are interested, you can visit me on Instagram. I am also looking forward to your enquiries or comments.

To all photographers: May there always be sufficient light, wherever you are.

The difference between men and boys is the price of their toys!

Thanks to Diana Kupfer for supporting me with the English translation!

Comment

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