Sunday, June 22, 2014

Long duration time lapse

After a couple of trials, I was ready to try a full day time lapse. Using the 7-day USB timer in my Cottonpickers solar project kit (see previous post), I set the timer to wake up the Pi at 5am and off at 10:30pm.

The Process

The Pi has a boot task in rc.local to immediately start a simple shell script that takes a few variables and kicks off the raspistill program. Here it is, if you are interested:

#!/bin/bash
# start a series of time lapse pictures every x seconds for y minutes
test_file=/home/pi/.timelapse
start_date_folder=$(date +%Y_%m_%d)
start_time_folder=$(date +%H_%M)
time_stamp=$(date +%Y-%m-%d-%H-%M-%S)
stills_path=/home/pi/stills/$start_date_folder/$start_time_folder
interval_sec=20
interval_ms=$(($interval_sec*1000))
#ONLY INTEGERS ALLOWED FOR VARIABLES (NO FLOATS)
run_hrs=17
run_mins=0
total_mins=$((60*$run_hrs+run_mins))
echo "total_mins = $total_mins"
duration_ms=$(($total_mins*60*1000))
echo "duration_ms $duration_ms"
shutdown_min=$(($total_mins+2))
echo "shutdown_min = $shutdown_min"
if ! [ -d $stills_path ]; then echo "make dir $stills_path"; `mkdir -p $stills_path`; fi
echo "starting raspistill"
raspistill -rot 90 -o ${stills_path}/still_%04d.jpg -tl $interval_ms -t $duration_ms && echo "shutdown now"


After all the pictures are taken, I run a separate shell script to encode the video from all those stills:

#!/bin/bash
path="/home/pi/stills/${1}/${2}"
#echo $path
output="timelapse_${1}_${2}.avi"
#echo $output
ls ${path}/*.jpg > list.txt && mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o $output -mf type=jpeg:fps=24 mf://@list.txt

I usually do the encoding later, but I could have it automated. I can also automate copying the resulting video to my dropbox folder.

Protecting the Hardware

The last photos of my Pi had it encased in the Nwazet camera case. I have taken steps to protect it from the elements. To keep expenses down, I used an old Lock & Lock food storage container that was large enough. Joey says my new case looks ghetto. My neighbor wondered what the hell it was. "It's a scientific experiment, yo!"

To get a clear viewport, I used a 2" hole saw to cut a hole into the lid, where I press fit a 52mm UV camera filter (and screw-on lens hood). I used aquarium silicone I had laying around to seal the fitting. I picked up the Chinese-made filter and hood for $6 on eBay.

It was also necessary to add additional holes in the case to attach the tripod adapter bracket. The tight fit prevents from using my larger USB Wi-Fi dongle, so I'm getting a right-angle USB adapter for that ($3 on eBay). In the mean time, I have my stubby one in place, which, I usually remove during photography to save power. However, the solar kit, which has 1500ma panel and (4) 3400mAh Li-ion batteries easily handled the Pi with the Wi-Fi running!

Notice also the bubble level attached to the top of the camera. This allows me to get it level with the horizon quickly. The next order of business will be to plug up those holes to keep out bugs and moisture. I'm afraid of introducing a microclimate that creates moisture, so maybe I'll use some extra window screen material or open cell foam. I may thrown in some silica packets too for good measure.


The Result

This 17 hour time lapse probably took around 2 hours to encode (also done on the Pi). Once complete, I upload to YouTube for sharing. This time, the color balance was a bit off, skewed to warmer temperatures. I made a correction in youTube, but I'm not sure if this was because of the UV filter. I used the filter on a previous trial without this side-effect.


Tuesday, June 10, 2014

Solar Goodies Arrive

A few days ago, my solar kit arrived. I purchased the Solar Project / Timer Box Combo (#2), made in the UK by an independent person(s), who goes by the moniker of Cottonpicker. This kit comes with the following items:

  1. 1500ma Solar panel with USB port
  2. Empty Li-ion Holder for 4x18650 rechargeable Li-ion batteries (stores about 40 watt hours)
  3. 7 Day timer to switch the Pi on and off at set times (or anything else USB powered)
  4. A4 sided box to hold it all in and keep the worst of the weather out.
  5. Simple plastic holder for the Pi
I purchased the 4 Li-ion batteries from Orbtronic.com (Panasonic 3400mAh 18650), which arrived a week or so before the package from the UK.

image
Complete view

image
Battery pack / charge controller with Li-ion batteries installed.

image

The charge controller prevents overcharging. The maker's claim, "It will charge the pack (up to 13,000mah) in around 10 hours of good sun and can power the Raspberry Pi B model for around 20 hours or the Raspberry Pi Model A for around 40 hours with fully charged batteries. If you use the timer to switch the Pi off at night or only switch on a few hours a day you could run all year in a remote location."

The kit has met my expectations so far, with no surprises. The quality seems to be quite good, and the little Pi case, which appears to be a basic 3D printed one-piece design was a nice touch. If you're wondering what this set me back, it was $95 US for the solar kit (incl. shipping) plus $43 for the Li-ion cells (shipped). For the money, I don't think you can do any better. Just look at the stuff sold by goalzero, and I think you'll agree. Of course, this is at the expense of going with stuff that won't be serviced & supported in the same way.

I've had the panel charge in the sun for a couple of days and will soon be ready to test with my Pi model A just how long it will run. I am also working on a DIY weatherproof enclosure for my Pi so I can run it without worry of water damage.

Cottonpicker's Place - Solar kit
Orbtronic - Panasonic 3400mAh 18650 product page

Monday, June 2, 2014

Legit case; weather time lapse videos

I invested in a case for my model A Pi so that I can securely mount it to a tripod. I decided to go with the nwazet case, which is laser cut plastic pieces.
So far, my USB battery unit has easily powered my Pi for 4 hours, leaving 2 bars left. I may soon try a 5 hour use. I always remove the wifi dongle when I use it off battery power to reduce power consumption.
Here are a couple of 4 hour time lapse videos