Pi HD Camera Sky Brightness Project

Anything that doesn't fit into any of the other forums
Post Reply
nexusjeep
Posts: 382
Joined: Thu Oct 18, 2018 3:01 pm
Location: Gloucestershire

Pi HD Camera Sky Brightness Project

#1

Post by nexusjeep »

So playing around with a pi5 and pi HD camera not as an allsky camera but as a metering device so what I am doing is taking a 10s 400 iso shot of the sky with a 180 Lense and then masking the sky area to discount the houses / trees and also dynamically masking the moon as well to remove it from the calculation and then calculating the average pixel brightness in the shot which is then graphed to show the sky quality.

The large red circle if the area that is being averaged with the darker line around the moon being what is masked out of that average, the mask is dynamic for the moon so will look for it and mask 15 pixels clear so will track its shape form round to crescent. The graph will run for the duration of time that the camera is deemed to be night so currently set to sunset + 1hr to sunrise - 1hr the graph is accessible until the next evening at which point it is rewritten.

This is just a project to tax the brain cells a bit and to see how well it actually functions, basically as the sky gets better the value gets lower. Still need a really good clear night to ascertain reference points as well nights with moon and without moon to see how things stack up. So far in testing it looks like once it starts dropping to 0.04 and below the sky is relatively clear and perfectly clear looks to be around 0.033 but will update this thread as things progress in case anyone is interested.
SKy_Moon_Mask.png
SKy_Moon_Mask.png (646.37 KiB) Viewed 194 times
Cheers
Nick
User avatar
admin
Site Admin
Posts: 17397
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Pi HD Camera Sky Brightness Project

#2

Post by admin »

Hi Nick,

an interesting project, particularly as I have just recently added a tool to measure sky brightness in SharpCap. I don't think that tool will work with the PI camera (even if you could get it talking to SharpCap), as it requires a high bit depth mode and sensor analysis data (along with the f-ratio of your optics). It should be fairly accurate except that the QE factor of the sensor has to be estimated, but still should give you a value within 0.2 magnitudes I expect (0.2 magnitudes corresponds to a 20% uncertainty in QE).

You could use the SharpCap tool (in 4.2 beta) with any astro camera that you have to try to calibrate your other data without needing a hardware SQM device.

cheers,

Robin
nexusjeep
Posts: 382
Joined: Thu Oct 18, 2018 3:01 pm
Location: Gloucestershire

Re: Pi HD Camera Sky Brightness Project

#3

Post by nexusjeep »

Hi Robin,
Will give it a look longer term but still fleshing out things at the moment, now have the pi pulling the meteo API data for the cloud base speed and direction plus calculation of the seeing based on the different atmospheric layers on a 15min cycle in the day.

The plan for tonight is to split the large sky circle into 16 quadrants and 8 concentric rings sized to take account of the compression of the fisheye as it nears the horizon, each of the created matrix squares will be analysed for brightness to look for clouds so at night I can mathematically calculate how fast the clouds are coming through and in what direction they are traveling and if I set the target location being imaged should be able to calculate whether they miss it entirely or if not how long I have until they obscure the target. There will be a fallback if there is heavy cloud as the difference between the matrix squares will be minimal at which point it drops back to data from the meteo api, as well as for a completely clear sky it will do the same.

The middle chart is empty in the image as I had to reboot the Pi to unlock the SDCard as the whole system runs as a read only overlay so never writes to the SD card and does everything in RAM. The middle chart optimistically will populate tonight if not there will be swearing :D .
daytime_meteo.png
daytime_meteo.png (851.5 KiB) Viewed 174 times
Cheers
Nick
nexusjeep
Posts: 382
Joined: Thu Oct 18, 2018 3:01 pm
Location: Gloucestershire

Re: Pi HD Camera Sky Brightness Project

#4

Post by nexusjeep »

So had a bit more of a play and adjusted the pristine sky value as there is no moon at present so a clear sky generates a value just above 0.01. I have also rewritten the moon mask to be slightly larger as I have updated the exposure to 15s at 400 iso on the pi hq camera. Also added a direction arrow for the wind obtained from the Meteo API.

Now that I know what a clear sky value is I am going to build some math in to counter the effect of the moon glow hence the mask rewrite but need a night with a quarter moon, half moon, three quarter and full to ascertain the pixel area of the mask and the value that I get on a clear sky to then formulate a scalable deduction to give me a consistent sky value under those conditions. Which may be a challenge in the UK as it's hard enough getting a clear night let alone matching it to other conditions :)

Having done a plate solve on the sky the camera is about 7 degrees out to havng true north at the top so will also adjust for that on the wind arrow. I also plan on inverting the graph for the sky value so clear is at the top and making it logarithmic to give a lot more resolution to the trend line when it is in the clear sky window and compress progressively as it goes into cloud.
Wind_Direction.png
Wind_Direction.png (708.05 KiB) Viewed 50 times
you can't tell in the small image above but the camera is picking up quite a few stars
stars.png
stars.png (61.01 KiB) Viewed 50 times
Cheers
Nick
User avatar
admin
Site Admin
Posts: 17397
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Pi HD Camera Sky Brightness Project

#5

Post by admin »

Hi Nick,

all looks like good progress. If you are interested, there are publications on how to estimate the sky brightness caused by the moon based on phase, distance from the moon, lunar altitude, etc. For instance https://articles.adsabs.harvard.edu/pdf ... .103.1033K . I have found that a good thing to do with this sort of info is to ask your favourite AI tool to generate code based on the model presented in the paper - worth checking what is generated for accuracy, but doing that is often much quicker than puzzle out the full meaning of the paper then implement the algorithm yourself.

cheers,

Robin
Post Reply