Sonntag, 15. März 2015
Mittwoch, 21. Januar 2015
#Raspberry Pi Timelapse project
Someone gave me a "Magic Garden" as a present this Christmas! So I headed to my local dealer to get me a Pi Cam to play around with it as I now really really had a valuable yet scientific job to do!
Here's the result:
And this is what I've done:
I cut a little slot into the pi case for the flat cable. Then I found some parts of a lamp and a lighter and a film canister - screwed and glued it together to have a solid and flexible stand for it. While writing these lines I am thinking abount some buttons to start my scripts and shutdown the device ...
Using the above mentioned tutorials I came out with two little python scripts:
(note to myself: needs some errorhandling if the dropbox upload fails)
-----------------tinkerCam.py-----------------
#! /usr/bin/env python
# taking a picture and uploading it to dropbox
# uses Andrea Fabrizis Dropbox Upload www.andreafabrizi.it
from subprocess import call
import time
import datetime
import picamera
pictureDir = '/home/pi/tinkerCam/pictures/'
ts = time.time()
fileNameShort = 'tinkerPic_' + datetime.datetime.fromtimestamp(ts).strftime('%d-%m-%y_%H-%M-%S') + '.jpg'
uploader = '/home/pi/Dropbox-Uploader/dropbox_uploader.sh'
upconfig = '/home/pi/Dropbox-Uploader/.dropbox_uploader'
camera = picamera.PiCamera()
fileName = pictureDir + fileNameShort
camera.capture(fileName)
cmd = uploader + ' -f ' + upconfig + ' upload ' + fileName + ' /tinkerCam/' + fileNameShort
call([cmd], shell = True)
#copy file to usbStick
stickDir = '/media/stick/tinkerCam/'
cmd = 'mv ' + fileName + ' ' + stickDir+fileNameShort
print cmd
#call([cmd], shell = True)
#clean up
cmd='rm ' + fileName
call([cmd], shell = True)
print 'finished'
Here's the result:
And this is what I've done:
I cut a little slot into the pi case for the flat cable. Then I found some parts of a lamp and a lighter and a film canister - screwed and glued it together to have a solid and flexible stand for it. While writing these lines I am thinking abount some buttons to start my scripts and shutdown the device ...
Next thing was to follow this tutorial to get that thing working: python-picamera-setup
As the pi runs headless through its life, I wanted it to either copy the pictures to a dropbox folder or to a usb stick plugged into the pi.
For the dropbox part I followed raspi.tv here: how-to-use-dropbox-with-raspberry-pi
Some googling helped me to find out how to mount a usb stick to my pi how-to-mount-a-usb-flash-disk-on-the-raspberry-pi Most important was to change the fstab: adding the sticks uuid and so on:
(note to myself: needs some errorhandling if the dropbox upload fails)
-----------------tinkerCam.py-----------------
#! /usr/bin/env python
# taking a picture and uploading it to dropbox
# uses Andrea Fabrizis Dropbox Upload www.andreafabrizi.it
from subprocess import call
import time
import datetime
import picamera
pictureDir = '/home/pi/tinkerCam/pictures/'
ts = time.time()
fileNameShort = 'tinkerPic_' + datetime.datetime.fromtimestamp(ts).strftime('%d-%m-%y_%H-%M-%S') + '.jpg'
uploader = '/home/pi/Dropbox-Uploader/dropbox_uploader.sh'
upconfig = '/home/pi/Dropbox-Uploader/.dropbox_uploader'
camera = picamera.PiCamera()
fileName = pictureDir + fileNameShort
camera.capture(fileName)
cmd = uploader + ' -f ' + upconfig + ' upload ' + fileName + ' /tinkerCam/' + fileNameShort
call([cmd], shell = True)
#copy file to usbStick
stickDir = '/media/stick/tinkerCam/'
cmd = 'mv ' + fileName + ' ' + stickDir+fileNameShort
print cmd
#call([cmd], shell = True)
#clean up
cmd='rm ' + fileName
call([cmd], shell = True)
print 'finished'
-----------------tinkerTimelapse.py-----------------
#! /usr/bin/env python
from subprocess import call
import time
import datetime
import picamera
uploader = '/home/pi/Dropbox-Uploader/dropbox_uploader.sh'
upconfig = '/home/pi/Dropbox-Uploader/.dropbox_uploader'
usbPath = '/media/stick/tinkerTimelapse/'
dropboxPath = '/tinkerCamTimelapse/'
tempPath = '/home/pi/tinkerCam/'
def toDropbox(fileNameShort):
cmd = uploader + ' -f ' + upconfig + ' upload ' + tempPath + fileNameShort + ' ' + dropboxPath + fileNameShort
call([cmd], shell = True)
#clean up
cmd = 'rm ' + tempPath + fileNameShort
call([cmd], shell = True)
def capturePic(frame, fileNameShort):
with picamera.PiCamera() as cam:
time.sleep(2)
picPath = tempPath + fileNameShort
print 'capturePic:', picPath
cam.capture(picPath)
def constructFileName():
ts = time.time()
fileNameShort = 'tinkerPic_' + datetime.datetime.fromtimestamp(ts).strftime('%d-%m-%y_%H-%M-%S') + '.jpg'
return fileNameShort
#user interface
picDays = raw_input('How many days will be captured?: ')
framesPerHour = raw_input('How many pictures per hour?: ')
frames = int(framesPerHour) * 24 * int(picDays)
saveTo = raw_input('Save to? [dropbox, usb]: ')
#capture images
for frame in range(frames):
start = time.time()
fileNameShort = constructFileName()
fileName = tempPath + fileNameShort
capturePic(frame, fileNameShort)
if saveTo == 'dropbox' or saveTo == 'd':
toDropbox(fileNameShort)
if saveTo == 'usb' or saveTo == 'u':
cmd = 'mv ' + tempPath + fileNameShort + ' ' + usbPath + fileNameShort
call([cmd], shell = True)
print 'Picture taken: ', frame
time.sleep(int(60 * 60 / int(framesPerHour)) - (time.time() - start))
print 'finished'
Samstag, 13. Dezember 2014
Concert: Turbostaat
Dear reader, what should I say...
6 month after giving a concert in Wiesbaden Turbostaat are back in Frankfurt with their double concert today and tomorrow.
So it was Turbostaat that made my day ... :P
6 month after giving a concert in Wiesbaden Turbostaat are back in Frankfurt with their double concert today and tomorrow.
So it was Turbostaat that made my day ... :P
Sonntag, 7. Dezember 2014
Also my favorite bridge here
Found this video at www.stadtkindfrankfurt.de, one of my favourite sources for all things Frankfurt. Next time I'll consider climbing that bridge instead of walking up the stairs ...
Freitag, 5. Dezember 2014
Concert: PS I Love You supported by The Rural Alberta Advantage
I didn't know The Rural Alberta Advantage at all until I realized that they were supported by PS I Love You on their tour. And as I wanted to go to PS I Love You anyways I gave them a chance and Paul Banwatt really did his job as drummer of that band, taking the audience with them.
Speaking of Pauls here: Paul Saulnier and Benjamin Nelson are PS I Love You and for me they were supported by The RAA. Saulnier's guitar and voice together with Nelsons drums...!
Mittwoch, 3. Dezember 2014
Concert: Jaga Jazzist
Three years ago I've been at a concert of Jaga Jazzist with one girl I met at the couch surfing meeting. I loved the sound, bought the CD, took the music with me on my trip to Prague. It became part of a change in my live... So it was no question to go to the concert at Hafen2 last night. Lot's of old songs, some new ones... Nice light things on the stage (I wondered if these used arduinos to control the LEDs)
Abonnieren
Posts (Atom)