So, I got me a new Samsung phone because my old phone, a HTC Wildfire is rather slow, especially when it comes to websurfing. It also has low crap resolution. I am much happier with the new phone. So, what to do with the old phone? It’s still a small computer with a camera and touchscreen that should be doing something instead of gathering dust in a drawer.
One of the things I thought of was a webcam for my turtle tank. It currently houses two (I think female) red cheeked mud turtles, kinosternon cruentatum. I wanted to observe how often one of turtles gets out of the water to bask and what the general activity in the tank is.
I rooted the phone since I thought it would be handy to have root anyway and installed Cyanogenmod V7, an alternative Android version. This custom ROM does not include the Google Play store to install stuff on Google Play so I had to manually flash it. I am quite unexperienced rooting Android phones and installing custom software but I got it working eventually.
Next I installed IP Webcam, a nice free webcam app. Since it has a webinterface for remote access it is easily accessible with any computer. Being http-based it’s very easy to grab the images over the wireless LAN that the phone is on using a bash script:
#!/bin/sh wget http://192.168.64.4:8080/shot.jpg FILEDATE=$(date) montage -geometry +0+0 -background white -label "$FILEDATE" ~/shot.jpg /var/www/meuk/schildpadcam.jpg mv ~/shot.jpg /storage/plaatjesenfotoos/schildpadcam_arch/"$(date +%d%m%y%H%M)".jpg
This script uses wget to fetch the most recent video frame (the app is capturing video all the time), uses the imagemagick tool montage to visually timestamp the image and outputs a new picture in a publicly accessible folder on my server. Finally, the most recently downloaded picture is renamed with a timestamp in the filename and moved to a archive directory on the server. Continue reading