Jump to content

 

1825338873_SNRPN2021banner.jpg.68bf12c7791f26559c66cf7bce79fe3d.jpg

 

Another All Sky Camera


Mognet
 Share

Recommended Posts

Last year I picked up Pete's all sky camera code so I could build my own. I spotted a few things in the code that needed fixing or improving. As my tinkering ended up with rewriting most of it I thought it deserved its own thread

Lots of changes have been made from Pete's version

  • A history of images and videos is now available. And automatically removes the oldest when space gets tight
  • A timestamp has been added to each stored image and is in the video too. CPU temperature as well. Air temperature will follow soon
  • The crontab generation has been rewritten so that new movie setups don't clash with image captures and consecutive days or nights don't get joined together
  • Crontab regeneration has been moved to noon
  • Testing for the absence of an already running instance of the capture script before starting a new capture
  • Speed improvements in video creation. Each image is now added immediately after capture
  • Install simplified by creating an installer script
  • Display improvements by using CSS
  • Common PHP code moved to another file for including
  • A few little bug fixes
  • Images and video are now captured at 1080p, even on a Pi Zero

It now runs happily on a Pi Zero, which is probably the minimum possible spec. Downloading the videos can be a bit slow at times, especially at night. There are still things to fix or add, and these will happen in due course

The code is available on my GitHub site, along with all the instructions, etc https://github.com/MarkGrimwood/Mognet-All-Sky-Camera-install

  • Like 5
  • Thanks 1
Link to comment
Share on other sites

Posted (edited)

Lots of updates done, and a couple of little bug fixes. It should install much easier now. Tomorrow I'm working on the wiki for it so I can detail how it works, with screenshots and explanations of what each script does

Thanks to Bob (jmrp on here?) for giving it a trial run, and notifying me of problems as he run into them

image.thumb.png.7b297da0829465d39c6030534de638f5.png

image.thumb.png.be6fccdf78eefa7cc38bb85c02fd818a.png

image.thumb.png.8e5610e1a41d3a1280c337bafeb7d35e.png

Edited by Mognet
  • Like 1
Link to comment
Share on other sites

Thank you for sharing. I'll add it to the todo list to try it on the Pi3A+ I've got here with the ASI462 as I can use that and see if I can power it for a whole night with the battery.

  • Like 1
Link to comment
Share on other sites

I don't know if mine will work with the ASI cameras as I don't have one yet. If not, then Thomas Jaquin's code probably will https://github.com/thomasjacquin/allsky His code looks like it's more suited to the better cameras and higher end devices, and is configurable for different options. Mine is more entry level.

 

And that reminds me that I should really test it out with a webcam too as I don't know if they use the same instructions as the Pi cameras

  • Thanks 1
Link to comment
Share on other sites

Have been tinkering with it some more and making a few minor updates. Most important though is adding the wiki page to document everything I can think of https://github.com/MarkGrimwood/Mognet-All-Sky-Camera-install/wiki

Checked into webcam usage as well, and it looks doable. It uses the fswebcam command instead of raspistill, so I'll have to work out something in code to test for them. But most importantly test that a webcam can capture adequate night views too

Link to comment
Share on other sites

Posted (edited)

I've seen that the IR filter can be removed from the old xbox webcams and that is makes it more sensitive., another thought for the rainy day sometime list

Edited by happy-kat
Link to comment
Share on other sites

1 minute ago, happy-kat said:

I've seen that the IR filter can be removed from the old xbox webcams and that is makes it more sensitive., another thought for the rainy day sometime list

That's a good idea. I should also check into the modern webcams too as the only one I've got here that still works is an ancient HP one. I think it's about ten years old

Link to comment
Share on other sites

1 hour ago, jiberjaber said:

Right - thanks for this, I think I know what I'll be tinkering with when the rain stops this week! :)

Let me know how you get on. I think I've caught all the major bugs and it runs nicely here on both Pi Zeros, and it should be easy to install now

Link to comment
Share on other sites

Posted (edited)

Hmmm I'm getting 

[quote]Welcome to the setup stage of Mognet's All Sky Camera
=====================================================
Please connect the camera before installing
Install cancelled
pi@allsky:~/Mognet-All-Sky-Camera-install-main $[/quote]

 

This could coincide with my read-error I am getting on the original all-sky or could be I haven't disabled the original all sky yet!

 

 

** EDIT **

Right, the /usr/bin/raspistill -q 100 -ISO auto -awb greyworld -n -ex auto -w 800 -h 600 -o /run/shm/webcam.jpg command is also returning "mmal: Camera is not detected. Please check carefully the camera module is installed correctly"

So looks like I'll need to get the ladders out and remove the unit to inside to look at whats going on! Hmmmmm

Edited by jiberjaber
Link to comment
Share on other sites

Posted (edited)

That's odd. SSH onto it and type in

vcgencmd get_camera

That should tell you if the camera is detected and enabled. Both values will return as 1 if they are

It could also just be a clash between the old and new ones. I'd intended for a clean install, so maybe first stop and remove the existing cron job, and then force a reboot

sudo service cron stop
sudo crontab -r
sudo reboot -f -f

After that it should have sorted any tangles that it got itself into

 

Edit: Also spotted a couple of hours ago that I'd left a test value in the code. Instead of regenerating times at noon it was set to 13:35. I've fixed it now, and if you pulled the code after 9:15 you should have the correct version (or check in mgasc.sh and see if the line that sets dailyupdate.sh to run says 0 12 or 35 13. It should be 0 12)

Edited by Mognet
  • Like 2
Link to comment
Share on other sites

 

pi@allsky:~ $ vcgencmd get_camera
supported=1 detected=0
 

 

