"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." (Robert A. Heinlein)

Wednesday, 17 January 2018

New toy on the desk: Raspberry PI zero W and Raspberry Camera

Just before Christmas I have been to an electronics and surplus fair where I bought myself, among other things, a new Raspberry family “thing”. I started with a vague idea of building my very own “hackable” camera. I didn't have, and still don't, have a definitive idea of how it must be or what to do with it ... just it must be hackable i.e. I must be able to reprogram it once I need it for something else. I so bought a Raspberry Pi Zero kit, including the official withe-red case heath sink and male pin strip, and a 8 M pixel Pi Camera.

Headless installation

I'm getting quite used to prepare and install Raspberry Pi images, it's the fourth time, almost always headless. Plenty of tutorials can be found on the Internet by the way. This time is not very different apart from just one detail: I had to configure the Raspberry to connect to WIFI network from the very beginning.
So after copying the latest Raspbian image on the micro-SD card withe the usual “dd” command
sudo dd if=2017-11-29-raspbian-stretch-lite.img of=/dev/sdd

I configured Raspbian to enable SSH by default
sudo touch /media/maxx/boot/ssh

Then on the same root directory I created a “wpa_supplicant” WIFI configuration file
sudo vim.tiny /media/maxx/boot/wpa_supplicant.conf

Where I wrote down my wireless network configuration
country=ITctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdevupdate_config=1
network={ssid="WIFI"psk="secret"}

At last I powered the Raspberry Pi and scanned the WIFI network for the new entry computer.
I connected trough SSH and I went, of course, trough the usual post-installation operations like changing the Pi user password and expanding the file system to the full micro-SD extent.

Pi Camera installation

Once I verified the Raspberry was correctly working I powered it back down and connected the Pi Camera using the small flat cable also included in the Pi-Zero kit I bought.

I enabled the camera interface in the raspi-config tool and restarted the Raspberry.


Here is the camera “first light” I took by calling the snapshot command.


(I know it’s out of focus and I didn’t even remove the protective plastic tab from the lens ... but I liked the idea of the Raspberry taking a shot of itself as first thing). Once I checked the camera was working properly I installed it inside its case:


Then I powered the Raspberry with a cell-phone power bank and took it out for a brief tour, while the time-lapse command was autonomously taking photos. Here is one of the best shots


Now what?


Today I barely tested the Raspberry plus camera capabilities. For certain uses, like a remotely operated security camera, the current configuration could be enough, but for most of possible uses some sort of physical interface must be added. Picture quality is comparable with an average cell-phone camera but Pi Camera real strength lies In flexibility. In the near future I’ll add a bare minimum interface, at least power and shot buttons and some status indicator LED, and I’ll try using it as time-lapse camera.