Solar-powered Raspberry Pi Camera

By David Crookes. Posted

Building a new family home from scratch is not for the faint-hearted. Neither, on reflection, is climbing up a tree to install a solar panel and a CCTV camera, and yet Kaspars Dambis has done both.

One thing led to another. “I wanted to monitor the construction site remotely because we currently live 100 kilometres away,” he says. But rather than buy an off-the-shelf CCTV system, he purchased a dummy camera case, creating his own way of capturing images using a Raspberry Pi 3 Model B computer.

“From the start, I wanted to keep watch over the building of our home and create a time-lapse of the process for fun,” explains Kaspars. “I knew it had to be a battery-powered and wireless system because getting mains power to the device wasn’t going to be possible on a site like that.”

A 12 V, 7 Ah lead-acid battery has been sufficient to provide an average power consumption of 2 W since it can provide 84 watt-hours of energy

Seeing the light : solar-power

Kaspars picked up a lightweight 18 V 5 A solar panel that was marketed as being perfect for charging boats and cars. This, he figured, would gather energy from the sun to charge a 12 V battery and, with the use of an inexpensive 12 V-to-5 V buck module, power the Raspberry Pi 3 Model B and an eight-megapixel Raspberry Pi Camera Module v2.

At first, Kaspars attempted to build a case from a generic project box, but he found it was relatively difficult to find decent clear glass for the camera window. “I then noticed a dummy security camera in a local hardware store which had perfect clear glass on one end, and full weather projection for the battery-powered LED system,” he says. And this worked a treat.

Using hook-and-loop fasteners, the Camera Module could be attached to Raspberry Pi’s case which, in turn, was secured to the inner housing of the camera casing. “The weather protection proved to be great, even during the winter months, and [my] Raspberry Pi never had issues with the temperature ranges either.”

To get as much energy as possible, the solar panel and the 12 V battery were positioned up high on a wooden frame, with the security camera device attached too.

This wasn’t ideal. “The battery was heavy and the frame broke during a storm, so I created two separate frames: one for the solar panel with the camera unit below and another for the battery and the solar charge controller,” he says.

Dummy security cameras can be picked up cheaply – this one cost Kaspars just $8

Monitoring from afar

Kaspars configured his Raspberry Pi to connect to a nearby WiFi access point via a standalone modem plugged in at his neighbour’s house by setting the access credentials in the wpa_supplicant.conf file in the root of the SD card. “The most basic time-lapse functionality was added using a simple Bash script which takes a picture from the raspistill tool at the desired time intervals and stores it on the SD card.” Connecting remotely involved setting up an external server and using the SSH tunnel, autossh. When up and running, a photo is taken every hour and it can be downloaded using SCP when connected to the same WiFi access point as Raspberry Pi. Video capture and real-time feeds can also be viewed in a browser.

It all means Kaspars is now able to remotely log in to his Raspberry Pi and eventually see his new home come into being. There is still an element of fear, though. “The ability to connect to a Raspberry Pi which is up in a tree powered by the sun and 100 km away is a special feeling,” he says. “Every command you type in the terminal has the potential to break the WiFi connection – and the cost of each mistake is a 200 km drive to restart the device.”

Subscribe