1

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?

2
  • Interesting, it seems this question is related to raspberrypi.stackexchange.com/questions/139209/… You may want to mention it in your question.
    – Vadim
    Commented Sep 22, 2022 at 11:21
  • which PiCam hardware version are you using? V1 or V2? Can you please update your question?
    – Vadim
    Commented Sep 22, 2022 at 11:38

1 Answer 1

1

For the issues you are facing:

  1. According to the picamera module reference, the valid frame rate for the mode you are using is 1/6 <= fps <= 1 for PiCam v1 and 1/10 <= fps <= 15 for PiCam v2. So 1/20 should not work for either.
  2. According to the same reference document:

In later firmwares, this attribute is limited by the value of the framerate attribute. For example, if framerate is set to 30fps, the shutter speed cannot be slower than 33,333µs (1/fps).

Together with the first item it sounds to me like you won't be able to achieve 30s exposure in one shot. This also makes sense as the CMOS sensors differ fundamentally from CCD in their architecture.

2
  • I am using a HQ camera, which has a max exposure time if 200 seconds. So I don't see why it can't achieve a 30 sec exposure
    – Jake
    Commented Sep 23, 2022 at 0:27
  • @Jake, I'm not familiar with the HQ camera, can you please update your question posting a link
    – Vadim
    Commented Sep 23, 2022 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.