All things Raspberry Pi and Time Lapse

Archive for June, 2012

RaspLapse Update

It was a little disappointing yesterday because my Raspberry Pi was supposed to ship from Newark/Element14 and it didn’t happen. The new ship date is July 5th July 12. But since this is the second third (or third fourth? I am losing track…) time they have moved the ship date I am not expecting it to ship on the 5th 12th of July.

An update on the Canon Powershot A510 is necessary as well. When the camera arrived it would not keep the date/time when the batteries were removed. This lead me to believe that the date/time battery was dead. After searching online I confirmed my suspicions. So I bought a pack of them from Amazon. It is really important that the camera can keep time when the power is off so when the Raspberry Pi starts it can get the time from the camera. And now with the new battery that will be possible.

Really looking forward to getting the Raspberry Pi and start testing! (Maybe someday I will get one….)

 

EDIT (June 02) – Just finished an online chat with Newark/Element 14 asking about the ship date being moved farther and farther back. His reply was that there was an unexpected development issue and it pushed ship dates back about 1-2 weeks.

Advertisements

gphoto2 camera scripts

I could not wait for my Raspberry Pi to arrive so I went ahead and wrote the scripts using gphoto to take pictures. These were written on a Fedora desktop, but since it is using standard Linux commands it should work from any distribution.

A very good tutorial on cron and at are availble here at IBM.

This first one is pretty standard. It will take a picture at noon once a day… The actual scheduling of the script will take place using the cron daemon.

#!/bin/bash
# jamesmiller
# 6-22-2012
#
# change directories to the correct folder to save the image
cd /home/jamesmiller/gphoto/1day
# actually take the picture using gphoto2
gphoto2 –capture-image-and-download –filename “%Y%m%d%H%M%S_1day.jpg”

Note the last line is supposed to be all on one line. The crontab entry for this first script will look like this… The twelve in the second position means to take the picture at 12:00 (noon) every day of the month, every month, every day of the week. Note that the time in cron uses a 24 hour clock.

0 12 * * * /home/jamesmiller/gphoto/1day

And the second one is very similar to the first. Except it will take a picture once every 5 minutes for an entire day on the first and fifth days of the month. In the final I will only use one of the days a month, but by shooting two days that gives me an error margin (if the power goes out that day) or some other unforeseen accident occurs.

#!/bin/bash
# jamesmiller
# 6-22-2012
#
# change directories to the correct folder to save the image
cd /home/jamesmiller/gphoto/5min
# actually take the picture using gphoto2
gphoto2 –capture-image-and-download –filename “%Y%m%d%H%M%S_5min.jpg”

Note the last line is supposed to be all on one line. This script is very similar to the last script except for the file location where it will store the images. This will keep the different scripts separate. However the crontab entry for this script is very different! The first (*/5) means to take a picture every 5 minutes, the second piece (4-20) means to only take the picture if the time is between 4am and 8pm, and the (1,5) means on the first and fifth of the month to execute. the last two stars mean every month, every day of the week. This script will provide a time-lapse that looks like 12 days – one for each month of the year.

*/5 4-20 1,5 * * /home/jamesmiller/gphoto/5min

The last script is more complicated. It uses cron and it also uses a different scheduling daemon called at.

#!/bin/bash
# jamesmiller
# 6-22-2012
#
# change directories to the correct folder to save the image
cd /home/jamesmiller/gphoto/1443min
# schedule the next runtime of this script
at -f ../camera_1443min now + 1443min
# store the date and time in a file to be read as the time
# when the picture was taken.
echo `date +%Y%m%d%H%M%S` >> ../1443_time
# actually take the picture using gphoto2
gphoto2 –capture-image-and-download –filename “%Y%m%d%H%M%S_1443min.jpg”

Note the last line is supposed to be all on one line. The purpose of this script is to take a picture at like 4:00am the first day, then the next day at 4:03, and the next day at 4:06 and so on. This last script will provide a very interesting time lapse as it will take one year and compress it into time lapse that looks like a day. It will start in the morning and end at night, but all 4 seasons will have passed. I am not totally sure at what time I want this to start, because there is no reason to take pictures in the dark. The cron details I have not finished working on yet, but I will add them here when I finish it.

