I'm in Bulgaria in a house at the foot of mount Vitosha, on the outskirts of
the capital, Sofia. Sofia is home to something approaching 2 million people
(which is more than 10% of the population of the whole country), and many
travel in and out each week to find work in the big city. Vitosha is the lungs
of the city, and its slopes are the perfect place to stay if you're keen to
walk in its forests, or ski, or just get some cool air in the heat of the
Sitting in the garden at dusk the other day, we spotted a couple of dark shapes scurrying along — pine martens! Or possibly their smaller cousin the beech marten:
They are beautiful creatures, but quite shy, and they only come out after dark... You can see where this is going — I wonder if I can capture some images with a Pi, a motion sensor and a camera module?
Well, first things first, I'm going to need to put it on top of next door's shed in the path of the night-time run that the martens make on their way to hunt mice or steal chicken's eggs from our neighbours. So I need a good battery pack...
As Gray Girling points out in his excellent Haynes manual, battery power for the Pi is harder than it looks at first sight. The Pi requires both fairly high current (at least for the Model B) and a quite stable voltage. And, as I found out when I when testing my first efforts, an unscheduled low voltage shutdown can corrupt the SD card image and leave you with an unbootable setup :-(
Time for an analysis of the perfect Pi battery pack, and Bulgaria is the perfect place to experiment with this stuff as it's crawling with electronics and computing engineers (having at one time been supplier of around half of the USSR's computer hardware). Lubo Bontchev of Selcom custom electronics has worked on everything from solar panels to satelites and has now built Pi.GATE some prototypes for hot-swap mobile Pi power. Here's the regulator circuit on the left and the controller on the right:
The regulator supplies the 5 volts at 1 amp that the Pi wants, and it has two input connectors and some clever circuitry to support hot-swap of battery packs. (In the picture we've got two packs attached, one full one and one discharged one, while we swap from one to the other.) The controller monitors battery levels and reports them to the Pi (over 3 binary-coded GPIO pins, for example) and also drives an indicator LED.
Now, figuring out how to test all this stuff is a lot of hard work, so, natural shirker that I am, I borrowed my nephew Vlady to help. He came up with a great idea — why not take a picture of the indicator LED whenever the GPIO level monitoring code detects a change? Here he is (in a photo taken from the Pi cam) at the Eureka! moment:
Nice one V, I think you've got yourself a job :-;
Our first test managed to run the model B for nine hours using eight AA NiMH batteries (2400mAh cells) — definitely promising!
Some more views of the regulator:
Now, where have those pine martens got to?