Friday 31 August 2012

Eben talks about Raspberry Pi at PopTech

This video appeared on the www.raspberrypi.org blog. It explains a lot about the inspiration and history of the Raspberry Pi

Eben Upton: Raspberry Pi from PopTech on Vimeo.

This is the original Blog entry

Break out cable from Adafruit

This looks like an ideal breakout kit if you already have a bread board. Not tried it myself yet. Also available from Amazon in the UK.


Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

Tuesday 28 August 2012

"CEC" support, control the RPi through your TV's remote.

This article on www.raspberrypi.org has a good intro to CEC. This allows the TV to talk to the RPi via the HDMI cable. There is a video on youtube.

MPG2 and H264 encode.

It looks like MPG2 decode is available for a fee on a per CPU basis. This should allow the RPi to deal with more movie file formats including those used on DVD. It looks like the H264 encode will be enabled in later firmware releases. There is an article on www.raspberrypi.org and the store is at www.raspberrypi.com/mpeg-2-license-key/

Thursday 23 August 2012

Canon 400D control, downloading, HDR and timelapse

Looked at controling the Canon 400D with the RPi over USB. gphoto2 seamed a good start, this was available through apt-get on the raspian distro I am using, information from www.gphoto.org. Also looked a HDR and tone mapping, also managed to download pfstools through apt-get , information from pfstools.sourceforge.net. Also looked at enfuse available through apt-get and information from enblend.sourceforge.net

gphoto2 was basically working. However I wanted to take continuous time lapse photographs. It appeard to struggle after 7 frames for some reason. I'm unsure if the camera's resources were running out or the RPi's. I will need to investigate. I was taking dual JPED and RAW images. I manages to "fuse" three JPEG images of different exposures into a single TIFF image. I'm not sure if it was a HDR (16 bit float?) image but the exposure was excelent across the hole image. I need to solve the 7 frame timelapse issue and find a RAW file reader. The workflow I am looking for is somthing like.

gphoto2 => Canon RAW x3 (exposure bracketed)
Canon RAW => ?pfsindcraw? => HDR x3 (exposure bracketed)
HDR x3 (exposure bracketed) => enfuse => HDR x1 (Many 8 stops + dinamic range)
HDR => pfstm => JPEG (Tone mapped)

The idea is to use the RPi to do all this on the fly, hopfully as fast as the time lapse, so that the disk space requirments are very greatly reduced as the three RAW files are converted and deleted as more pictures are taken.


Part 2 So I had some success with bits of the system. I looked at the Photography Projects thread on the raspberry.org site. I found I had to get the small C file as discussed on a linux forum and compile usbreset executable. This built using cc usbreset.c -o usbreset followed by a chmod +x usbreset. I then wrote a bash script that called usbreset /dev/bus/usb/001/00x between calls to gphoto2. I stole the bash script from the Photography Projects thread that automatically worked out where the camera was attached. I found the camera kept moving around when the camerea was swiched on and off but the script could find it reliably.

The key to the discovery of the USB device is...
dev=`gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//'`
resetusb /dev/bus/usb/${dev}

I chose to call gphoto2 three times in the script to capture three images. I tried the single command line aproach shown in Photography Projects but I could not get it to work.
I used gphoto2 in --shell mode to discover the settings. Found for the canon 400D i needed to use
--set-config-index /main/capturesettings/exposurecompensation=0
--set-config-index /main/capturesettings/exposurecompensation=6
--set-config-index /main/capturesettings/exposurecompensation=12
Other combinations of command line options did not seam to give reliable results. The thread discusses a Nikon and the use of --set-config-value, I could not get this to work as expected for me.

I used the --filename xyz.jpg and --force-overwrite although I could not get it to work as I expected if the --filename appeared more than one. Therefore used seperate command lines for each photo aquired.

enfuse worked very well. With three small JPG images at three exposures they were combined into a single JPG with superior exposure. However I ran out of memory or TMP scratch space when I tried to produce a HDR image, eg floating point or 32 bit. Having reread the manual it looks like I may be able to set the scratch directory using TMPDIR enviroment variable and also set the cache size and buffer size. There is a table in the manual that is for systems with a lot more memory. I will try a setting in the same perportions scaled to RPi available memory. Note the available memeory will depend on how you have ivided up available memory between CPU and graphics. Raeding the manual it looks like enfuse does a weighted blens so it will reduce noise if given many pictures. enfuse did not do any tone mapping so the output was a suprior exposure but still natural. I played with the pfstools but I think because enfuse generated a LDR JPEG image the results were not very spectacular. The picture were quite ordinary. I need to retry this process and I think I can make improvments.

Raw images were too large to handle and I cause errors. I will stick with small JPG files for now. I may need to revisit RAW images. I think the lack of SD card space may be adding to the problems.

I will try the following workflow.
(gphoto => small jpg ) x 3
(x.jpg x 3) => enfuse => HDR_file.??? x 1 (Format not yet known)
HDR_file.??? => pfsin => pfstmo => frame.jpg.

Sunday 5 August 2012

poundWorld - bluetooth, USB power and HDMI

If I had a pound every time I bought something from a pound shop I would have, well, nothing?

At poundworld I bought bluetooth adapters. Not tried these yet, the one I used on RPi was on old one.
Also bought some "Blackberry" usb charger cables that, in theory, would power a RPi, ok, I've not needed them so far ether, so I don't know how good they are, but you can never have too many USB cables, right?

HDMI

PoundWorld also had some HDMI cables, perhaps a little short. I did not get them as I have a few I bought from poundLand. The ones from poundland work fine.

xbian.org - xbmc for Raspberry Pi

xbian.org looks interesting. Its a xbmc targeted image based on the faster raspian distro of debian. Not given it a spin yet. Looks like an alternative to raspbmc

Bluedevil, bluetooth and PS3 mini keyboard

So, I gave in in the end and installed bluedevil. (sumut like sudo apt-get install bluedevil) It was 200MBs of valuable SD card space but it did the job.
I downloaded the instruction manual for my Sony PS3 mini keyboard. The device did allows for pairing with devices other than a PS3. I paired it with an iPad for practice. So I then tried with the RPi using bluedevil and it worked!. The keypad has a built in mouse too, its a little strange to use but kind of works. Was a little too fast. To make the keyboard go into pairing mode you have to hold the blue button and turn it on. Keep holding the button until two lights on the keyboard flash alternately. (as in the instructions)Then in bluedevil I set up a manual key 1234 and tried to pair with the keyboard. When it tries to pair type the key into the PS3 keyboard and press return. On the keyboard press the finder button to enter mouse mode and then move you fingers over the keys like a track pad. The left and right cursor buttons act as mouse buttons in this mode. I would not recommend it as a major keyboard but it may be useful for administering a system where its not convenient to have a full size keyboard. Also if you use bluetooth for some other peripherals you can attach a simple keyboard without using up an additional USB port.

Wednesday 1 August 2012

The Bluez

To start looking at bluetooth I installed sudo apt-get install bluez This work with a cheap butooth dongle I had. I did not work out which chip set it was. I could see my iPone on the Raspberry Pi and the Raspberry Pi on my iPhone. Did not do much more than this. I did everything using the command line. There is some good reference on http://wiki.debian.org/BluetoothUser. However most GUI installs seamed very large so ended up NOT installing blootooth or bluedevil I just installed bluez. To check what will install, apt-get has a simulation mode using -s. It does not tell you the size of files but it lets you know if stuff exists and you get some idea of how much it depends on. eq sudo apt-get install bluez -s. Note that I have not actually paired anything yet. I will keep you posted.