Jump to content

Stargazers Lounge Uses Cookies

Like most websites, SGL uses cookies in order to deliver a secure, personalised service, to provide social media functions and to analyse our traffic. Continued use of SGL indicates your acceptance of our cookie policy.

Pete6

Raspberry Pi AllSky Camera

Recommended Posts

49 minutes ago, jiberjaber said:

Yep - I've got those modifications running also from when you first mentioned it.  I just need to have a think about the best place to put the commands to pick up the weather data then I can simplify the code I have reading the files. I think if I run them every 2 mins it should grab at a sufficiently realtime rate for the camera annotation. 

 

If you want to run a job every 2 minutes, open up webcam and find the part where I write out the crontab file and stick a line or two in there.  There are plenty of examples in that code .  

echo "*/2 * * * * $HOME/myjob> /dev/null 2>&1">>$HOME/webcamcron

should do the trick.  That way it will get written to the crontab file each day when webcam runs itself and writes a new crontab file.

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

Yep - thats what I have done, it calls a script every 2 mins which calls mosquitto_sub -C1 for each of the three topics I need to grab data from the server running them concurrently as one updates every 5 seconds and another updates ever 2 mins! These are piped to a tmp file which is then copied to the final file when teh mqtt stuff has finished so if the webcam updates there is always data there for it to put in the banner (other wise the pipe file just blanks till the data is pipped!) I added an additional file which has a timestamp in so I can see that teh mqtt script was successful quickly, but I will probably turn this off now I am happy it is working.

 

Edited by jiberjaber

Share this post


Link to post
Share on other sites

Nice work! IMHO looks like you've got a lot of light polluton - are you doing narrowband?

Best, U.

Share this post


Link to post
Share on other sites
Posted (edited)
8 hours ago, uhb1966 said:

Nice work! IMHO looks like you've got a lot of light polluton - are you doing narrowband?

Best, U.

No this is not doing narrow band.  In fact I only just got the Raspberry Pi Cam V2 with its Sony IMX 219 sensor to gather enough light down the M12 mount to its 1/4 (I think()" sensor.  There us also not IR filter so in fact this is about as wide a band as I can make it.

My goal was to make a very cheap but usable AllSky Camera.  Using a Pi Zero W you can make a working setup for well under £40 not including the case.  Jiberjaber has used a drinks bottle for that.  So not too expensive.  If you skip using the temperature prob you can assemble the whole device with zero soldering and standard Raspberry Pi parts..

Shortly (within the next couple of weeks) I shall be installing one at my dark sky astronomy club site in (nearly) darkest South Carolina http://charlotteastronomers.org/  Hopefully I shall have a link that I can access from home that I can post here.  The club already has an AllSky Cam so if you look at the site you'll find it but that is not narrow band either.  This is not really a narrow band game.  The idea is to see the whole sky regardless of the weather.

Pete

Edited by Pete6

Share this post


Link to post
Share on other sites

I'm about to have a go at setting this up. New to the Pi and just got hold of the HQ camera. I see from discussion on the pi forum there is a patch that allows you to start the image capture in burst mode that means it only takes a couple of seconds on top of the exposure length to take the photo. 

I just did sudo rpi-update and then the following allows you to go straight into busrt mode, e.g. 25 second exposure at gain 10:

raspistill -t 10 -md 3 -bm -ex off -ag 10 -ss 25000000 -st -o Desktop/test8.jpg
Hopefully this means you can do much more frequent exposures if desired.

Share this post


Link to post
Share on other sites

Hi Sam,  This sounds pretty exciting to me.  I have no experience using the HQ camera although I have read all about it.  It seems a mighty camera.  It should work with AllSky Camera but given the foregoing, I ain't tested it so you are a (the?) pioneer here.  I will give you all the help I can which may turn out to be worth exactly what you pay for it...

One thing has emerged from testing and that is the Pi (even a 4) seems to take a fair while to completely clear itself after processing an image.  This is why we have had so much discussion about how often a Pi Zero can take an image at night.  This was also why I limited my image size to 800 x 600 pixels.  I hate wasting pixels but It just took too long.  There is a utility on the Pi called htop and that will show multiple instances of raspistill if it starts to run into trouble.  If this happens just increase the variables shotD (Day) or shotN (Night) which determine how often - in minutes - the Pi takes an image.  

In general, more frequent images = less time to process them, bigger images = more processing time needed.  Pretty obvious.  The HQ camera has a larger sensor and higher resolution with more pixels.  However it seems to be able to do at least some processing within the device so maybe it will all even out.  The Raspberry Pi forum is your friend here and member jamesh is the Raspberry Pi employee who seems to be the oracle of the cameras.

Please stay in touch here as this looks to be very interesting.

Kind regards

Pete

Share this post


Link to post
Share on other sites

So there's a bit of a problem at the moment, the movies are not quite right which I think is because of the output of Sunwait and the loss of astro dark here.  I suspect there needs to be an exception in the code to handle detecting the "--:--" and in that case using another time, perhaps Nautical? 

image.thumb.png.20a71511ceadffd19ca83a4fcbc3d263.pngimage.png.2322336411aa5b1dda8bbacfcc8c037d.png

Share this post


Link to post
Share on other sites

Jason,  None of this should be happening.  Could you please either post here or PM me the /home/pi/webcam file.  I have no idea what has happened but I will find out. 

Actually if you need to post it on Dropbox or Google Drive let me have the link.

Thanks

Edited by Pete6
  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, Pete6 said:

Jason,  None of this should be happening.  Could you please either post here or PM me the /home/pi/webcam file.  I have no idea what has happened but I will find out. 

Actually if you need to post it on Dropbox or Google Drive let me have the link.

Thanks

Hi Pete,

I think it's because at my location we now have no astro dark so when the script runs the Astro rise is "--:--" and this breaks the script (I've not looked in detail as I have some image processing to catch up on so this is just a theory  :) )

