Web Cam Madness

Sharing my data with Weather Underground includes sharing my Webcam images for them to display alongside my weather data.  Recently I checked on their site to verify the Webcam images were being uploaded and kept seeing that my camera was disabled.  They were supposed to be grabbing the image using a URL I supplied them with.  I would check the URL I had given them for my camera image to make sure it was working.  Since it is the same URL used to display the image on my own pages I felt pretty confident that the image was available.  But every time I enabled my camera on their Web site it would become disabled within a few hours to a day.

In order to remedy this problem I chose to change from having them retrieve my camera image to me uploading it via FTP.  At least that way I would have some degree of control over when the images were being delivered.  That led to a couple of issues I needed to address.  The first was that the Webcam software I was using, Yawcam, could only do FTP to one site.  I was already using that capability to upload images to my own Web site.  That required that I create an FTP script to upload the image to Weather Underground.  After creating the script, I set Yawcam to save off the current Webcam image to a folder on my server’s hard drive.  Then I set up Windows task scheduler to run the FTP script every two minutes.  Everything looked good so I left it to run.

When I checked back later that day I noticed that the image had stopped changing on Weather Underground.  I checked my logs and saw that the FTP script was still working.  Checking my server I discovered that Yawcam had stopped updating the still image it was supposed to be capturing from the webcam.  The image being FTP’d to my Web site was fine, and the streaming video was also fine.  I restarted Yawcam and monitored the image being saved.  After several hours it stopped updating again.  This went on for the next few hours before I decided on a different approach to work around this apparent bug in Yawcam.

Yawcam has a feature where it can act as a Web server and serve up the latest image from the Webcam as a JPEG file.  I enabled this feature and set out to find a way to retrieve the image from Yawcam directly.  I ended up writing a Powershell script to retrieve the image and FTP it to the Weather Underground site.  I let it run for a day to make sure it was stable.  The image updated correctly and I was satisfied with how the script was running.

Now I started to get carried away with myself, like I tend to do.  I decided it would be nice to have a time-lapse video of the day’s webcam images.  I modified the script to create a folder using the date and save the images in that folder using a sequence number (the count of images in the folder + 1).  That permitted me to use ffmpeg to build an MPEG video of the images.  I set the script to run once per minute and save off the images in sequence.  I then wrote another script that runs ffmpeg to create the time lapse video and set it to run in the middle of the night on yesterday’s image sequence.  Finally, I had the script FTP the MPEG file it had just created to my weather Web site.  A link on my Web page permits viewing that video.  The Web site only retains one day of time lapse video.  The nightly upload overwrites the video from the prior day.  Everything appears to be running smoothly.  I still plan to write a script to clean up the sequence of images off of my hard drive after an expiration period has passed.

I ordered a new humidity sensor, as mine appears to be suspect.  I probably won’t have an opportunity to install the sensor chip on the humidity circuit board until the weather warms up a bit.  Always something to do.  I also have been preparing a Raspberry Pi to use as the new station computer.  That will come when I get some free time and motivation, or my current station computer quits working for me.  We’ll see which occurs first.