Jump to content

sgl_imaging_challenge_2021_annual.thumb.jpg.3fc34f695a81b16210333189a3162ac7.jpg

Raspberry Pi AllSky Camera


Recommended Posts

Just now, discardedastro said:

Oh, that's neat. I've got some aluminium tape which I'm using to wrap my enclosure (aside from the home) to help reject solar load - it'll also completely reject UV. Could layer that and/or black flocking over the PLA and it'd be fine for extended use I'm sure.

That’s a good shout - I have some very thick black felt and aluminium tape that may work. 
 

Although is the issue more heat rather than direct sunlight, as looking at this thread the internals can get pretty toasty! 

Link to post
Share on other sites
  • Replies 240
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

It's been done several times before and this is my try at making one.  I built Thomas Jacquin's excellent project a couple of years ago and it worked very well.  However I found that the temperature i

Dome camera arrived today, guts removed and adaptor printed based on the coke bottle camera, probably needs revisiting to give the Pi a bit more room under plus it's in white at the moment, so suspect

Quite.  When I write  C or C++ (for oacapture for example), I use a fairly aggressive set of compiler warning flags and have compilation fail on all warnings.  It makes more work, but catches potentia

Posted Images

1 hour ago, wormix said:

That’s a good shout - I have some very thick black felt and aluminium tape that may work. 
 

Although is the issue more heat rather than direct sunlight, as looking at this thread the internals can get pretty toasty! 

And on that note, I've literally just finished making v2, which has some active cooling. Metal fan grilles - this is mostly to keep small crawling things out but might help with dust somewhat, I might add some polypropelene dust filter material to the input port but we'll see how it goes.

signal-2020-08-16-173643_001.thumb.jpeg.c4a0a08e1968f8c58bfa4941ffd7b709.jpeg