Thanks for that - it's been so long since I played with it I forgot most of the diagnostics stuff... Looks like I will have to get the ladder out after all ! LOL 

 

 

Link to comment
Share on other sites

If it's been working fine, then try the cron job removal and remote reboot first. And if that doesn't fix it then get the ladder out. But not tonight or tomorrow as it's a bit windy right now!

Link to comment
Share on other sites

10 minutes ago, JamesF said:

If it's anything like here over on your side of the country, the camera could be in Germany by now...

James

Quite possibly. Tonight it's 22mph, tomorrow gusting 50 according to the BBC forecast

Link to comment
Share on other sites

1 minute ago, Mognet said:

Quite possibly. Tonight it's 22mph, tomorrow gusting 50 according to the BBC forecast

The forecast for here is for the wind to be gusting up to the mid 40s until getting towards Friday lunchtime.  My observatory is in the lee of the house and in fact the top of the roll-off roof is below the house ground floor level, but the weather station mounted there is still measuring wind speeds of over 30mph!

James

Link to comment
Share on other sites

Success, painless install too! Just need to integrate my MQTT weather station data and we are back to all-sky land :) (might need to refocus the camera I think!)

I ended up sticking a spare 3b+ in there, tight fit with some knife skills on the USB lead, not sure if I can fit a POE hat and Ethernet cable in to the current dome, may need to print a custom enclosure, which wasn't really in the plan... 

Same camera, different ribbon cable, but there was no visible indication of why the camera had stopped being recognised by the zero.  Same SD card too, so I suspect either the zero or the cable to be the issue... 

 

image.thumb.png.2f0f705b1a024404f89f60f8c253be43.png

 

  • Like 1
Link to comment
Share on other sites

That's good news. Odd about the connection problem, but these things happen.  Let me know if you find anything wrong other than the little bits I've documented already

All we need to do now is fix the weather!

Link to comment
Share on other sites

Seems to be going well so far, though I have noticed that whilst I have an entry for last night and yesterday, the night archive is just one image, but the latest night is the actual full set of files/video. Perhaps the creation of the archive needs to move to when the start of the next night collection starts? 

 

image.png.fd37c3ba07cf00d50e69a62224401ce5.png

 

Also, I had a router issue today which resulted in the house network being effected and I had to power cycle the all-sky to get it back on - not associated with your code of course, but a common issue we all might encounter especially if the camera is up high or bottom of the garden etc...

Anyway, I've just come across a hardware watchdog on the Pi which I haven't tried, but looks promising - I wasn't really wanting to restart the whole device though, just a wifi connection watchdog, but the hardware one might be worthy of consideration - I'll look in to it further.  Details here: https://diode.io/raspberry pi/running-forever-with-the-raspberry-pi-hardware-watchdog-20202/

 

Link to comment
Share on other sites

3 hours ago, jiberjaber said:

Seems to be going well so far, though I have noticed that whilst I have an entry for last night and yesterday, the night archive is just one image, but the latest night is the actual full set of files/video. Perhaps the creation of the archive needs to move to when the start of the next night collection starts? 

That's a known issue and does get mentioned in the wiki section. The cause comes from creating both day and night directories at the same time. When the changeover code in newmovie.sh is run it just assumes there was something in the directory to archive rather than checking. Along with checking the directory existance I should also check the count of files, and then only create the archive if there are more than four (the newly created directory contains image, thumbnail, mpeg and info files). I'll fix and test that tomorrow

 

3 hours ago, jiberjaber said:

Also, I had a router issue today which resulted in the house network being effected and I had to power cycle the all-sky to get it back on - not associated with your code of course, but a common issue we all might encounter especially if the camera is up high or bottom of the garden etc...

I've had similar happen with a router update and I've had to power cycle the Pi to reconnect, but I've also seen it reconnect fine too. Something to look into so I can add fix notes to the wiki. One of mine I set to a fixed IP address on the router, and I think I set the other to a fixed IP address on the Pi. The former is probably the better solution

 

I'll have a look at that hardware watchdog. It could be interesting. I was planning to keep mine within easy reach but I know other people will have different plans

Link to comment
Share on other sites

Posted (edited)

Well the hardware watchdog works great, so much so I've moved location to sort of where I always intended it to be, at the bottom of the garden - though at the moment it's sat on a wood perch I've laid onto the shed roof  - hopefully it wont get blown over! Mine runs off a static DHCP address so always gets the same IP no mater which access point it's on.  I need to ssh on to it and see what the signal strength is for it as when I was up the ladder the AP it is associated with was quite weak on my phone but the main AP was better - of course how that plays out inside the ally case of the camera enclosure is what I need to check - though so far it seems fine when streaming the video from it.

 

NZ6_2573.thumb.jpg.db5feec4f5892daba58371c364f63e1f.jpg

Location seems better (which I expected) with more sky visible now - though I might need to refocus at some point when it is drier though it now requires a ladder rather than just some steps to get to it!

image.png.95cae8e85074b7af1207626329b0020b.png

Edited by jiberjaber
  • Like 2
Link to comment
Share on other sites

I forgot to mention, you might want to add a link to your git and perhaps a version number or similar somewhere (on about perhaps? )

Other than that, it seems more stable and responsive that previous incarnations - a great evolution of Pete's all-sky camera! Well done.

 

I've not delved in to the scripts yet to see where to add my MQTT data so might take a look at that if I get some time this week. 

Link to comment
Share on other sites

Thanks. It's looking good there, and it makes me happy to see someone getting good use out of it

I did mean to link back to the GitHub page from the About page, so I'll do that when I do that little fix tomorrow

If you want to capture MQTT data to add onto the image then look in capture.sh and newmovie.sh in back-end/pics/ as that's where the images are captured

Link to comment
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
 Share

  • 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.