My Easter project: Setting up a webcam for opplevsula.no

So I have had this idea floating about for several years without it getting realized, basically I wanted to get a webcam set up for the website opplevsula.no that I run, it is a beautiful place and it gives the website a nice piece of dynamic content and grabs a few more regular visitors.

Anyways sometimes you got to just leave an idea floating about for so long that the people in control of the money thinks they thought it out themselves, this is what happened recently so I ordered a Dlink dcs-7010l, it looked pretty sturdy and out on this island sturdy is a minimum when it comes to leaving things outside.

As I was lucky enough to get the camera through the mail and to the store in time before the Easter holidays, well sort-of as the grocery store and post office closed before the ferry I got out here with arrived. Good thing the guy that runs the store also runs the pub (yeah its a that small place) I got to pick up the camera and a pint to start the holiday with later in the evening.

Getting the camera itself to life was pretty simple as soon as you get around the immense retardedness that the dlink installation tools involve, for some reason the cd with all the software and super-simple and completely unnecessary configuration tool for the camera would only let me install some surveilance camera rubbish, if I clicked the link to set up the actual camera on the menu I just got nagged with that I needed a PDF reader, something I had, good thing it was simple to dig out the executable to get this configuration tool fired up without needing to navigate stupid menus.

As soon as I got the camera up and running I had to poke about to find a way to get a still image from the camera over on the website, a video feed was out of the question as the broadband connection out here is pretty dodgy at times and if the site for some reason got a lot of visitors they’d get horrendously laggy video and whoever is at my familys summerhouse where the camera is mounted would get horrendously slow internet.

I quite quickly found a function on the camera that simply grabs a still from the video feed and stores it as a .jpg so now I just had to get the camera accessible from the internet and sort out some way to download this image at some interval. But first….. wiring, I had to wire up at least 20m of Ethernet cable to get from the router to a part of the house with a nice view and no obstructions, then I did some horribly dodgy drilling to get the wires through the wall, this involved me standing on top of a curtain ladder on top of some really sketchy scaffolding, but I am here so it did clearly go well.

To get the camera viewable from a website I set up a dynamic dns directing to the IP address of the summer house and then I set up a little script that I run as a cronjob on one of my servers to download the image from the camera once every minute as it is right now.

The script looks like this:

#!/bin/bash

#Address 
address="addresstomycamera.foo"

#Username for webserver to grab file from
username=foo

#Password to access server to grab file from
password=bar

#Filename to save output as
file=~/webcam.jpg

#Downloads file
wget --http-user=$username --http-passwd=$password --output-document=$file $address

Basically what the script does is to simply download the image from the webcam by using wget using various options to rename this image and user authentication, Later I will add some more functionality to this script such as checking that the image actually got downloaded.

The image below is a live image from the webcam, well at least somewhat live it currently updates once a minute and bad connectivity might result in longer delays, hope you enjoy the view!

webcamera image

webcamera image

Leave a Reply