The port on the left is the inlet - I wanted to use the rubber mounting supplied with the Noctua fan to minimise vibrations (though in practice they're not really significant enough to worry about much) and so the metal filter is on the inside; on the right it's on the outside to make life easier for screw mounting.

I rejigged the internals somewhat - added some 3M adhesive foam blocks to hold the electronics in place. The Wago blocks could do with a better mounting scheme but it's good enough for now - it isn't exactly moving around much but this keeps most things out of sitting in any water.

The fan driver I'm using is a dumb-as-chocolate little board from Amazon with a thermistor which is sort of hanging out in the middle of the box. This PWM modulates the little Noctua A4x20 fan which can deliver quite a lot of air at full pelt while being quite quiet.

signal-2020-08-16-173643_003.thumb.jpeg.d20160553843ec9464aea7bca7b98181.jpeg

I've covered the top in alu foil - I wanted to check this was all going to work OK before I dismantle the dome again to paint the surface under the dome black. I actually cracked the dome at the edge when assembling it, so might seek to get another dome of the same design (or two, for spares) before I take it off and muck about re-siliconing.

signal-2020-08-16-173643_002.thumb.jpeg.d7b3875a33cb445b252c02264451172f.jpeg

 

  • Like 2
Link to post
Share on other sites

I've had an oddity occur with a Pi Noir webcam (this one) I got it last week and it's all been working fine, then a couple of nights ago it developed a white bloom across the image at night. It survived tinkering with the capture setting, numerous reboots, several power downs, and cable checks. And a case redesign to make sure it wasn't stray light from the Pi Zero inside. It has even made it onto the videos. Then in right clicking and viewing the image prior to posting here, it 'fixed' itself.

Can't see a reason for it in the code either

image.png.9f6b3785746ed6c0e2b439fac7176fee.png

 

image.png.0e6cb0c7283f1b190e38a41aa8d46ab7.png

Link to post
Share on other sites

The mystery white bloom reappeared again tonight. Wondering if it's from auto ISO and exposure time in darker conditions, so I've changed the night and day arguments to a fixed ISO value.

Daytime="-ISO 100 -awb  greyworld -n -w 820 -h 616 -ex auto -o /run/shm/$SCR.jpg"
Nighttime="-ISO 3200 -co 70 -awb greyworld -n -w 820 -h 616 -ex night -ag 9.0 -dg 2.0  -ss 6000000  -o /run/shm/$SCR.jpg"

It's back to behaving how it should with only a little glow on that edge again

webcam_20200824_230028.jpg.ab7fc282ef5a0ad5155cdbe15fd12097.jpg

Edited by Mognet
Link to post
Share on other sites
  • 3 weeks later...
  • 1 month later...

The mystery white bloom has suddenly returned again, so I'm going to order another Pi Noir camera to see if that's the problem. I've ruled pretty much everything else out except that and the Pi Zero I'm using

Link to post
Share on other sites
11 hours ago, Mognet said:

The mystery white bloom has suddenly returned again, so I'm going to order another Pi Noir camera to see if that's the problem. I've ruled pretty much everything else out except that and the Pi Zero I'm using

If you're up for a little experimentation I can send you the python code I use to handle my v2 camera on a pi-zero.
This is an example of the sort of image it produces.
long2_0364_02Nov2020_203126.thumb.png.6167661cd515e0389fd663381f43bd14.png

It doesn't look great here, but the uncompressed image gets down to about Mag 6.
The bloom at the top left is due to the Moon (north is to the top). Though I am not too happy about all the other edges.

 

Link to post
Share on other sites
5 hours ago, pete_l said:

If you're up for a little experimentation I can send you the python code I use to handle my v2 camera on a pi-zero.

Thanks. That could be useful as I was looking at writing my own ASC software as I need the programming practice. Just read up on the basics of PHP for the front end and was about to start looking at Python for the back end

Link to post
Share on other sites
36 minutes ago, Mognet said:

Thanks. That could be useful as I was looking at writing my own ASC software as I need the programming practice. Just read up on the basics of PHP for the front end and was about to start looking at Python for the back end

#!/usr/bin/python3

from __future__ import print_function

import sys
import picamera
from picamera import mmal, mmalobj, exc
from picamera.mmalobj import to_rational
import time
from fractions import Fraction
import datetime as dt


MMAL_PARAMETER_ANALOG_GAIN = mmal.MMAL_PARAMETER_GROUP_CAMERA + 0x59
MMAL_PARAMETER_DIGITAL_GAIN = mmal.MMAL_PARAMETER_GROUP_CAMERA + 0x5A

def set_gain(camera, gain, value):
    """Set the analog gain of a PiCamera.
    
    camera: the picamera.PiCamera() instance you are configuring
    gain: either MMAL_PARAMETER_ANALOG_GAIN or MMAL_PARAMETER_DIGITAL_GAIN
    value: a numeric value that can be converted to a rational number.
    """
    if gain not in [MMAL_PARAMETER_ANALOG_GAIN, MMAL_PARAMETER_DIGITAL_GAIN]:
        raise ValueError("The gain parameter was not valid")
    ret = mmal.mmal_port_parameter_set_rational(cam._camera.control._port, 
                                                    gain,
                                                    to_rational(value))
    if ret == 4:
        raise exc.PiCameraMMALError(ret, "Are you running the latest version of the userland libraries? Gain setting was introduced in late 2017.")
    elif ret != 0:
        raise exc.PiCameraMMALError(ret)

def set_analog_gain(camera, value):
    """Set the gain of a PiCamera object to a given value."""
    set_gain(camera, MMAL_PARAMETER_ANALOG_GAIN, value)

def set_digital_gain(camera, value):
    """Set the digital gain of a PiCamera object to a given value."""
    set_gain(camera, MMAL_PARAMETER_DIGITAL_GAIN, value)

####################### settable values here #######################################

started = dt.datetime.now() # current date and time
date_time = started.strftime("%d%b%Y_%H%M%S")
print("Started at:",date_time)

endtime = dt.time( 7,0,0 )   # end imaging at 7 a.m.
lasttime = dt.datetime.now().time()

# gains settings of (12,4) produce an ISO of 2500 in the exif data
# analog gain, values over 12.0 get set to 12
a_gain = 12

# digital gain, use values of 4 or less, 2 is best for me
d_gain = 2

exposure_us = 10100000    # just over 10 seconds (max)

def fnames():
  global lasttime

  frame_num = 0
  while True:
    ts = dt.datetime.now()
    timestamp = "%04d_%s" % (frame_num,ts.strftime("%d%b%Y_%H%M%S"))
# t  = '%s_%04d' % (timestamp, count)

    thistime = dt.datetime.now().time()

    if lasttime < endtime and thistime >= endtime:
      print("Ending at {} after {} images".format(ts.strftime("%d-%b-%Y %H:%M:%S"), frame_num))
      break

    lasttime = thistime
    yield "long2_%s.png" % timestamp
    frame_num += 1

####### main code starts here ##################

if __name__ == "__main__":
#    with picamera.PiCamera(sensor_mode=4, resolution=(1640,1232),framerate = Fraction(1,10)) as cam:
    with picamera.PiCamera(sensor_mode=3, resolution=(2592,1952),framerate = Fraction(1,11)) as cam:

        cam.color_effects = (128,128)   # monochrome / greyscale

        cam.exposure_mode = 'night'
        cam.drc_strength = 'low'

        cam.shutter_speed = exposure_us

        set_analog_gain(cam, a_gain)
        set_digital_gain(cam, d_gain)      # it is said that values > 4 saturate the image (?)

# use stdout here to get output immediately
        sys.stdout.write("Waiting for gain to be set (Ctrl-C to stop) ")
        sys.stdout.flush()

        try:
            while cam.digital_gain < d_gain:
                sys.stdout.write(".")
                sys.stdout.flush()
                time.sleep(2)
        except KeyboardInterrupt:
            print("Stopping...")

# fix the auto white balance gains at their current values
        g = cam.awb_gains
        cam.awb_mode = "off"
        cam.awb_gains = g
        print("\nAWB gain: ", g)

# fix the analog and digital gains so they won't change during the shots
        cam.exposure_mode = 'off'

        print("Set a/d gains: {}, {}".format(cam.analog_gain, cam.digital_gain))
        print("Starting sequence until ...".format(endtime))
        s1 = time.time()

# without burst = True, 30 frames takes 661 seconds, with it 318s

        cam.capture_sequence(fnames(), use_video_port=False, burst=True, format='png')
#        cam.capture_sequence(fnames(), use_video_port=False, burst=True)
        s2 = time.time()
        print("Finished in  {:.3f}s".format(s2-s1))
        exit

long_shot.py

Run from the terminal as ./long_shot.py This takes back-to-back 10s exposures with almost no gap in between. The exposures are lossless and about 5.2MB each.

Cancel either with Ctrl-C or it ends automatically at 7:00 a.m.

The first image takes up to a minute due to some silliness inside the Pi camera (I'm sure my phone doesn't wait a minute before taking a photo and the IMX219 is a phone camera ;( )
I have tried using the full resolution of the v2 camera (3280x2464) but the software falls over with an out of memory error. Although the raspistill software manages it with ease. This seems to me to be a crock in the picamera module.

Almost none of this is my original work. I am no expert in Python so will not be able to answer any difficult questions.

Edited by pete_l
  • Like 1
Link to post
Share on other sites

Replacement camera has been in for a couple of days now and there hasn't been any return of the mystery white bloom, so it looks like it was a dodgy camera module

Now to learn some Python so I can work on my own version. And to source a dome so I can mount it outside instead of pointing it through the conservatory double glazing

 

webcam_20201106_013823.jpg

  • Like 2
Link to post
Share on other sites
  • 1 month later...

Well after a while I forgot about my all-sky camera and the SD card was full... so I took it inside to resuscitate is and it never made it back out until just now!  I had taken a backup of home, etc and www but I had to piece together what I had done in the meantime to get it running... I suppose I should really document it but it helped being able to scroll through this thread as an aide memoire !

I need to sort out some internal heating for dew control and also a 12V feed then looking at the FoV now, I think it should be ready to move on to a pole at the end of the garden away from the house....  I'll need to design and print a bracket for that but that's not too hard a task to do I think (though I have seen some designs for pole mounted 3d printed enclosures which might cut down on the weight a bit) 

 

image.png.aa9afc3528b0bf8ec141eabff228ac4d.png

 

  • Like 1
Link to post
Share on other sites

I had to refresh the card in mine after it stopped talking to the network for no apparent reason, and since then I've made the capture code a bit more robust. I wasn't certain that it was adding every frame to the video before, but I'm pretty certain of it now. And I think I've cured the problem where it would create videos of several days or nights run together. It can now safely capture every minute in daytime and two minutes at night on a Pi Zero without getting tangled

Next job is to update the web interface so that every frame can be viewed, and several days (or more) history can be stored. The pages will also benefit from some common PHP and CSS code, which I think is tonight's job

  • Like 1
Link to post
Share on other sites
2 minutes ago, Mognet said:

I had to refresh the card in mine after it stopped talking to the network for no apparent reason, and since then I've made the capture code a bit more robust. I wasn't certain that it was adding every frame to the video before, but I'm pretty certain of it now. And I think I've cured the problem where it would create videos of several days or nights run together. It can now safely capture every minute in daytime and two minutes at night on a Pi Zero without getting tangled

Next job is to update the web interface so that every frame can be viewed, and several days (or more) history can be stored. The pages will also benefit from some common PHP and CSS code, which I think is tonight's job

Looking forward to seeing that in action.  I can't remember where I got up to in tinkering but from the video in the back up I used looks like mine last worked 4th Oct before I took it down.

 

Link to post
Share on other sites
36 minutes ago, jiberjaber said:

Looking forward to seeing that in action

Thanks. I'll publish it once I'm happy with it. The plan is to include an auto deploy script so it can be a single command install too, along with all the other improvements

Link to post
Share on other sites
3 minutes ago, Mognet said:

Thanks. I'll publish it once I'm happy with it. The plan is to include an auto deploy script so it can be a single command install too, along with all the other improvements

That will certainly make life easier!

Edited by jiberjaber
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.