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

Posted (edited)

I am making some headway with the Pi Zero W not starting the night video.  As you know the night still shot interval is 5 minutes and there is only 3 minutes between switching the camerat to night mode and starting the night video so, that needs to change.  Worst case this interval would be 2 + 5 = 7. minutes.  Also I need a still image to make a video with and I need that to be only a night time shot so initially what I did was to just wait.  That did not work due to the 2, 5, 10 minute cycle of shot and concatenate.  This was complicated by the asynchronous nature of Mother Nature changing sun times daily.  

Finally I opted to wait for a new still pic to arrive, concatenate that to the DAY video, wait for another (since a regular concatenate event may have occurred) and use that as the start of the NIGHT video.  I did the same in reverse for the day video.

What I did last night was to remove the 2nd wait period.  I now attend night time today with anticipation.  I hope it works.  If it does not then it is just one more thing not to try.

If you look at /home/allsky/pics/newnightmovie.sh and newdaymovie.sh you can see where this may need changing.  It is commented so should be findable.

Here is what I changed in /homw/allsky/webcam Lines 127 - 132

# Shifts camera mode time at Evening Twilight / NIght
# For the night camera mode
#       HH:MM
twiSet=-00:00 # Advance or delay when the camera switches from day to night.
twiSetP=-00:09 # Camera switch time.  Needs to be at least 1 minute EARLIER tha$
twiSetVid=-00:16 # Offset advance or delay for the Video Day / Night switch.

 

Edited by Pete6
added more info and a few lines o' code
  • Like 1

Share this post


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

I am making some headway with the Pi Zero W not starting the night video.  As you know the night still shot interval is 5 minutes and there is only 3 minutes between switching the camerat to night mode and starting the night video so, that needs to change.  Worst case this interval would be 2 + 5 = 7. minutes.  Also I need a still image to make a video with and I need that to be only a night time shot so initially what I did was to just wait.  That did not work due to the 2, 5, 10 minute cycle of shot and concatenate.  This was complicated by the asynchronous nature of Mother Nature changing sun times daily.  

Finally I opted to wait for a new still pic to arrive, concatenate that to the DAY video, wait for another (since a regular concatenate event may have occurred) and use that as the start of the NIGHT video.  I did the same in reverse for the day video.

What I did last night was to remove the 2nd wait period.  I now attend night time today with anticipation.  I hope it works.  If it does not then it is just one more thing not to try.

If you look at /home/allsky/pics/newnightmovie.sh and newdaymovie.sh you can see where this may need changing.  It is commented so should be findable.

Here is what I changed in /homw/allsky/webcam Lines 127 - 132


# Shifts camera mode time at Evening Twilight / NIght
# For the night camera mode
#       HH:MM
twiSet=-00:00 # Advance or delay when the camera switches from day to night.
twiSetP=-00:09 # Camera switch time.  Needs to be at least 1 minute EARLIER tha$
twiSetVid=-00:16 # Offset advance or delay for the Video Day / Night switch.

 

In the newmovie scripts, is it this part that needs removing?

 

Quote

# Do it again just in case concatxxx ran meanwhile.
while [ ! -f /home/allsky/pics/webcam-*.jpg  ]; do sleep 1; done
/bin/sleep 5

 

Share this post


Link to post
Share on other sites
Posted (edited)

Something odd has happened, the execution of /usr/bin/raspistill -q 100 -ISO auto -awb greyworld -n -ex auto -w 800 -h 600 -o /run/shm/webcam.jpg isn't happening, can't see anything in the logs but if I reboot, /run/shm only contains error.jpg but if I manually run the raspistill line it creates the webcam.jpg file and is visible on the webpage.  It doesnt seem to be updating. Not sure if something is stuck in the the system somewhere? 

 

ETA: Hmmm working now! Not sure what was wrong, I think here is some conflict between editing the webcam script as a normal user and as root when I was pushing through the changes, will give it a reboot to see if it all comes back up as normal.

 

Edited by jiberjaber

Share this post


Link to post
Share on other sites

So the new(er) lens is wider though not super wide. I've ordered a wider lens M12 fitting but might be some time before that arrives, might need to fettle with the focus but as it is jammed into a coke bottle its a bit hard to get in there to connect it to a monitor so having to adjust, capture manually and then view over a network share, not ideal! 

