Thursday, October 8th, 2015
Not long ago, I stumbled upon Ken Murphy’s amazing History of the Sky project. The concept is simple; take a picture of the from sunrise to sunset every 10 seconds every day for a year. He then made a mosaic of the images, and ran it as a slide show all at once. You know what, I think its easier if I just show you what he did:
Around the time I found this, I started diving in to the Raspberry Pi, and I thought that this little computer could probably reproduce Ken’s amazing project. I thought I could update it with the Chicago Skyline.
After a series of false starts, I finally got a Raspberry Pi and camera sealed inside a sandwich container (my version of a weather-proof box). It is currently sitting on the roof of the McGowan Science building at DePaul University. It wakes up at 4:30AM every day, and takes a picture every 10 seconds until 8:30AM. That is 360 pictures per hour or 1440 per day. Another program compresses them into a movie, which gets uploaded into my DropBox account. My project started on October 1st, 2015, so I have captured a week of Chicago sunrises. Here is the first one:
Another Raspberry Pi downloads the movies, and breaks them into a series of stills. When I have enough, they will be assembled into a mosaic image, and turned back into a movie. With luck, I will have 365 movies to work with.
This Python Program is what I use to take the pictures.
import time import picamera VIDEO_DAYS = 1 FRAMES_PER_HOUR = 360 FRAMES = FRAMES_PER_HOUR * 3 * VIDEO_DAYS file = "/home/pi/camera/frame_%04d.jpg" #file = str("/home/pi/camera/" + time.strftime("%Y%m%d") + "_%04d.jpg") def capture_frame(frame): with picamera.PiCamera() as cam: time.sleep(2) cam.resolution=(1280,720) cam.capture(file % frame) # Capture the images for frame in range(FRAMES): # Note the time before the capture start = time.time() capture_frame(frame) # Wait for the next capture. Note that we take into # account the length of time it took to capture the # image when calculating the delay time.sleep( int(60 * 60 / FRAMES_PER_HOUR) - (time.time() - start) )
This code was used to turn it into a movie. It is a bash script
#!/bin/bash DATE=$(date +"%Y%m%d") avconv -r 10 -i /home/pi/camera/frame_%04d.jpg -r 10 -vcodec libx264 -crf 20 -g 15 /home/pi/camera/$DATE.mp4
Finally, this Python Program uploaded it to DropBox.
import time from subprocess import call date = time.strftime("%Y%m%d") path = "/home/pi/camera/"+date+".mp4" destination = date+".mp4" photofile = "/home/pi/Dropbox-Uploader/dropbox_uploader.sh upload "+path+" "+destination call ([photofile], shell=True)
It isn't very difficult, and this is the best way to really see the days getting longer and shorter, and connecting that to the Earth's tilt as it goes around the sun.
You must be logged in to post a comment.