The Aquarium Webcam



Image should refresh every 30 seconds

19/04/12 Current status is offline because of a suspected hardware failure with the webcam.
21/06/12 Webcam decommissioned.


I'm not a good traveller and I don't much like going away on holidays which is unfortunate because I have one of those wives who has crazy ideas about camping excursions.

Yes, it seems the woods is not just a place for bears (or the Pope) to take a shit, as my wife believes that we should leave our nice warm house which happens to be lavishly equipped with 21st Century comforts such as the Playstation, big telly, coffee machine and flushing toilet and instead go foraging for nuts & berries in the wild and attempt to sleep under some damp, cold canvas under the constant threat of being eaten alive by packs of rabid wolves or vultures or polar bears or *something*.

So every now and then I have to bolt something that looks like Mr Spock's coffin to the roof of my Volvo, fill it with pots, pans, gas bottles & loo roll and veer off the beaten track into shit-kicking redneck Deliverance Blair Witch country (i.e. Tewkesbury).

SpocksCoffin

Yeah, Wrath of Khan was a good film.
 
 

Now, that's all well and good but when I'm trying to survive the evils of Mother Nature I do worry about how my fishy friends are getting on back at home. I mean, what if there's a problem with the water? What if there's a problem with the filter? What if their happy aquarium home EXPLODES in a spectacular fireball of napalm death??

The only sensible way to put my mind at ease was to install a webcam so that I could keep a beady eye on the subaquatic to-ings and fro-ings of my piscine pals via my smartphone - assuming the cowshit riddled field I find myself trying to sleep in like some kind of filthy vagrant has fringe access to a crappy dial-up-speed data signal for my trusty Samsung to grab a hold of.

So here it is. Or rather, up there it is, at the top of this page.

 

What's in the tank?
If you're an aquanerd like me, you will want to keep an eye out for the following so you can tick it off in your Ladybird "Fish Spotting Jotter for Under Twelve's"...

Species:  Colour:  Score:  Spotability Factor:
Tinfoil Barb Silver 1 point Easy
Torpedo Barb Silver/orange/black 1 point Piece o' piss
Molly Black 2 points Pretty good
Swordtail Orange 2 points Not to shabby
Platy* Silver/blue 3 points I still like the odds
Black Widow Tetra Silver/black 3 points 's in there somewhere
Siamese Fighting Fish Purple/red 4 points I think I saw it...
Algae Shrimp Brown 100 points Fat chance
Khuli Loach Dark brown 1000000 points Don't bother

*Forget it. Has since been eaten by a Tinfoil barb.

Hours of operation (UK time).
The camera should be up 24/7 unless I accidentally kick the plug out. The main tank illumination is active between 15:00 and 22:00 weekdays while the moonlight I built kicks in overnight between 22:00 and 10:00 to give things a strange blue glow. The colour changing light is also active at this time and is located in the lower right corner. Between 10:00 and 15:00 there is no artificial lighting, only natural daylight. At weekends times may vary. Between 02/04/12 and 12/04/12 I will be curbing the lighting to try and kill off an algae problem.

 

Exciting events!
Cleaning tends to happen on Mondays between 19:30 and 21:00 while the wife tries to watch Coronation Street. My bucket-slopping interrupts her viewing which amuses me no end. Feeding time happens when I find the energy to drag my ass off the sofa and is generally between 17:00 and 21:00 every night. At various times throughout the day two bubble curtains activate and may (or may not) be visible depending on the lighting conditions.


Construction.

For several years I've had a webcam perched upon my TV aerial uploading a relatively low-res image every so often. I'm using the fswebcam daemon to do the legwork for that particular jobette so when the time came to add a second camera to my web server I figured I'd use fswebcam again. As fswebcam only supports one camera, I'm having to  run two instances of it. The original daemon picks up an image from the camera at /dev/video1 (the roof-cam) while a new daemon grabs a snap from /dev/video0 (the Logitech Quickcam used for the aquarium). The camera on the roof doesn't play well with Linux and locks up a lot which required me to build a little reset circuit back in 2008. The roof cam is also a low res picture because of the USB extenders I'm using to get from my web server to the roof. There are no such issues with the new aquarium camera as the Quickcam is Linux friendly and the USB run is only about three metres because the web server happens to be located in the adjacent room to the fish tank.

I already had a hole drilled through the wall behind the tank allowing two air-hoses to run to a pump in the adjacent room so I used this same hole to run my USB cable through the wall. I used black silicone sealant to stick a rubber grommet around the camera lens and then Unibond No More Nails to glue the grommet to the tank glass. The grommet has been trimmed down on the left side so that the camera angles slightly towards the right in order to offset the curved front of the glass on my Juwel Trigon 190 tank. Without it the camera pointed too much towards the side wall of the tank and cut down the chances of viewing the full-on fish fun-ness although the viewing angle still only covers about half the water volume. The final modification was a small square of black electrical insulation tape stuck to the tank glass on the right of the camera. Without it, the curved tank glass caused a physics defying reflection of the living room to appear on the right of the image which would have been most unfortunate for anyone who happened to have checked in to view some fishy frolics and instead caught a distorted reflection of me and/or the wife parading around the living room with no clothes on (naked parade Thursday's have helped to keep our marriage solid for the past thirteen years).


P3110041


Technical beef. 
The config for this fswebcam daemon is as follows:

device /dev/video0
input 0
loop 1
skip 3
background
resolution 800x600
top-banner
font /usr/share/fonts/truetype/msttcorefonts/arial.ttf
title "www.r3uk.com | David's aquarium live feed"
timestamp "%d-%m-%Y %H:%M:%S (%Z)"
jpeg 95
save /[path]/fishcam.jpg

My original webcam (up on the roof) had been set up at /dev/video0 with this new camera at /dev/video1 however I had to swap them over because when my reset circuit kicked the unreliable roof camera every couple of hours it resulted in my shiny new fishcam switching to /dev/video0 which cocked things right up. It is possible to tie a particular video source to an input however. First, you need the hardware ID and vendor ID. With two webcams on the USB bus I could find this with the lsusb command which returned the following output:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 003: ID 046d:0991 Logitech, Inc. QuickCam Pro for Notebooks
Bus 001 Device 004: ID 0bda:0111 Realtek Semiconductor Corp. Card Reader
Bus 002 Device 010: ID 046d:08ce Logitech, Inc. QuickCam Pro 5000

My two webcams are listed with the vendor ID of 046d and product ID of 0991 for the fishcam and 08ce for the roofcam. Armed with this, rules can be set up by creating or editing a particular file using this command...

sudo nano /etc/udev/rules.d/25-name-video-devices.rules

...and entering the following nonsense...

SUBSYSTEM=="video4linux", BUS=="usb", SYSFS{idVendor}=="046d", SYSFS{idProduct}=="08ce", NAME="video1"
SUBSYSTEM=="video4linux", BUS=="usb", SYSFS{idVendor}=="046d", SYSFS{idProduct}=="0991", NAME="video0"


This ensures that the loss of one camera does not affect the video designation of the other.


Update 21/06/12
I have now moved this site to a hosted platform so won't be looking to resurrect this webcam. It did the job when I needed it, but the camera suffered a fault in April and I didn't bother to fix it. Now that the webserver is hosted externally I'm unable to plug a replacement camera back in.

Project status: Decommissioned