image.png.b061df62c1c5e1b2713501e737fc96c0.png

 

The 3d printed mount worked well. I decided as I had some silicone sealant to hand to use that on the lens threads to seal the lid, hopefully it will not prevent any further focusing. Black mark represents UP direction of the camera, so at the moment, the image shows N along the bottom edge.

image.png.ef64bff492db49096337cf2b4d57ebaf.png

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Sorry for the delay.  Life got in the way again.  I need to answer your questions.

Yes that is the bit of code to comment out.

I have found that just re-running /home/allsky/webcam often causes problems.  I believe this to be due to cron running one job, usually raspistill and then being told to run another again, usually raspistill again and it does not seem to like that.  This goes double at night because of the longer processing time.  This is puzzling to me since the CPU load is always low.  However the Pi 3 and Pi 4 systems are a lot more forgiving than the Pi Zero,  I now have a 2nd Pi Zero W and I'll build that up on my bench to see how quickly I can break it.

Good news now.  The changes I made this morning (or was it yesterday) of commenting out the code in newnightmovie.sh and  in webcam seem to have worked tonight for the Pi Zero.  The night video just (15 mins ago here) changed over flawlessly.  I intend leaving it like this for a couple of days and then I shall try uncommenting the line in newnightmovie.sh as logic says I need that line to make it foolproof when creating the video each night.  

My feeling is that the increased time between the camera mode switch and the creation of the night video.  We shall see.  Time will reveal all.  Hehe

  • Thanks 1

Share this post


Link to post
Share on other sites

Wow - thats a beast of a camera just to check if the clouds are up or not!

 

Share this post


Link to post
Share on other sites
14 hours ago, jiberjaber said:

Something odd has happened, the execution of /usr/bin/raspistill -q 100 -ISO auto -awb greyworld -n -ex auto -w 800 -h 600 -o /run/shm/webcam.jpg isn't happening, can't see anything in the logs but if I reboot, /run/shm only contains error.jpg but if I manually run the raspistill line it creates the webcam.jpg file and is visible on the webpage.  It doesnt seem to be updating. Not sure if something is stuck in the the system somewhere?

the strace utility will give you a dump of all the system activity that the program made. That should help you see what went wrong.

Run as strace  /usr/bin/raspistill ..... and be prepared for lots of output!

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Spent another 45 mins fettling with the focus, tried to get a stream I could view on the laptop to help but didnt work so went back to capture to remove drive and view on laptop.  Think its a bit better now but shows the cheapness of the lens with lack of focus in the corners.

Will have to wait for the stars to come out to know better

image.png.69a0193c000121af7e06755cb2bdfbd7.png

 

Share this post


Link to post
Share on other sites

one thing with the lens, since it isn't under a dome you run the risk of water finding its way around the objective and down into the camera that way, especially since there looks to be a slight lip for water to collect and pool as it does. No easy way to waterproof these other than being under a dome.

If its an M12 you might look at the starlight marketed ones, they tend to be faster and better optically. Same in terms of the megapixel rating, the more MP its marketed for generally the better the quality of the lens. You could even swap the M12 mount for a CS one and go that route. Either way the real difficulty is getting a good match for the sensor size but with also good glass and low F rating and the focal length to suit your use case.

Share this post


Link to post
Share on other sites
1 hour ago, DaveL59 said:

one thing with the lens, since it isn't under a dome you run the risk of water finding its way around the objective and down into the camera that way, especially since there looks to be a slight lip for water to collect and pool as it does. No easy way to waterproof these other than being under a dome.

If its an M12 you might look at the starlight marketed ones, they tend to be faster and better optically. Same in terms of the megapixel rating, the more MP its marketed for generally the better the quality of the lens. You could even swap the M12 mount for a CS one and go that route. Either way the real difficulty is getting a good match for the sensor size but with also good glass and low F rating and the focal length to suit your use case.

Yes, I agree on the waterproofing, best I could do was a bead of silicon - I can't remember what the FL is on this lens, I think it might be 6mm from memory.  I'll look for dome - this was always supposed to be a temp solution to try it out :) 

  • Like 1

