A few years ago, as part of a project I worked on, we sent a GoPro camera into the sky above the town centre here in Hull. A wonderful time was had by all, the young people were having fun seeing their city from a strange and new angle. Until, the giant red helium balloon made it’s escape (long story).
I sat on the idea until this year when I was asked if I could do something over the summer holidays with the young people of Hull.
“I could do some sort of balloon mapping photography thingy”
I foolishly announced.
As a result of this I found myself looking into how it was possible to do something similar to the GoPro workshop but with less expensive kit, and less canisters of helium.
I finally settled on the idea of using a Raspberry Pi, specifically a Raspberry Pi Zero W, as the brains of the operation. This amazing little computer can (in a pinch) serve as a desktop replacement machine – I’ve used my personal Pi Zero W on the odd occasion when I’ve destroyed my main PC and needed to get something off the internet onto a USB stick.
The Pi Zero W is slightly over-specced for what we need to do with it’s built in Bluetooth and WiFi. but it’s tiny and super light.
It also has a specially designed, mega tiny, 5 megapixel camera that simply connects directly to the Pi Zero. It can be a bit fiddly, but it will connect to the Pi and add almost no extra weight to the package.
Next we needed a method of getting airborne. Here I returned to the original workshop and decided that a suitably sized helium balloon would do the job nicely. A short trip to the local balloon store (doesn’t everyone have one of those?) and I had a costing for a relatively huge balloon.
Brilliant. I had all the parts I needed to get a camera airborne and take photos.
Until one lunch time, happily munching away on my sarnie (home made, boring – it must have been towards the end of the month) I realised I had not thought about how to power this kit.
A pretty major oversight if you ask me.
A quick Google search later and I had my answer. I knew the Raspberry Pi required the equivalent of a mobile phone charger to power it, a very useful addition as I have many micro USB cables and sockets around the house. Not much help, but, it turns out that the Pi Zero W draws such a small amount of power (1.2 amps according to the official Pi documentation). Which means that pretty much any mobile phone charger will do the job. There is still the small issue of plugging said charger in though. Especially as we will hopefully be soaring up where the air is clear as the song says…
Inspiration. Obvious. I’m sure it has occurred to you dear reader that surely I could use one of those portable mobile phone charging bricks. Well, yes. It occurred to me too, as I was starting at them in Home Bargains (other cheap shops are available).
I bought one there and then for the total cash price of £2.99, and tried it as soon as I got back to the office. It worked. Brilliant. How long would the juice last? Who knows, but it works!
Next up was to work through the code myself, so that I knew everything would work when I delivered the session with the young people.
The code turned out to be quite simple. The Picamera had it’s own set of instructions for python (my programming language of choice) and once you have initiated the camera module (a setting in the raspi-config application) you can download the code and simply go nuts.
sudo apt-get update
sudo apt-get install python-picamera
to download and install the python commands for the camera.
Then it’s simply a matter of opening your python IDE of choice (if you are on the Pi then Thonny is my current favourite – and it comes with the latest version of Raspbian).
My code looked something like this :
import picamera #Import the code for the picamera from time import sleep #Import the sleep command camera = picamera.PiCamera() #Setup an alias for the camera sleep(300) #pause for 5 minutes so we dont get photos of us sticking the pi to balloon for img in range (0,3000): #Loop 3000 times incrementing by 1 each time camera.capture ("/home/pi/hcl/image "+str(img).zfill(5)+".jpg") #Capture an image and store it in the location adding the loop number to the filename sleep(2) #pause for 2 seconds before repeating
You may notice there is a random thing in the code. A “zfill(5)” – this ensures the number is at least 5 values long, ensuring that Linux filenames list properly. For some reason the Linux file system read the filenames as 10,11,12….18,19,1,21,22… etc which was a bit annoying. This means that all the filenames are 00001,00002,00003 and so on so they list correctly in the file explorer.
A quick test of the code meant that I knew everything worked and we had a system that could take photos on a regular basis.
Next up was to remove the comments and to test the young people as part of the workshop.
Before we went out we combined the Raspberry Pi, the Picamera and the battery pack, shoved everything apart from the camera into a food sandwich bag and used the highly technical method of a wooden craft lolly stick to stop the camera (on it’s flimsy ribbon) from moving around too much and giving us blurry photos.
I scavenged a reel of strong ribbon from our craft team and tied it to the bottom of the balloon (100m of ribbon was a good idea even if it was a bit overkill as we used only 30m of it before I got scared – the young people wanted to go higher, but I didn’t want to lose another balloon).
The battery pack held out and we got two runs of brilliant photos. One set from Bransholme and one set from the town centre and Queen’s Gardens. I took the photos and combined them in a couple of videos that you can see over on the Hull Library youtube channel.
Bransholme – https://youtu.be/hnU9YzQ6wFg
Queen’s Gardens – https://youtu.be/YxnWm5mxYNc
My favourite images are shown below, one from when we reached the heady heights of 30m above Queen’s Gardens and the other when we managed to capture the preparations for Hull’s Freedom Festival.
All in all, I think the sessions were a success and I have lots of ideas about how I could use the tiny Picamera in my own projects…
Oh, and for those of you interested, we never did get the GoPro back.
1 x Raspberry Pi Zero W (with adaptors)
1 x SD card for Raspberry Pi Zero W
NOOBS 16GB microSD card (2.7)
1 x Picamera Zero
1 x Large helium balloon
1 x Lolly stick – Craft shop
1 x Portable mobile phone charger – Home Bargains
1 x Sandwich bag
1 x Roll tape