Here's the output from webcam:

pi@raspberrypi:/home/allsky $ sudo ./webcam
raspistill not running
N /usr/bin/raspistill -q 100 -ISO auto -co 70 -awb greyworld -n -ex night -ag 9.0 -dg 2.0 -ss 6000000 -w 800 -h 600 -o /run/shm/webcam.jpg

E V E N T                                      HH:MM OFFSET
---------------------------------------------  ----- ------
Astronomical Rise (18 degrees below horizon):  --:-- (Midnight sun) -00:10
Astronomical Rise (Real)                    :  --:-- (Midnight sun)
Nautical Rise (12 degrees below horizon)    :  02:46 -00:10
Nautical Rise (Real)                        :  02:56
Civil Rise (6 degrees below horizon)        :  03:52 -00:10
Civil Rise (Real)                           :  04:02
CAMERA switches from Night to Day           :  03:54 -00:08
VIDEO switches from Night to Day            :  03:59 -00:03
Sunrise (0 degrees below horizon)           :  04:45 00:00
Sunrise (Real)                              :  04:45
Sunset (0 degrees below horizon)            :  21:05 00:00
Sunset (Real)                               :  21:05
Civil Set (6 degrees below horizon)         :  21:48 -00:00
Civil Set (Real)                            :  21:48
CAMERA switches from Day to Night           :  21:57 -00:09
VIDEO switches from Day to Night            :  22:00 -00:12
Nautical Set (12 degrees below horizon)     :  22:54 -00:00
Nautical Set (Real)                         :  22:54
Astronomical Set (18 degrees below horizon) :  --:-- (Midnight sun) -00:00
Astronomical Set (Real)                     :  --:-- (Midnight sun)
Sat 30 May 01:51:55 BST 2020
pi@raspberrypi:/home/allsky $
 

 

webcam

Share this post


Link to post
Share on other sites

webcam uses Civil Dawn and Dusk times to switch modes.  The camera seemed happier with this.  You can select whichever Dawn / Dusk set you wish in lines 218 - 230 in the webcam file.  Currently this is set to Civil but it can be changed to Nautical or Astronomical.  I display these last two Dawn . Duck times only for information.  They do not do anything inside the code.  It's an astronomer's tool so I display all the Dawn / Dusk daily timings.

Only the Civil times are currently used to switch camera modes and videos..  Hence the Midnight sun text is just informational.

I changed one thing in your file.  At line 136 

twiSetVid=-00:15 # Offset advance or delay for the Video Day / Night switch.

I did this to give a 6 minute interval between the camera switching to night mode and the night video start.  This is how my system runs currently.

There is a text file in /home/allsky named daily_times.txt  This is a copy of the table that webcam puts out.  It is there purely for reference so that times are accessibly without re-running webcam.

Please try this as this is how my Pi Zero W is currently working.

Please let me know what happens.

Pete

Jason-webcam

Share this post


Link to post
Share on other sites
On 30/05/2020 at 14:49, Pete6 said:

webcam uses Civil Dawn and Dusk times to switch modes.  The camera seemed happier with this.  You can select whichever Dawn / Dusk set you wish in lines 218 - 230 in the webcam file.  Currently this is set to Civil but it can be changed to Nautical or Astronomical.  I display these last two Dawn . Duck times only for information.  They do not do anything inside the code.  It's an astronomer's tool so I display all the Dawn / Dusk daily timings.

Only the Civil times are currently used to switch camera modes and videos..  Hence the Midnight sun text is just informational.

I changed one thing in your file.  At line 136 


twiSetVid=-00:15 # Offset advance or delay for the Video Day / Night switch.

I did this to give a 6 minute interval between the camera switching to night mode and the night video start.  This is how my system runs currently.

There is a text file in /home/allsky named daily_times.txt  This is a copy of the table that webcam puts out.  It is there purely for reference so that times are accessibly without re-running webcam.

Please try this as this is how my Pi Zero W is currently working.

Please let me know what happens.

Pete

Jason-webcam 29.07 kB · 0 downloads

Hi Peter, thanks for that I've updated my version of the webcam script to cover the revised twiSetVid value but I don't think this is where the problem is at. 

There is still something wrong however.... It seems to effect the movie making for both day and night movies, no longer are the a combination of timed exposures, but seem to be stuck at a particular time. The movie is about the right length, so the concatmovie script is being run and adding a frame each time, the problem is it keeps adding the same frame each time - I can see this as I have the timestamp on the frames!

Why this is occuring I am not sure, if I manually run copypic and concatmovie, it works. So my suspicion is still around the other thing thats changes which is the times used as a result of no astro-dark. At present this is corrupting the webpages as the file it is stored in is now in a different format as posted above, I think the " --:-- (Midnight sun) -00:10" stuff is breaking the scripting somewhere (perhaps in the webcam script or the web pages)

 

Share this post


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

By using this site, you agree to our Terms of Use.