Share this post


Link to post
Share on other sites

My Pi Zero W system just switched flawlessly from day to night.  I have a 6 minute difference between the camera switching modes and the night video starting.  This has worked two days in a row.  The 3 Pi 3 and 4 systems have never had a problem with this change so It is like most things with my little project here, just a question of tweaking it until it does what you want.

I am going to leave this running like this for another couple of days until I change newnightmovie.sh and remove the comment I referred to earlier.

This is really getting close now to where I think it is reliable with a Pi Zero W.  This makes for a really cheap AllSky Camera.

The waterproofing on the objective is for sure a concern.  Water ingress at the edges is not what you need.  

  • Like 1

Share this post


Link to post
Share on other sites
18 hours ago, pete_l said:

the strace utility will give you a dump of all the system activity that the program made. That should help you see what went wrong.

Run as strace  /usr/bin/raspistill ..... and be prepared for lots of output!

Thank you. You are right it is err, voluble.  I am pretty sure after testing this device for some months that the problem is that raspistill does not clean up after itself very well.  SInce I am launching a new instance every 4-5 minutes and I know the image takes approx 1m 40s from prompt to prompt I am forced to conclude tha it is doing other things that take longer after the image is complete.  What I do not know but htop shows numerous instances of raspistill if I reduce the shot time.  On a Pi 3 or 4 a safe [removed word] time is 4 minutes but it seems that on a Pi Zero W, 5 minute intervals are  needed. 

Once the intervals are set correctly, the AllSky camera works fine. I have 4 of them running here and one is a Pi Zero all the others have been running flawlessly for over a week. SO I just need to fix the Pi Zero timing and we have a very cheap AllSky Camera.

Pete

Share this post


Link to post
Share on other sites

hmmmm, I'm not sure mine is 100% happy at the moment.  After playing with the focus yesterday evening (which improved the stars) and a reboot (because I had stopped the cron service etc and with a restart it still isn't working). I eventually had to SSH in and delete the contents of /run/shm/  to get it to show anything other than the read error picture. After that it's been running fine but my night movie is still short (only 18 secs long and looks like there is a gap in the middle I think) 

If we can figure out a way to use the banner version of the picture with the timestamp in it, then that would confirm or deny the gap perhaps?

I'll have a look today, might just be a case of copying the banner version over the original?

Share this post


Link to post
Share on other sites

What you are experiencing is exactly what happened to me.  Once it works, it just goes on ticking.  I am seeing about 22 second night videos and over a minute for daytime.  This agrees with the other 3 Pi 3 and 4  systems running alongside.  

 

Share this post


Link to post
Share on other sites

Well I just checked and the night video stopped at the same time as last time. I went through all the scripts in pics directory and commented out the find and remove any file <110k and the movienight created a newer version of 0000 (just so happened that's just after I placed the comments in the scripts).  My night pictures are circa 53k and certainly have data in them as can be seen on the 'live cam view'.  

Will monitor and see what the night movie looks like tomorrow morning :)

 

Share this post


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

Well I just checked and the night video stopped at the same time as last time. I went through all the scripts in pics directory and commented out the find and remove any file <110k and the movienight created a newer version of 0000 (just so happened that's just after I placed the comments in the scripts).  My night pictures are circa 53k and certainly have data in them as can be seen on the 'live cam view'.  

Will monitor and see what the night movie looks like tomorrow morning :)

 

Well maybe your camera is delivering images of a different size to mine.  As downloaded and with a Pi Cam V2 it should work.  The 110Kb file limit was set up for and is stopping all white image files on my Pi Zero W system.

Could it be that your system is producing files that are smaller?  If so the 110Kb limit certainly needs to be changed.

Here is a ls - l dump from my Pi Zero W system

 

Edited by Pete6
Add ed code snippet in next post

Share this post


