How The Camera Works

There is an Axis IP camera mounted under the soffit on the southeast corner of the cottage.
This camera has an embedded Linux server. It also has a small heater and blower because it is designed for outdoor use.
Every five minutes a photo is taken and sent via ftp to the website server.
When the website is browsed, the php script finds the most recent picture and displays it.
Also, the script records the IP address of the visitor.
So far, there have been
1267468 visits to this website.

However, there is a lot more to it than that and there have been some problems along the way.

The Axis IP cameras do not support sftp (secure ftp). This presents a problem with almost every modern ftp server and presents possible security issues. Thankfully, the Axis camera is running embedded Linux and this makes troubleshooting and connecting much easier.

Because of the differences between various ftp protocols, the Axis ftp client was occasionally hanging mid-datastream. This is why the pictures have, in the past, often seemed to be out of date (much older than five minutes). To address the problem, I installed an SD memory card in the camera on one very cold mid-November trip to the Bay. This allows the camera to save images on it's own local filesystem. However, in the latest release of the Axis firmware, there is no possibility to save JPEG files to the memory card (it is possible, however, to stream video to the card). Therefore, for JPEG images, the camera connects to it's own local loopback address and ftps the images to itself every five minutes.

The images reside on the SD card until an external Java program, which is running on a remote Tomcat server (hosted by yours truly), connects to the camera's ftp server and transfers the images to the web server. I have used Java to control the transferring of files because of it's excellent ftp support and the ability to connect to both the cameras ftp server and the website ftp server simultaneously.
The program is running on a Linux server because the cron daemon can spawn the Java program every five minutes, a frequency that pure Windows is not capable of doing, and with a reliablity of almost 100%. As the Java program reads each file from the camera, it uploads it to the webserver and catalogues the image in a database. After each write, the cameras file is deleted.

The benefits of storing the images on the SD card are twofold. First, there is improved reliability of the transmission to the remote servers because if, for some reason, transmission is interrupted then the file stays on the SD card until the file transfer Java program confirms correct receipt of the file. Second, and as important, if there is a persistent communications failure with the router then the images will continue to be saved and safely stored until the Java servlet can re-connect and retrieve them. This form of handshaking means that every picture that is taken is retrieved sooner or later.

By the way, the IP camera, ethernet switch, and WAN router are all on a UPS capable of keeping the system alive during power failures as long as two or three days.

Some other facts in case you are looking at doing this yourself:
1. I recommend an uninterruptable power supply (UPS) just in case there is a power outage.
2. You will need a PoE switch for the camera or a PoE injector (the camera is, you guessed it, PoE!).
3. You will have to arrange with your telco to get a public IP address. The one they give you without asking is on their internal subnet and cannot be accessed from outside of their network.
4. A dynamic IP address is okay as long as you use a dynamic DNS service. The Roger's router I have works well with dyndns.org. A static IP address would make this unnecessary but it costs a bit more.
5. For security reasons, I have used a non-standard port for ftp on the public side of the router. It is mapped to the standard ftp port of the IP camera.
6. Also, you will have to select a public side TCP port and map it in the NAT (network address translation) table in your wireless router to the http port (80) of your IP camera. If you do not, then your attempts to access the http server in the camera will be intercepted by the http server in the wireless router. This is the only way that you will be able to connect to and troubleshoot the camera remotely.
7. Finally, an SD card will be required in the camera. It cannot save images in memory.

Also, in case you think this picture looks different than last year, it does. I have installed a new hi-res camera for the front view and the old camera was moved to the back bay. This has led to a fantastic improvement in image quality, if I do say so myself.

You asked!! Now you know!