I am trying to take a long exposure image (30 sec+) in python using a RPi HQ camera (https://raspberry.piaustralia.com.au/products/raspberry-pi-hq-camera and the PiCamera module).
This is my code:
import datetime
from picamera import PiCamera
from time import sleep
from fractions import Fraction
tlminutes = 0.5 #set this to the number of minutes you wish to run your timelapse camera
secondsinterval = 5 #number of seconds delay between each photo taken
exposure = 20 ## this is the exposure of each image, in Seconds, between 0 and 200s
ISO = 100 ## set the ISO to between 100 and 800
numphotos = int((tlminutes*60)/secondsinterval) #number of photos to take
actualexposure = exposure * 1000000
camera = PiCamera(
resolution=(1280,1280),
framerate=Fraction(1,6),
sensor_mode=3)
camera.shutter_speed = int(actualexposure)
camera.iso = ISO
sleep(60)
camera.exposure_mode = 'off'
sleep(5)
n=1
for i in range(numphotos):
t = datetime.now()
ti = t.strftime("%H:%M:%S")
camera.capture(location + '/' + str(number) + '/image' + ' ' + str(n) + ' ' + str(ti) + '.png'.format(i))
n += 1
sleep(secondsinterval*60)
I can control the shutter speed of the camera up until around 5 seconds. If I set the shutter speed to anything more than 5 seconds, the camera defaults back to a 5 second exposure. For example, if the exposure is set to 60 s, it would only take an image for 5 seconds.
I suspect the error might be coming from the framerate, which is currently set at 1/6 fps, but if I decrease this value, e.g. to a 1/20 fps to allow for a longer exposure, I get a camera time out error.
Does anyone know the source of these issues? Or any other way that I can take a 30+ sec exposure image via the RPi HQ camera in python?