Over the years I’ve tinkered with having a live webcam taking a picture of the weather conditions in my local area. Recently I rediscovered an old Logitech E3500 webcam that I figured would serve the purpose quite well. There’s a limitation with USB on a Raspberry Pi, some things will work as expected without any trouble and some things not so well. It turns out that the E3500 camera suffers from over exposure and the sensor simply gives you a blank image! at first I figured is was a v4l2 driver issue but the webcam behaves just fine on my notebook (both in Linux & Windows) so some further experimenting with things simply didn’t work out to well, so basically provided there wasn’t too much light or too much glare you’d get a good image captured using fswebcam and when things weren’t you’d just have a plain black image being produced. So I decided to abandon the idea of using the E3500 and turned to the PiNoIR camera for raspberry pi. this camera although lacking a UV filter produces a good picture. I decided to place the included blue filter over the lens to see if that makes much difference with the captured image.

This is the PiNoIR camera facing south and upwards, yes it’s and overcast day with patches of drizzle! anyway you’ll notice that there’s some foliage from a plant on the next door neighbours property that looks a little strange that’s because you’re seeing the effects of photosynthesis and can only be seen in the IR band of light (normally filtered out) So that picture is acceptable so I’ve started uploading and image every 5 minutes.

This is a capture done with the Logitech E3500, mid morning and facing south-east with yet another overcast day! but it wasn’t long after this picture and the remainder of the day was just a black image. so it was a FAIL!

The Raspberry Pi is resting on the window seal with a ball of Blu-Tack preventing it from moving or falling off. One of the problems with pointing cameras outside in a suburban area is making sure that you don’t have it facing directly into your neighbours window (or similar)
The Raspberry Pi is using Raspbian Jessie Lite and this is missing ftp so that will need to be installed before you can start to sending your pictures. I have the following two scripts running from crontab, pinoir.sh captures the image and saves it locally in /tmp Then wuftp.sh uploads the image to weather underground via ftp. The “MAILTO=” prevents crontab from flooding you with an email for every time its run! However there’s no mail server on the raspberry pi but if you were going to use something like on a standard Debian install you’ll soon like that “MAILTO=” trick! also the “>/dev/null 2>&1” should also prevent anything from triggering an email as it’s piping all stdout to the bit bucket of /dev/null
Crontab
# m h dom mon dow command
MAILTO=""
14,29,44,59 * * * * /usr/local/bin/pinoir.sh >/dev/null 2>&1
*/15 * * * * /usr/local/bin/wuftp.sh >/dev/null 2>&1
wuftp.sh
#!/bin/bash
HOST='webcam.wunderground.com'
USER='user'
PASSWD='password'
FILE='/tmp/pinoir.jpg'
/usr/bin/ftp -n -v $HOST << END_SCRIPT
user $USER $PASSWD
put $FILE image.jpg
quit
END_SCRIPT
exit 0
pinoir.sh
#bin/bash
raspistill -w 640 -h 480 -q 100 -x -dt -bm -n -o /tmp/pinoir.jpg
Things to do… put an overlay on the captured image with a time/date stamp or similar and possibly get the standard raspberry pi camera so that the images are true colour instead of the slightly washed out type they currently are. 😉
Comments
2 responses to “Weather Underground Webcam”
great explanation and simple solution. I’ve looked at several other explanations and they all make a big mess out of something that should be easy. Thanks for posting. It helped a noob
I’ve since swapped the PiNoIR camera module with the standard PiCam module. So now the images are a better representation of the view!
Glad you got some help on the topic 🙂