Monday 19 August 2024

AllSky: taking pictures of the night sky

I'd heard that a meteor shower was on its way

so I rushed around and built a camera system.

The annual Perseids was due to peak around the middle of August, so I only had a couple of weeks to order a Pi camera and start to put together a system.


I found the AllSky system on Github and loaded it to a relatively new RaspberryPi 4 which I had been using as a mobile BirdNet-Pi. I now use whoBird on my phone, so happy to repurpose and marry-up with an old Pi camera V1.

Fortunately it didn't take very long for my new Pi camera Module 3 to arrive from ThePiHut, as the old V1 is not a good choice.

Allsky is a system designed to take pictures of the sky at intervals set by the user, originally to observe astronomical 'events' such as meteor showers.

It can run on a Pi with sufficient resources and a connected camera. If has a web interface which you connect to via your local network. The initial (Live View) screen looks like this...

Live View

...from which you can fully configure the system.

There are separate day-time and night-time settings to allow for appropriate exposure and gain setting (in Allsky, exposure equates to exposure time, while gain is rather like the ISO control on a regular camera). You can also set the system to only capture images during the day or night.

I set the system to take 2 images per minute over-night. At the end of the session a star-trails image and a time-lapse video are automatically generated.

I was thrilled by the initial results...


This star-trails image clearly shows 2 meteors, one very bright.

Other points to mention:-

  • due to the earths rotation, all stars and planets draw an arc across the sky, except for Polaris (the pole star) which is just out of view in this shot
  • the dotted red/white lines are created by aircraft, most of which are coming in over the south coast and flying north towards Heathrow and Gatwick
  • faint continuous lines are also man-made (e.g. either satellites or high altitude aircraft)
  • short lines are meteors, which often 'flare'
  • isolated red or blue dots are just hot-pixels

The red 'ghost' was due to light from the Pi red l.e.d. getting into the camera via a glass plate laid over my camera 'enclosure'. I say 'enclosure' because I was using an ice-cream tub with a small sheet of glass, robbed from a family photo frame...


This was initially fixed by disabling the Pi l.e.d.s by adding 4 new lines in: /boot/firmware/config.txt

#Put that light Out!!!
dtparam=pwr_led_trigger=default-on
dtparam=pwr_led_activelow=off
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off


I then robbed an ABS box, previously used for my old Pi server, and this became the second prototype...

 

When deployed outside, the system runs from a 10A power bank hanging under the tripod, which is fine at the moment while the nights are relatively short (& dry!).

Allsky has a text overlay module which is configurable via an editor. I initially selected a few basic parameters...
a nice meteor (the Milky Way is in the centre, but lost completely after uploading this image!)

But now that the system is configured to my liking, I've modified the code to simply add Exposure and Gain to the image EXIF data.

Although the system runs with C++ and Python code, its basically held together via a series of Bash scripts. So my modifications to saveImage.sh look like this:-


`# Get passed-in variables.

while [[ $# -gt 0 ]]; do
VARIABLE="AS_${1%=}" # everything before the "="
VALUE="${1##
=}" # everything after the "="
shift
# Export the variable so other scripts we call can use it.
# shellcheck disable=SC2086

#steve mod+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if [[ ${VARIABLE} = "AS_sEXPOSURE" ]]; then
	SD_EXPOSURE=${VALUE% ms*}	#we just need value in ms
	SD_EXPOSURE=$(echo "scale=3; ${SD_EXPOSURE}/1000" | bc -l)	#convert to seconds
fi
if [[ ${VARIABLE} = "AS_GAIN" ]]; then
	SD_GAIN=$(echo "${VALUE}" | bc -l | xargs printf %.0f)	#round the gain value
fi	
#end------------------------------------------------------------

export ${VARIABLE}="${VALUE}"	# need "export" to get indirection to work

done
`

...and this bit:-

if [[ ${IMG_CREATE_THUMBNAILS} == "true" ]]; then
THUMBNAILS_DIR="${DATE_DIR}/thumbnails"
mkdir -p "${THUMBNAILS_DIR}"
# Create a thumbnail of the image for faster load in the WebUI.
# If we resized above, this will be a resize of a resize,
# but for thumbnails that should be ok.
convert "${CURRENT_IMAGE}" -resize "${THUMBNAIL_SIZE_X}x${THUMBNAIL_SIZE_Y}" "${THUMBNAILS_DIR}/${IMAGE_NAME}"
if [ $? -ne 0 ] ; then
echo -e "${YELLOW}*** ${ME}: WARNING: THUMBNAIL resize failed; continuing.${NC}"
fi
fi
#steve mod++++++++++++++++++++++++++++++++++++++++++++++
#add meta data to image
exiftool -copyright="stevedee" -software="AllSky" -CameraLabel="${CAMERA_TYPE} ${CAMERA_MODEL}" -ExposureTime="${SD_EXPOSURE}" -ISOspeed="${SD_GAIN}" "${CURRENT_IMAGE}"
# The web server can't handle symbolic links so we need to make a copy of the file for
# it to use.
FINAL_FILE="${DATE_DIR}/${IMAGE_NAME}"
if cp "${CURRENT_IMAGE}" "${FINAL_FILE}" ; then
rm -f "${CURRENT_IMAGE}_original" #remove exiftool generated file copy
#end----------------------------------------------------


And my EXIF data looks like this:-


As it is easier to use existing EXIF tags (rather than create new ones) I'm using ISO Speed to show Gain, although these have different meanings.

It would naturally be nice to have night-time images covering the whole night. I did some tests with my Module 3 camera and found that it takes a few hundred milliseconds to transfer the image data when it has completed an image capture.

Consequently I've set the system for 29 second exposure times, with a 1 second delay, which is more than enough time for the camera to transfer data to the Pi. This also means that I get approximately 2 images per minute.

I've set the Gain mode to auto. So the actual gain for each image falls somewhere within the camera's range of 1-16. I now need to experiment with the system's contrast setting, as I tend to manually edit contrast in GIMP for any images I'm particularly interested in. Currently the system produces images that are a bit light and lacking in contrast.

I also need to investigate why star-trails appear to be 'broken' (i.e.not complete arcs). ...the fun continues!

There was a slight chance of high geomagnetic a few days ago and therefore the possibility of seeing aurora borealis down here on the south coast. So I tipped the system towards the northern horizon...

 


...but any light in this image is probably what the late, great Sir Patrick Moore used to call aurora Bognor Regis (...as he used to live just 4 miles from where we now live!).

Obviously this is a fair-weather camera system. My module 3 camera is the wide-angle version. Its far short of a 180' system, but I have quite a restricted view of the night sky, so turned out to be a good choice.

I have no plans to make a roof-mounted, permanent AllSky system!


No comments:

Post a Comment