Link to post
Share on other sites
Posted (edited)
root@0W-AllSky:/home/allsky/pics# ls -l
total 10808
drwxr-xr-x 2 root root    4096 Apr 29 18:16 b
-rwxr-xr-x 1 root root    1329 Apr 19 20:47 concatday.sh
-rwxr-xr-x 1 root root    1341 Apr 19 20:47 concatnight.sh
-rwxr-xr-x 1 root root     299 Apr 30 08:24 copypic.sh
drwxr-xr-x 2 root root   20480 May 18 20:50 day
-rw-r--r-- 1 root root 9476568 May 18 21:05 movieday.mp4
-rw-r--r-- 1 root root  624245 May 18 21:35 movienight.mp4
-rwxr-xr-x 1 root root     150 Apr  4 19:52 movie.sh
-rwxr-xr-x 1 root root    2528 May 14 22:54 newdaymovie.sh
-rwxr-xr-x 1 root root    2515 May 15 21:04 newnightmovie.sh
drwxr-xr-x 2 root root   12288 May 18 21:35 night
-rw-r--r-- 1 root root  447810 May 18 21:35 webcam-1589852161.jpg
-rw-r--r-- 1 root root  447810 May 18 21:35 webcam-1589852342.jpg

I can post the code for any/all my files as you wish. If you PM me I can set up a temporary remote SSH for you.  That way you can copy them directly.  I'll just change the passwords for your session.  I really want your system to work.

This AllSky Camera is really frustrating to fiddle with because you only get one sunset per day.  

Did you see the little trick I posted for focusing.  You MUST have the console connected for this to work 'cuz that's were the images will be displayed.

service cron stop
raspistill -k
service cron start

 

Edited by Pete6
  • Like 1

Share this post


Link to post
Share on other sites

