Friday, 15 May 2015

Kite-mapping with Raspberry Pi

Here is our Raspberry Pi Kite-mapping rig. It uses an A+ with a Xtrinsic Sensor  and ProtoCam board.






Some shots of it in action:




And here is the imagery produced during the second test flight over Bushy Park.

Backstory

One of the most interesting and fun and activities at last year's EMF14 festival was the kite-mapping workshops. I'd never really heard of this before but it is a simple and elegant idea: suspend a camera from a kite using a picavet, fly it and get yourself some cheap aerial photography.

Thanks to the awesome 'paying attention' skills of my son, we were able to win the workshop competition and take home a pair of kite kits and so we were well set up to try kite-mapping ourselves.

Reflecting the simplicity of the idea, most kite-mappers seem to use cheap, second hand cameras from eBay. As long as it has a continuous shoot mode and you can wedge a piece of cardboard under the shutter button, you're good to go.

However, even a second-hand camera could set you back £30 or so - comparable to the cost of a Raspberry Pi A+ and camera. I'd been thinking about a Pi-based kite-mapper over the winter and when I saw that AverageManVsRaspberryPi had released a new version of the excellent ProtoCam board for the A/B+, I decided to see what we could put together

Of course we could have just flown the Pi & camera and used the built-in functions to capture images. But I wanted to add some extra functionality. One of the problems with using a regular compact camera in continuous shoot mode is that if it is quite gusty, you can often end up with loads of 'wasted' shots as the camera swings about and isn't pointing straight down. Also, we always want to know how high the kite has gone and trying to estimate based on how much string has been unwound is really difficult and hugely inaccurate.

At first I experimented with separate MPL3115A2 and Minimu9 ICs, but then I found the Xtrinsic Sensor board from Freescale which has the altimeter, accelerometer plus a magnetometer all on a single board. There is also a useful API with some great Python sample code already available.
The fact that it comes with a header so that it can plug straight on to the GPIO pins made initial prototyping really quick.


Once we'd got some basic code running, we were then able to de-solder the header connector from the Xtrinsic and then solder the board  to the ProtoCam board using the pins designed to interface with the Freescale FRDM-KL25 platform. For added convenience we added a button to start/stop the photography and a bi-colour LED to indicate status.

First flights

Test flight one was just around the corner at the Rugby club.  It was cloudy and blustery and this was really just a test to see if the Pi rig would survive the physical conditions of flight. 



Apart from the fact that everything worked perfectly, there was one important lesson: make sure any loose cables are not impeding the lens! It was also clear that there was more that could be done in terms of selecting PiCamera settings. 

We also practiced gently bringing the Pi rig down to Earth (the helmet was because we cycled there, not for any health & safety concerns!). 

All the data recording worked as planned. Finally we could see how high the kite had gone: 120m is not bad! In theory you could use this data to automatically select the correct zoom level when adding the images to the maps using MapKnitter
Having performed some tests with various PiCamera settings, the next flight was intended to see how these worked in practice.  The wind was less constant and prone to dropping almost completely at times, as can be seen by the altitude data we recorded.  


Using the maximum resolution and making use of the image stabilisation option really helped produce some detailed, clear photographs.


We also managed to implement the safe-landing protocol successfully again:


Technical details

The pin connections between Pi and Xtrinsic board (see data-sheet for pin numbering and location) are as follows:

Pi (board / GPIO) Xtrinsic board pins
22 / GPIO25
12 / GPIO28
15 / GPIO22
13 / GPIO27
11 / GPIO11
18 / GPIO24
14 / GND
-
3 / SDA1
5 / SCL1
8 / TXD0
10 /RXD0
CN1-1
CN1-2
CN1-3
CN1-4
CN1-5
CN1-6
CN1-7
CN1-8
CN1-9
CN1-10
CN4-1
CN4-2


In terms of weight, the Pi system is slightly lighter with a compact camera. the held-together-with-duct-tape Canon Powershot I'd been using is 176g and the combined Pi and power pack comes in at 172g (the picavet and harness add an addition 60g).

The Python code and other resources are available from github.

The kite is a 9 ft wide by 4.6 ft tall delta.

Future developments:

  1. Build a more protective case for the rig. Some foamy padding around the Pi would be nice and almost certainly prolong the life of the equipment!
  2. Look at using the individual ICs directly onto the ProtoCam board. 
  3. Calibrate the magnetometer so that each picture is logged with the orientation of the camera as well as the altitude. This will help with knowing how to rotate each picture when using MapKnitter
  4. Add some automation to post-flight image processing and mapknitting.
  5. Add some additional buttons to the Pi to initiate a graceful shutdown and select various PiCamera settings (e.g. exposure, lighting type).



5 comments:

  1. Brilliant!
    Did you find you needed to experiment with the distance from Kite to rig much, or did it 'just work'. I guess a 9 foot delta has no problem lifting that weight.....
    Texy

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This is great, I would like to do the same with my son over the summer. What power source did you use for all that equipment?

    ReplyDelete
  4. Hey Richard. I'm a writer for The MagPi magazine here in the UK. I'm interested in interviewing you about this Pi Kite project. I've tried to get in touch but can't find your email so I thought I'd just drop a message here.

    It's a neat project and I'd love to cover it for The MagPi. Can you drop me a line at lucy.a.hattersley@gmail.com. Thanks! Lucy

    ReplyDelete
  5. Panoramio is only site you can explore the world with photos and maps

    ReplyDelete