Husqvarna Automower 305 – On board camera

Automower 305Latest addition to my home is a robotic lawnmower. Mowing the lawn was something that I didn’t do often enough. Sporadic mowing with a loud gasoline powered lawnmower and lots of cut grass that I had no idea where to put it.

Husqvarna had a solution to this for a few years now. The decision was made. Newly released Automower 305, which covers up to 500 square meters of lawn is currently sitting in my back yard waiting for charging cycle to complete. Then it’s mowing time again. Over and over and over again, until I tell it to stop.

Automower really gets the job done and after a week of usage, I have no real complaints. However, a gadget like this was just screaming “I need a camera!” and I had to agree.

Husqvarna Automower 305

Control panel cover

Automower 305 On board cam ingredients

  • Husqvarna Automower 305
  • Asus EeePC netbook, running Ubuntu, pink color preferred :>
  • USB Webcam
  • Wireless connection around your house
  • Duct tape
  • Cardboard

The plan was simple, get a piece of cardboard, tape it on the automower. Then, get a netbook and tape it on the cardboard. At last, tape a webcam on top of the netbook. And this is precisely what I did. Nothing too hardcore, just a netbook with a webcam. Far from perfect, this setup had a lot of drawbacks and it certainly couldn’t stay permanent.

Support software

Relatively simple tasks usually take most of the time to get done. I wanted to grab a one frame every second from thewebcam. ¬†Easier said than done. When webcam is initialized it takes almost three seconds to set all the parameters (aperture, framerate, white balance, color correction, …). I had to turn on the camera, leave it on and take a snapshot every second. Gstreamer was my first choice. Unfortunately I wasn’t able to figure out how to force it to record at 1fps and write output to sequential files. It can write sequential jpegs with no problems, but even when I told it that frame rate is 1fps it was recording 30 frames per second, all frames the same.

Recording test

Recording test on netbook

Ffmpeg was my next choice. Output wasn’t all that great, but I figured it was good enough for the first run. Beside that, ffmpeg is written so silly that it actually expects input on stdin and dumps all the output to stderr even if it is not an actual error. Oh and let’s not forget about their mailing list archives which are, well, gone. In the end, this is the bash script that I used to capture the images:

#!/bin/bash
 
if [ -z "${1}" ]; then
  echo "Usage:"
  echo "  `basename ${0}` "
else
  ffmpeg -y -f video4linux2 -s 800x600 -i /dev/video0 -r 1 -f image2 "${1}_%06d.jpg"   /tmp/capture.log
fi

Camera was capturing and I was happy. Then I though, why not send last recorded file to a web server and create a semi-live stream? First, I needed a batch file that will send the last file to a web server and then an index file that will display that. Nothing too complicated.

#!/bin/bash
 
while true; do
scp -q `ls -t | head -1` lubica.net:/srv/www/lubica.net/mow/current.jpg
sleep 1
done

In short: grab the first thing that is returned by ls -t and copy it on the web server. Then wait one second and do repeat the process. No waiting and synchronizing and other more complicated stuff. Crude and effective for a silly thing like this. Index file on the web server was even simpler. Meta refresh after one second and an img tag.

That’s all folks! Well, almost.

Problems

No automation. If I want to capture images, I have to duct tape everything together, ssh to the netbook and run both scripts manually. When automower is recharging, I have to stop the capture and restart it when mower is on the move again. When netbook runs out of battery the whole rig dies. Of course, mower is not affected.

Not waterproof. I’d like to keep this setup around all the time. Automower is waterproof and it operates during the rain. Netbook will die a horrible death if I leave it outside. ;)

Unaccessible top panel. When netbook is taped on the mower I can’t open mower’s top panel. This is rather clumsy because access is required for tinkering with mower controls and entering security PIN.

No power for netbook. I didn’t dare to open the mower to check if it could provide enough power to recharge notebook while it’s mounted. Besides, both power supplies are quite different and this would be a little more than an Easter holiday project.

The next step is taking care of live streaming, not just silly one second captures that produce goofy stop motion videos. :) For now, you can occasionally see the image feed on this page. However, I have to setup everything and turn it on, so you will need some luck to catch it in action. :)

Music in the video: Handheld Hero by Wizwars.


  • On April 25, 2011 at 13:58 Zareldyn said:

    Good job ;-)
    I thought the bash scripts were more complicated, but with the power of Linux commands I see it’s quite simple.
    Poor mower, its life is so boring… now I wait for a non-fast version video with something cool, like an epic fight against a cat for example (if you have one) ^^

    Reply
  • [...] Live Lawn Cam! [...]

    Reply
  • On April 25, 2011 at 19:05 Bryan Salazar said:

    It’s a good start, but I think your are miss using the netbook processing power and hardware, with some electronics you can add webcam capability, even bought a wireless cam or something.

    With more advanced electronics you can make a little embeded computer to run a program an comunicate with the webcam.

    Reply
    • Processing power of the notebook is down to zero when batteries run out. I’m planing on doing a live stream, but all in due time. :) Since this mower is a bit pricey I didn’t decide to hack it right away. :)

      Reply
  • Hey guys!

    Here we are … ;)
    The same idea, some better cams and an own homepage …

    Will be ready and online in autum 2011!

    Nils

    Reply
  • … it’s online now! Cams will com in one week!

    Nils

    Reply