Android and Linux
Wednesday, February 16, 2011
A new toy
I just got one of these Foscam FI8918W IP cameras and it's really cool. It can pan and tilt, has infrared lights to work at night, motion detection, jacks for audio in and out so you can stream audio and even talk to people through it.. Being an IP camera, it has it's own built-in server that connects to the internet through your home router, either wired or wireless.
The most common way to control it is by pointing your web browser to it's IP address, logging in and viewing the video or controlling the camera. There are also apps for mobile phones to view IP cameras, but the real power is performing commands on the camera using nothing more than specific URLs. For example, grabbing these URLs will give you a snapshot from the camera. They are the same command, just in a different order:
http://User:Pass@IP/snapshot.cgi?
http://IP/snapshot.cgi?user=user&pwd=pass
This one will turn on the camera's infrared lights:
http://User:Pass@IP/decoder_control.cgi?command=95
There are also URLs to pan, tilt and zoom, view the video stream, and adjust various other settings.
While these can be done by typing the URL into a browser, they can also be used in other ways. On the command line, this will tilt the camera down:
wget -q -O - http://User:Pass@IP/decoder_control.cgi?command=2
This two-step Tasker task will save a snapshot from the camera then pop it up on the screen:
1 HTTP get
Server/Port: (the camera's IP address)
Path: snapshot.cgi?user=user&pwd=password
Output File: cam.jpg
2 Popup
Background Image: cam.jpg
Unfortunately, although it runs embedded Linux, it's not open source. The commands seem to be found by people through trial and error, but people have found pretty much all of them. I haven't tested them all, but I look forward to it, and I look forward to integrating the camera with my computer, Tasker, and my home automation.