The next mini project for my Debian server was to display a still image from a remote webcam, i.e. one that was not connected to my home network. To further complicate matters I wanted to show a picture from our allotment. This meant coming up with a solution that provided power and network connectivity in a place that had neither.
My first thoughts were to use my Raspberry Pi and connect it to a solar charged battery system and install a 3G card for data access. After researching solar powered systems that would work completely autonomously for a substantial length of time I concluded that this would prove prohibitively expensive for what was, after all, just a temporary home project. Therefore, I didn’t pursue 3G card connectivity on the Raspberry Pi.
So, having another Android smartphone lying around, I decided to have a look at using that. Low powered smartphones are almost perfect for these type of projects as they provide a webcam, data connectivity and have their own power (albeit for a limited amount of time).
I installed a pay as you go sim card in a Sony Xperia Tipo (ST21i) on the Three network as the data tariff is only 1p per MB. I only wanted a still image rather than a constant stream so I thought this would not prove too expensive.
The next thing was getting a suitable Android app. I came across mobilewebcam which would take a picture at any specified interval and upload that picture to Dropbox. I tested this at the allotment, had a good mobile signal and got a successful upload.
Power was the next thing and I purchased a cheap Chinese 10000mAh USB battery pack for £8.99 on Ebay. This managed to keep the phone going for about 8 days, enough for testing purposes. The battery pack has a solar panel built in but it will not allow current to be drawn from it while it is charging.
Having a way of powering the phone, taking a picture and getting it to Dropbox I then needed to display it on the web page served up by the Debian web server.
I installed Dropbox on the Debian server as detailed here.
In the mobilewebcam app you can specify how to name the images as they are taken, either with a specific filename, which will be overwritten every time a picture is taken, or with a datetime filename, which won’t be overwritten. I went for a filename of current.jpg so that my cronjob could just copy the file into the web directory and the web page would always show the latest image.
*/30 * * * * cp /root/Dropbox/Public/current.jpg /websites/mysite/www/
An example is shown below showing the view from the allotment shed.