Gert V.
Posts: 3
Joined: Wed Jun 01, 2016 9:09 am

timelapse question

Wed Jun 01, 2016 9:26 am

Hello,

As an absolute beginner I today started my first project: a timelapse-camera. I used the following instructions:

https://www.raspberrypi.org/learning/timelapse-setup/

So far it's working like a charm, but I was wondering if and how I could adjust the frequency the pictures are taken. In the followed instructions it's every minute. I would like it to be something like every 10 seconds.
I tried altering the numbers in the line * * * * * /home/pi/camera.sh 2>&1, but so far to no avail. It either would stop taking pictures or continue taking one a minute.

Best regards,
Gert

SkyRise
Posts: 179
Joined: Tue Jan 24, 2012 1:20 pm

Re: timelapse question

Wed Jun 01, 2016 10:27 am

Cron doesn't support a time resolution below a minute.

# * * * * * command to execute
# ┬ ┬ ┬ ┬ ┬
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └───── day of week (0 - 7) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
# │ │ │ └────────── month (1 - 12)
# │ │ └─────────────── day of month (1 - 31)
# │ └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)

You will have to write your own script with perhaps a sleep(10) and run that instead...

occupied
Posts: 42
Joined: Mon Apr 25, 2016 3:50 pm

Re: timelapse question

Wed Jun 01, 2016 10:48 am

raspistill has an inbuilt timelapse ability.
  • Set how long (in milliseconds) you want to it run for with -t
  • Set how long (in milliseconds) you want to wait between photos with -tl

Code: Select all

raspistill -o a%03d.jpg -t 3600000 -tl 10000
This will take a picture every 10 seconds (-tl 10000) for an hour (-t 3600000).

The photos will be numbered:
  • a001.jpg
  • a002.jpg
  • a003.jpg
  • And so forth
You can do away with crontab altogether if you want.

HTH :)

Gert V.
Posts: 3
Joined: Wed Jun 01, 2016 9:09 am

Re: timelapse question

Wed Jun 01, 2016 1:52 pm

Thanks for your answers so far. I will try some more tonight.

Gert V.
Posts: 3
Joined: Wed Jun 01, 2016 9:09 am

Re: timelapse question

Thu Jun 02, 2016 5:19 am

Here's my progress so far:

In order to make pictures at a smaller interval I made another script that I named every-5-seconds.sh:

#!/bin/bash
while true
do
/home/pi/camera.sh
sleep 5
done

Made the script executable and ran it. I saw the pictures appearing on the screen at a much quicker rate, so far so good.
But in /home/pi/camera the pictures didn't all appear. I presume because of the timestamp containing year,month,day, hour and minute, but not seconds, therefore overwriting previous images taken in the same minute?
I tried adding the seconds in de timestamp making the imagename as described in the script camera.sh (DATE=$(date +"%Y-%m-%d_%H%M%S") but that didn't work.

As time flies when your having fun tinkering I had no time left to try anymore last night, so I'll go on tomorrow.

In the end I think I'm looking for a timelapse-camera powered by a powerbank, starting making images at power on for approximately 12 hours, taking multiple images a minute.

Best regards, Gert

Slackware
Posts: 131
Joined: Mon Jan 18, 2016 3:45 pm

Re: timelapse question

Thu Jun 16, 2016 11:42 pm

You could add a counter add add a -Cnt to filename after minute. reset when minutes tick up. with 5 sec intervals you would get 0-11 file names.

User avatar
bensimmo
Posts: 4622
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: timelapse question

Fri Jun 17, 2016 8:13 pm

Am I reading something different, that's the python programming link given ?

In section 5 adding a delay, just change
sleep(60) to sleep(10)

:?:


anyways, a more in depth info for python picamera w.r.t. timelapse here http://picamera.readthedocs.io/en/relea ... -sequences


EDIT to add a hint for launching at boot.
In the SenseHAT datalogger in section 3 they show a nice way to launch programs in the background(ish) that is not effected by logging on or off via ssh or other users.
To stop it if you forget to edit it out and you don't want it to be shooting, use killall python3 on the command line

Return to “Beginners”