I was planning on stopping my images at night time being uploaded... which did not work out well - as Stemweather just blanks to a white screen which did not look pretty. The reason I thought of doing this was - boring black images and therefore wasting bandwidth.
Now I took that thought further - as I was developing my next mod...
What if night time images took longer exposures - maybe 1 sec or 3 sec or 5 sec... Not long enough for star trails to show - but long enough to get some definitions... It might show some stars, but it might capture clouds to see patterns and if its cloudy or clear night... Its got to be better than just black...
Has anyone thought of doing this before I start experimenting...
I had to wait until night time to give it a try... and lets just say I am impressed with this little camera on the PI....
For those that have followed my other mods - I use Astral to determine sunrise, sunset, dawn, dusk.... As I take a separate picture for my twitter feed to show the previous days sunset.
The code below might need to be modified for your circumstance - but it gives you the idea of what to do...
I check to see if its night time, and then my camera exposures are 6 seconds.... I found it does not work unless you set both framerate and shutter speed... that took ages to debug ! All the examples use Fraction that I found so I also had to do an import on this utility.... And I also found leave it wait for 30 seconds to get the light balance right - but that seemed too long - so I only did a sleep for 10 seconds....
Help yourself to my changes to SkyCamera.py; import requests import time import picamera import state
from PIL import ImageFont, ImageDraw, Image import traceback import util import datetime as dt import astral # Need to install this via sudo pip install astral import pytz from fractions import Fraction
# Check for user imports try: import conflocal as config except ImportError: import config
if (config.SWDEBUG): print ("--------------------") print ("SkyCam Picture Taken") print ("--------------------") camera = picamera.PiCamera()
if dt.datetime.now().time() > result['dawn'].time() and dt.datetime.now().time() < result['dusk'].time(): #Daytime camera.exposure_mode = "auto" else: #Nighttime print "Night time exposure" # Set a framerate of 1/6fps, then set shutter # speed to 6s and ISO to 800 camera.framerate = Fraction(1, 6) camera.shutter_speed = 6000000 camera.iso = 800 # Give the camera a good long time to set gains and # measure AWB (you may wish to use fixed AWB instead) time.sleep(10) camera.exposure_mode = 'off' # Finally, capture an image with a 6s exposure. Due # to mode switching on the still port, this will take # longer than 6 seconds
try: camera.rotation = 180 #camera.rotation = 270 camera.resolution = (1920, 1080) # Camera warm-up time time.sleep(2)
Now I just need to wait for the morning to see if the daylight pictures revert back to normal....
What really impressed me on this 6 second exposure was not what I was expecting... Its storm here tonight - expecting rain - huge cloud cover... Standing outside I cannot see the sky at all - clouds everywhere... But from the first picture I took - I could see stars through the clouds... Lots of stars. I am only a couple of miles from the CBD of Melbourne - several million people live here - and huge light pollution... Yet the detail of the stars through the clouds - WOW - What a great little camera the PI has....
I am still experimenting in my backyard, and can not wait to take this to the farm where there is no light pollution, and can clearly see the milky way by eye sight alone.... Im expecting some great pics now!!! Might have to change the parameters down a little once I have it on site!
Yes I noticed this yesterday - it worked all good the first couple of nights, then last night it died - just as you said... and your spot on about how the task scheduler has got confused... Trying to understand why it worked for me on the first couple of nights and then it stopped, and it broke for you guys on the first night...
Wondering when I copied and pasted the code here that I introduced something strange - anyway... partly resolved last night, working on it now, and hope to have it fixed for tonight... standby
change the code finally: try: camera.exposure_mode = "auto" time.sleep(1) camera.close()
except: if (config.SWDEBUG): print ("--------------------") print ("SkyCam Close Failed ") print ("--------------------")
Just before the import base64
I was able to determine it was 'hanging' on the close camera statement... and I mean hanging - if you were running it in a terminal - you could not even control-c out of it, nor could you start another terminal and do a reboot!!!
For whatever reason - it was hangning and it would not get trapped as an error - and everything just stalls...
I googled everywhere and could not find anyone else with a similar issue. So I just thought I would try... - It only occurs when it is doing a long exposure (the sunset shots are done prior to this as normal, then it changes the paramaters to do a long expsosure, and hangs on the close only if it was set as a long exposure). - So I thought I would reset the camera back to normal, give it a second to make up its mind, and then close... It now works.
SO I will continue to monitor it - and if there is indeed further problems - I will get it fixed quickly, as I want to be using this myself!
I believe I now fixed it - change to this bit of code else: #Nighttime print "Night time exposure" # Set a framerate of 1/6fps, then set shutter # speed to 6s and ISO to 800 camera.exposure_mode = "night" camera.framerate = 1 camera.shutter_speed = 600000 camera.iso = 800 # Give the camera a good long time to set gains and # measure AWB (you may wish to use fixed AWB instead) time.sleep(2) # Finally, capture an image with a 6s exposure. Due # to mode switching on the still port, this will take # longer than 6 seconds
As previously mentioned - for whatever reason changes to shutter speed do not work unless you change the framerate. The Framerate was causing issues - changing this to a value of 1 frame per second seems to have it all working again!
Shall try to improve the image and get it all working a little better - and I shall clean up the code - but at least this gets you working again !
Thats awesome... and.. as you say.. its only software.
Some of my issue, however, was not. When I switched out the camera, I forgot to take note that when THIS one takes photos, there is a little red LED that goes on.
Some very technical, and careful engineering solved the issue. With Blu Tack.
Images are a little dark, but I have Jupiter (I think) in the frame quite nicely. Lengthened to 60s and no real change. So will tinker in the light tomorrow and see where Im actually pointed and wait til tomorrow night to see what comes out
Thanks so much for your efforts, and also allowing us to use it