cron details to follow

Those are my ideas for a year-long time lapse. This will give me three different looks into the scene over the course of a year. If anyone has other/more ideas for when the camera should take a picture do not hesitate to comment below!

More Pictures

The camera and the power supply for the enclosure have arrived! The power supply for the enclosure weighs a ton! It is about 3 inches square and it weighs about 4lbs. The camera with the cables attached is still just a little too wide… I took the wrist strap connector off the camera and that helped some and by putting the camera in at a very slight angle it will fit. Here are some pictures of the setup so far. All now that I am waiting for is the Raspberry Pi!

The bottom of the enclosure with the power supply. The other cable that is coming out of the enclosure is the power supply for the camera.

A close up of the enclosure power supply. It is very heavy!

The inside of the enclosure. Plenty of space to fit the Raspberry Pi!

Raspberry Pi Flash Drive?

The Raspberry Pi project has plans (I think) on opening a shop selling t-shirts, mugs, caps, stickers, and little things like that. I had an idea about another item they could sell. Flash drives shaped like the Raspberry Pi logo. What gave me the idea is that I have a penguin – looks like Tux, the Linux penguin – and it is a 4GB flash drive. So that gave me the idea about a Raspberry Pi flash drive. I created one in Autodesk Maya, but it did not turn out that great. Here are some pictures of what I created.

ImageImage

These next pictures show my penguin Flash Drive. The penguin flash drive is made by a company named Emtec. It is a really neat design that the little white thing on the key chain works as a holder for the cap when the flash drive is in use.

ImageImageImageImageImage

I would definitely buy a Raspberry Pi flash drive. What about you?

Link

Kids and their Raspberry Pis

Kids and their Raspberry Pis

Getting children programming is really what the Raspberry Pi project is all about. This post on their website shows pictures of children using a Raspberry Pi, some programming and some actually learning how to put Debian on an SD card to boot the Raspberry Pi. Congratulations to the Raspberry Pi team, those children in the pictures, and children (of all ages) around the world! 

Raspberry Pi System Clock

The Raspberry Pi does not have a battery to keep time when it is powered off. This means that every time the Raspberry Pi starts up, it has to get the time from a network server or from the user at boot time. Here is a Raspberry Pi forum confirming that there is no System Clock and how to set the time using NTP (Network Time Protocol). Unfortunately this is a major problem for my time lapse project and using NTP will not work because I will not be connected to the network/Internet. If you have internet a good tutorial on how to use NTP for RedHat/Fedora based systems is here, and a good tutorial for Debian/Ubuntu based systems is here. Over the course of a year there is a very good chance that the power will be off or flicker enough cause the Raspberry Pi to reboot at least once or multiple times. Since it is very important that the pictures be taken at the right time each day, if this is messed up it could cause major problems.

One option would be to connect the Raspberry Pi to a battery of some sort to provide power while the main source of power is down. I do not want to go that route because that adds expense and complexity. The other problem with a battery is what if the power is off long enough to drain the battery? If this happens then the Raspberry Pi would power down and time would be lost.

After some searching online, I think I have found a solution. And that solution is to set the Canon Powershot A510 time and then when the Raspberry Pi starts it will get the time from the camera to set the system time. The camera has a small battery to keep the system time, and it should last for several days without power.

So why did they build the Raspberry Pi without a System Clock? The reason is because that added cost and complexity and they were trying to keep the design cheap and simple. And most people are going to be using their Raspberry Pi’s where there is a network easily available, or  where time is not critical.

After I receive the camera I will post my script on how to get the system time from the camera and set the system clock using that time. However, all cameras function a little different so it may not work for all cameras.

Raspberry Pi Wallpaper

Whenever my RaspberryPi comes, I was thinking that I needed a cool wallpaper for it! While it is performing its duty for the time lapse it will not matter as I wont be seeing the desktop much, but for testing I thought it would be cool to have a relevant wallpaper.

Here is a wallpaper that I designed using the standard Raspberry Pi logo then some tweaking in Photoshop!

The next two are not mine but are ones that I thought are neat are available for download at this raspberrypi forum along with many other variations.

Tag Cloud