Hi Pete - Yes I used the stop cron service etc but as my Pi is sealed into a small cola bottle (only just big enough for a USB cable to be plugged in, I was unable to take advantage of the focusing using a HDMI connected monitor.  I did hope I could stream the video feed to VLC on a laptop but when I tried it, it complained about the video codec and I didnt have the time to investigate further.  When the wider angle lens turns up I'll look again because spending over an hour climbing a step ladder and then coming back down and executing a command over SSH then using a viewer to see what changed isn't the most efficient way of trying to fine tune the focus!

The only files I've changed have been the ones we've covered in the thread so far. So from memory

Changed webcam.sh to add lat/long and then to alter timings (same ones you were experimenting on)

removed the second wait for raspistill

added backup script to be executed to the new movie scripts (both night and day) 

commented out the find and remove of files <110kb in all scripts within the /home/allsky/pics directory.

I might have missed something out but it's been spread over a few days and I didn't write any notes ! 

One thing is for sure, there is potentially a difference in ownership of files, this shouldn't be a problem for the autonomous cron jobs as they are all run by 'god like powers' of root user. Here's last nights webcam captures which you can see the change in file size bathtub curve. (I commented out the removal of <110kb files around midnight, so no files between 22:30 and 00:00) I'm pretty sure there must be something to do with how the Pi is handling darker images from my V2 camera

Quote

pi@raspberrypi:/home/allsky/pics/night $ ls -ahl
total 17M
drwxr-xr-x 2 root root 4.0K May 19 04:16 .
drwxr-xr-x 5 pi   pi   4.0K May 19 09:27 ..
-rw-r--r-- 1 root root 281K May 18 22:00 webcam-1589835421.jpg
-rw-r--r-- 1 root root 382K May 18 22:00 webcam-1589835602.jpg
-rw-r--r-- 1 root root 400K May 18 22:10 webcam-1589835781.jpg
-rw-r--r-- 1 root root 419K May 18 22:10 webcam-1589835961.jpg
-rw-r--r-- 1 root root 419K May 18 22:10 webcam-1589836141.jpg
-rw-r--r-- 1 root root 421K May 18 22:20 webcam-1589836321.jpg
-rw-r--r-- 1 root root 421K May 18 22:20 webcam-1589836501.jpg
-rw-r--r-- 1 root root 377K May 18 22:20 webcam-1589836681.jpg
-rw-r--r-- 1 root root 320K May 18 22:30 webcam-1589836861.jpg
-rw-r--r-- 1 root root 320K May 18 22:30 webcam-1589837042.jpg
-rw-r--r-- 1 root root 173K May 18 22:30 webcam-1589837221.jpg
-rw-r--r-- 1 root root 173K May 18 22:30 webcam-1589837402.jpg
-rw-r--r-- 1 root root  58K May 19 00:00 webcam-1589842431.jpg
-rw-r--r-- 1 root root  58K May 19 00:00 webcam-1589842441.jpg
-rw-r--r-- 1 root root  61K May 19 00:00 webcam-1589842621.jpg
-rw-r--r-- 1 root root  61K May 19 00:00 webcam-1589842801.jpg
-rw-r--r-- 1 root root  59K May 19 00:10 webcam-1589842981.jpg
-rw-r--r-- 1 root root  52K May 19 00:10 webcam-1589843161.jpg
-rw-r--r-- 1 root root  52K May 19 00:10 webcam-1589843341.jpg
-rw-r--r-- 1 root root  50K May 19 00:20 webcam-1589843521.jpg
-rw-r--r-- 1 root root  50K May 19 00:20 webcam-1589843701.jpg
-rw-r--r-- 1 root root  50K May 19 00:20 webcam-1589843881.jpg
-rw-r--r-- 1 root root  48K May 19 00:30 webcam-1589844061.jpg
-rw-r--r-- 1 root root  48K May 19 00:30 webcam-1589844241.jpg
-rw-r--r-- 1 root root  49K May 19 00:30 webcam-1589844421.jpg
-rw-r--r-- 1 root root  49K May 19 00:30 webcam-1589844601.jpg
-rw-r--r-- 1 root root  48K May 19 00:40 webcam-1589844782.jpg
-rw-r--r-- 1 root root  50K May 19 00:40 webcam-1589844961.jpg
-rw-r--r-- 1 root root  50K May 19 00:40 webcam-1589845141.jpg
-rw-r--r-- 1 root root  49K May 19 00:50 webcam-1589845321.jpg
-rw-r--r-- 1 root root  49K May 19 00:50 webcam-1589845501.jpg
-rw-r--r-- 1 root root  53K May 19 00:50 webcam-1589845681.jpg
-rw-r--r-- 1 root root  73K May 19 01:00 webcam-1589845861.jpg
-rw-r--r-- 1 root root  73K May 19 01:00 webcam-1589846041.jpg
-rw-r--r-- 1 root root  75K May 19 01:00 webcam-1589846221.jpg
-rw-r--r-- 1 root root  75K May 19 01:00 webcam-1589846402.jpg
-rw-r--r-- 1 root root  44K May 19 01:10 webcam-1589846581.jpg
-rw-r--r-- 1 root root  43K May 19 01:10 webcam-1589846761.jpg
-rw-r--r-- 1 root root  43K May 19 01:10 webcam-1589846942.jpg
-rw-r--r-- 1 root root  42K May 19 01:20 webcam-1589847121.jpg
-rw-r--r-- 1 root root  42K May 19 01:20 webcam-1589847302.jpg
-rw-r--r-- 1 root root  42K May 19 01:20 webcam-1589847481.jpg
-rw-r--r-- 1 root root  43K May 19 01:30 webcam-1589847662.jpg
-rw-r--r-- 1 root root  43K May 19 01:30 webcam-1589847841.jpg
-rw-r--r-- 1 root root  44K May 19 01:30 webcam-1589848021.jpg
-rw-r--r-- 1 root root  44K May 19 01:30 webcam-1589848202.jpg
-rw-r--r-- 1 root root  41K May 19 01:40 webcam-1589848381.jpg
-rw-r--r-- 1 root root  44K May 19 01:40 webcam-1589848561.jpg
-rw-r--r-- 1 root root  44K May 19 01:40 webcam-1589848741.jpg
-rw-r--r-- 1 root root  45K May 19 01:50 webcam-1589848921.jpg
-rw-r--r-- 1 root root  45K May 19 01:50 webcam-1589849101.jpg
-rw-r--r-- 1 root root  43K May 19 01:50 webcam-1589849282.jpg
-rw-r--r-- 1 root root  43K May 19 02:00 webcam-1589849461.jpg
-rw-r--r-- 1 root root  43K May 19 02:00 webcam-1589849641.jpg
-rw-r--r-- 1 root root  41K May 19 02:00 webcam-1589849822.jpg
-rw-r--r-- 1 root root  41K May 19 02:00 webcam-1589850001.jpg
-rw-r--r-- 1 root root  42K May 19 02:10 webcam-1589850181.jpg
-rw-r--r-- 1 root root  43K May 19 02:10 webcam-1589850362.jpg
-rw-r--r-- 1 root root  43K May 19 02:10 webcam-1589850541.jpg
-rw-r--r-- 1 root root  43K May 19 02:20 webcam-1589850722.jpg
-rw-r--r-- 1 root root  43K May 19 02:20 webcam-1589850901.jpg
-rw-r--r-- 1 root root  62K May 19 02:20 webcam-1589851081.jpg
-rw-r--r-- 1 root root  76K May 19 02:30 webcam-1589851262.jpg
-rw-r--r-- 1 root root  76K May 19 02:30 webcam-1589851441.jpg
-rw-r--r-- 1 root root  52K May 19 02:30 webcam-1589851621.jpg
-rw-r--r-- 1 root root  52K May 19 02:30 webcam-1589851802.jpg
-rw-r--r-- 1 root root  47K May 19 02:40 webcam-1589851981.jpg
-rw-r--r-- 1 root root  49K May 19 02:40 webcam-1589852161.jpg
-rw-r--r-- 1 root root  49K May 19 02:40 webcam-1589852342.jpg
-rw-r--r-- 1 root root  66K May 19 02:50 webcam-1589852521.jpg
-rw-r--r-- 1 root root  66K May 19 02:50 webcam-1589852702.jpg
-rw-r--r-- 1 root root 169K May 19 02:50 webcam-1589852881.jpg
-rw-r--r-- 1 root root 207K May 19 03:00 webcam-1589853061.jpg
-rw-r--r-- 1 root root 207K May 19 03:00 webcam-1589853242.jpg
-rw-r--r-- 1 root root 271K May 19 03:00 webcam-1589853421.jpg
-rw-r--r-- 1 root root 271K May 19 03:00 webcam-1589853601.jpg
-rw-r--r-- 1 root root 389K May 19 03:10 webcam-1589853782.jpg
-rw-r--r-- 1 root root 415K May 19 03:10 webcam-1589853961.jpg
-rw-r--r-- 1 root root 415K May 19 03:10 webcam-1589854141.jpg
-rw-r--r-- 1 root root 418K May 19 03:20 webcam-1589854321.jpg
-rw-r--r-- 1 root root 418K May 19 03:20 webcam-1589854501.jpg
-rw-r--r-- 1 root root 417K May 19 03:20 webcam-1589854682.jpg
-rw-r--r-- 1 root root 414K May 19 03:30 webcam-1589854861.jpg
-rw-r--r-- 1 root root 414K May 19 03:30 webcam-1589855041.jpg
-rw-r--r-- 1 root root 418K May 19 03:30 webcam-1589855221.jpg
-rw-r--r-- 1 root root 418K May 19 03:30 webcam-1589855401.jpg
-rw-r--r-- 1 root root 423K May 19 03:40 webcam-1589855581.jpg
-rw-r--r-- 1 root root 426K May 19 03:40 webcam-1589855761.jpg
-rw-r--r-- 1 root root 426K May 19 03:40 webcam-1589855942.jpg
-rw-r--r-- 1 root root 416K May 19 03:50 webcam-1589856121.jpg
-rw-r--r-- 1 root root 416K May 19 03:50 webcam-1589856301.jpg
-rw-r--r-- 1 root root 383K May 19 03:50 webcam-1589856481.jpg
-rw-r--r-- 1 root root 305K May 19 04:16 webcam-1589856661.jpg
-rw-r--r-- 1 root root 305K May 19 04:16 webcam-1589856842.jpg
-rw-r--r-- 1 root root 104K May 19 04:16 webcam-1589857021.jpg
-rw-r--r-- 1 root root 104K May 19 04:16 webcam-1589857201.jpg
-rw-r--r-- 1 root root 104K May 19 04:16 webcam-1589857381.jpg
-rw-r--r-- 1 root root 104K May 19 04:16 webcam-1589857562.jpg
-rw-r--r-- 1 root root 104K May 19 04:16 webcam-1589857741.jpg
-rw-r--r-- 1 root root 227K May 19 04:16 webcam-1589857922.jpg
-rw-r--r-- 1 root root 254K May 19 04:16 webcam-1589858101.jpg
 

 

Share this post


Link to post
Share on other sites

OK - so my wide angle lens has arrived but remembering how much of a pain it was trying to focus it whilst on a ladder and using a laptop to run a capture and then view a still on a remote drive I decided to relook at streaming, I couldn't get it to work last time but success!

I used the details from the following page to set up a UV4L which gives me an additional web page with a 'real time' stream of the camera which looks like it happily co-exists with the all-sky camera stuff.

https://medium.com/home-wireless/headless-streaming-video-with-the-raspberry-pi-zero-w-and-raspberry-pi-camera-38bef1968e1

Quote

Install UV4L and WebRTC
Recently (April 2018) the folks at linux-projects have written a raspberry pi driver that streams all by itself. I haven’t extensively tested it but I have tried it out and it seems to work. It’s painless install (nothing to compile) and supports h264 as well as a myriad of other formats. There is even documentation (gasp). Installation instructions are here. Or, if you’re running Raspbian Stretch: start by adding the linux-projects repo (requires a key and a line added to /etc/apt/sources.list).
 

curl http://www.linux-projects.org/listing/uv4l_repo/lpkey.asc | sudo apt-key add -
echo 'deb http://www.linux-projects.org/listing/uv4l_repo/raspbian/stretch stretch main' | sudo tee -a /etc/apt/sources.list

Next, update the source holdings and install the uv4l stuff:
 

sudo apt-get update 
sudo apt-get install uv4l uv4l-raspicam uv4l-raspicam-extras

 

If you want simple access and a GUI add the WebRTC shell.


sudo apt-get install uv4l-webrtc

Then reboot the PI and browse to the uv4l server at http://raspberryip:8080 from your desktop. The video stream is at http://raspberryip:8080/stream

The author also recommends increasing the GPU memory allocation to 256 (which you can do via raspi-config under the "7 Advanced Options" menu, "A3 Memory Split"

So - I think I'll fit the wide angle lens whilst the BBQ is getting ready - plenty of could to focus on tonight (unfortunately!) 

Share this post


Link to post
Share on other sites

So the live video stream worked well and the new lens is fitted. 

image.png.b82a0bbac1f286a109635bd02325e4c9.png

 

I've also tested the modification to the code for getting the text banner on to the video, it was quite simple, just alter copy copypic.sh to copy the buffer.jpg rather than the webcam.jpg  I had a look through the other scripts but I think the only copy of the picture occurs in the copypic.sh script.  I might experiment with bringing the temperature in from my weather station now I have this banner text :) 

There's a new issue I have come across though, sunwait is reporting --:-- Midnight sun and it seems to have broken the suntimes page 

Quote

pi@raspberrypi:/home/allsky $ ./webcam
raspistill not running
D /usr/bin/raspistill -q 100 -ISO auto -awb greyworld -n -ex auto -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)    :  03:00 -00:10
Nautical Rise (Real)                        :  03:10
Civil Rise (6 degrees below horizon)        :  04:01 -00:10
Civil Rise (Real)                           :  04:11
CAMERA switches from Night to Day           :  04:03 -00:08
VIDEO switches from Night to Day            :  04:08 -00:03
Sunrise (0 degrees below horizon)           :  04:53 00:00
Sunrise (Real)                              :  04:53
Sunset (0 degrees below horizon)            :  20:56 00:00
Sunset (Real)                               :  20:56
Civil Set (6 degrees below horizon)         :  21:37 -00:00
Civil Set (Real)                            :  21:37
CAMERA switches from Day to Night           :  21:46 -00:09
VIDEO switches from Day to Night            :  21:49 -00:12
Nautical Set (12 degrees below horizon)     :  22:39 -00:00
Nautical Set (Real)                         :  22:39
Astronomical Set (18 degrees below horizon) :  --:-- (Midnight sun) -00:00
Astronomical Set (Real)                     :  --:-- (Midnight sun)
Sat 23 May 11:52:31 BST 2020
 

image.thumb.png.f78cc700871b2e6f9c31625c7bc10a73.png

  • Like 2

Share this post


Link to post
Share on other sites

I've managed to plumb my weather station in to the allsky camera now, so outdoor and wind speed added to banner text, it picks up the mqtt messages from the weather station, stores them to a file and uses that feed the banner text.  The mqtt messages arrive separately and at different times, so getting them direct from the php isn't an option, however at the moment they are just a long file with a new value appended on the bottom, I'll have to do some cron scripting to get a figure as a single line in a file I think..  I might have to fork your github in order to keep track of personal modifications I have made!  The new lens is performing better than the other one I tested it with. 

 

Really happy with this now, must resist the temptation to customise it too much! Thanks Pete!

image.png.8696790f89bd94b382b3a8ea6cba744b.png

  • Like 2

Share this post


Link to post
Share on other sites
Posted (edited)

@Jason, 

I am going to try Install UV4L and WebRTC when I get some free time.  That was a nice find.  Thanks.  

I like the weather station integration.  Editing the webcam.php is just fiddly, not hard and it looks perfect.

It looks as if you are making real progress here.  I too have been testing.  As I said a few days ago, I have increased the gap between switching the camera from night to day and the start of the night video to 6 minutes.  Combined with a 5 minute shot interval  this has performed flawlessly the last 3 nights.    I reccomend that you try these timing as well.  

# Shifts camera mode time at Day / Evening Twilight
121 # For the dusk  camera mode
122 #     HH:MM Not used anymore
123 SSet=-00:00 # Advance or delay when the camera switches from night to day.
124 SSetP=00:00 # Camera switch time.  Needs to be at least 1 minute EARLIER than the Video switch time.
125 SSetVid=-00:00 # Offset advance or delay for the Video Day / Night switch.
126
127 # Shifts camera mode time at Evening Twilight / NIght
128 # For the night camera mode
129 #       HH:MM
130 twiSet=-00:00 # Advance or delay when the camera switches from day to night.
131 twiSetP=-00:09 # Camera switch time.  Needs to be at least 1 minute EARLIER than the Video switch time.
132 twiSetVid=-00:15 # Offset advance or delay for the Video Day / Night switch.
133
134 # Number of minutes  between movie frame concatenation.  Default here is 10 [minutes]
135 concat=10
136
137 # Minutes between movie image copies.  Default is 3.
138 # raspistill can take up to 1 minute 45 seconds to process a night time image.
139 cap=3
140
141 # Interval for raspistill to take shots.  Night time needs to be longer since raspistill needs longer at night to complete.
142 shotD=2 # Daytime shot interval.  Default is 2 [minutes]
143 shotN=5 # Night time shot interval.  It can take raspistill up to 1 minute 45 seconds to process a night time image.  Default is 4

I also edited /home/allsky/pics/newnightmovei.sh and removed the comment s at lines 39 and 40 that perform the 2nd check for the presence of a webcam-*jpg file with which to start a new night video.  Last nigh this worked well too.  I really want to let this run for a few days to make sure but felt that I needed to continue to contribute to my own project.

35 # Check the essential presence of raspistill webcam-*.jpg file(s).  If none, wait for one to be created.
36 while [ ! -f /home/allsky/pics/webcam-*.jpg  ]; do sleep 1; done
37 /bin/sleep 5
38 # Do it again just in case concatxxx ran meanwhile.
39 while [ ! -f /home/allsky/pics/webcam-*.jpg  ]; do sleep 1; done
40 /bin/sleep 5

Pete

Edited by Pete6

Share this post


Link to post
Share on other sites

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. 

 

Share this post


Link to post
Share on other sites

Good.  I am glad it is working now.  I thought you would have done the mods but I really wanted to publish my findings so that in the future people do not have to go down the same hole.  It is clear that the Pi Zero W has a lot less computing power than the Pi 4 but it also generates a lot less heat and is far, far cheaper so you can build my little box for less than £40.  Of course it has to work and perhaps I was a little premature in publishing.  I thought it worked.  Mine did, well pretty much...  It was just a few tweaks to the Pi Zero W version that were needed.  

I shall update the README.MD to reflect the new settings on Github and it should be good to go.

You have given me a lot of help so thank you Jason.  I could have had a far worse early implementer than you.  Please let me know how it works in the longer term.

Pete

  • Thanks 1

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.