Foscam

From ZoneMinder

Jump to: navigation, search

Model specific wikis

Foscam FI8918W Pan/Tilt Camera

Foscam FI8910W Pan/Tilt Camera

Foscam FI8904W Outdoor IP camera

Foscam FI8905W Outdoor IP camera

Foscam FI8602W Outdoor IP camera

Foscam FI9801/2W Outdoor IP camera

Foscam FI9805W Megapixel Outdoor IP camera

Foscam FI8921P Pan/Tilt Camera

Foscam Clones

Wanscam FR4020A2 (Foscam clone)

General Foscam directions

(This was very helpful for me, but instead of 'videostream' below I believe it should be 'snapshot'. Using videostream my wifi, using iptraf to monitor it, was fluctuating wildly from zero to 5 mbps and lots of events were missed. Now that I'm using the snapshot cgi (/snapshot.cgi?user=mine&pwd=mine) iptraf shows a steady stream that behaves as expected, jumps up when alarmed, am getting the performance from zoneminder other are, where using the videostream as below got nothing but furstration... Best to y'all, gsx)

Foscam FI8908W IP Camera with PT (no Z) Working in ZM 1.24.2

Firmware 11_14_2_28 with presets working. --Lowbayer 21:39, 12 March 2011 (UTC)

(This also works with the Foscam FI8918W camera. No sound though.)

See here for detail on Foscam_FI8918W with presets working. Hdurdle 23:18, 26 February 2011 (UTC)


Just thought this might be useful for anybody using the Foscam IP FI8908W Cameras.

They can be bought on eBay for around £50 and for that money they are a great buy. (Beware of fakes, see here: http://www.gadgetvictims.com/2009/09/yet-another-firmware-for-foscam-fi8908w.html)

A firmware upgrade can be performed to allow Server Push Mode, for FireFox etc.

See here for a instructions and a link to the firmware file: http://www.gadgetvictims.com/2009/07/foscam-ip-camera-part-two.html

I recommend firmware V11.14.1.42 and Web UI V2.4.8.11

Once that is done you can proceed to add the camera into ZoneMinder with the following settings:

General
Name: x
Source Type: Remote
Function: Modect (up to you though)
Enabled: Tick
Maximum FPS: Empty (I had some issues with it lagging when I used values here)
Alarm Maximum FPS: Empty
Source
Remote Protocol: HTTP
Remote Method: Simple
Remote Host Name: x.x.x.x (The IP of the camera)
Remote Host Port: 80
Remote Host Path: /videostream.cgi?user=admin&pwd= (assuming you have an admin user on the cam with no password)
Remote Image Colours: 24 bit colour
Capture Width: 320 (You could use 640 x 480, I found 320 to be better)
Capture Height: 240



Video Stream Url and Parameter
http://<IP-CAM>/ videostream.cgi? user=A& pwd=B& resolution=C &rate=D
User Password 8 => 320x240 0 => maxframe
32 => 640x480 1 => 20 fps
3 => 15 fps
6 => 10 fps
11 => 5 fps
12 => 4 fps
15 => 3 fps
14 => 2 fps
15 => 1 fps
17 => 1 fps/2s
19 => 1 fps/3s
21 => 1 fps/4s
23 => 1 fps/5s
Example
http://<ip-webcam>/videostream.cgi?user=admin&pwd=geheim&resolution=32&rate=6

--Lowbayer 08:05, 11 April 2011 (UTC)



The other settings are for personal preference only – so I haven’t listed them.

I modified an existing camera control file to create this file which will allow you to pan and tilt the camera from the web interface (working in ZM V1.24.2)

Save the following in the same location as the other .pm files. You can search for “PanasonicIP.pm” on your machine and see where that is. In my case it is:

/usr/share/perl/5.10/ZoneMinder/Control

From a terminal window run:

sudo gedit

Which will open up your text editor in admin mode. Then paste the following between the +++ (excluding the +++) into the text editor:

+++


# ==========================================================================
#
# ZoneMinder Foscam FI8908W IP Control Protocol Module, $Date: 2009-11-25 09:20:00 +0000 (Wed, 04 Nov 2009) $, $Revision: 0001 $
# Copyright (C) 2001-2008 Philip Coombes
# Modified for use with Foscam FI8908W IP Camera by Dave Harris
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ==========================================================================
#
# This module contains the implementation of the Foscam FI8908W IP camera control
# protocol
#
package ZoneMinder::Control::FoscamFI8908W;

use 5.006;
use strict;
use warnings;

require ZoneMinder::Base;
require ZoneMinder::Control;

our @ISA = qw(ZoneMinder::Control);

our $VERSION = $ZoneMinder::Base::VERSION;

# ==========================================================================
#
# Foscam FI8908W IP Control Protocol
#
# ==========================================================================

use ZoneMinder::Debug qw(:all);
use ZoneMinder::Config qw(:all);

 use Time::HiRes qw( usleep );

sub new
{ 

my $class = shift;
my $id = shift;
my $self = ZoneMinder::Control->new( $id );
my $logindetails = "";
bless( $self, $class );
srand( time() );
return $self;
}

our $AUTOLOAD;

sub AUTOLOAD
{
my $self = shift;
my $class = ref($self) || croak( "$self not object" );
my $name = $AUTOLOAD;
$name =~ s/.*://;
if ( exists($self->{$name}) )
{
return( $self->{$name} );
}
Fatal( "Can't access $name member of object of class $class" );
}
our $stop_command;

sub open
{
my $self = shift;

$self->loadMonitor();

use LWP::UserAgent;
$self->{ua} = LWP::UserAgent->new;
$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );

$self->{state} = 'open';
}

sub close
{ 
my $self = shift;
$self->{state} = 'closed';
}

sub printMsg
{
my $self = shift;
my $msg = shift;
my $msg_len = length($msg);

Debug( $msg."[".$msg_len."]" );
}

sub sendCmd
{
my $self = shift;
my $cmd = shift;
my $result = undef;
printMsg( $cmd, "Tx" );

my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" );
my $res = $self->{ua}->request($req);

if ( $res->is_success )
{
$result = !undef;
}
else
{
Error( "Error check failed:'".$res->status_line()."'" );
}

return( $result );
}

sub reset
{
my $self = shift;
Debug( "Camera Reset" );
my $cmd = "reboot.cgi?user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Up Arrow
sub moveConUp
{
my $self = shift;
$stop_command = "1";
Debug( "Move Up" );
my $cmd = "decoder_control.cgi?command=0&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Down Arrow
sub moveConDown
{
my $self = shift;
$stop_command = "1";
Debug( "Move Down" );
my $cmd = "decoder_control.cgi?command=2&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Left Arrow
sub moveConLeft
{
my $self = shift;
$stop_command = "1";
Debug( "Move Left" );
my $cmd = "decoder_control.cgi?command=4&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Right Arrow
sub moveConRight
{
my $self = shift;
$stop_command = "1";
Debug( "Move Right" );
my $cmd = "decoder_control.cgi?command=6&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Diagonally Up Right Arrow
sub moveConUpRight
{
my $self = shift;
$stop_command = "1";
Debug( "Move Diagonally Up Right" );
my $cmd = "decoder_control.cgi?command=91&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Diagonally Down Right Arrow
sub moveConDownRight
{
my $self = shift;
$stop_command = "1";
Debug( "Move Diagonally Down Right" );
my $cmd = "decoder_control.cgi?command=93&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Diagonally Up Left Arrow
sub moveConUpLeft
{
my $self = shift;
$stop_command = "1";
Debug( "Move Diagonally Up Left" );
my $cmd = "decoder_control.cgi?command=90&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Diagonally Down Left Arrow
sub moveConDownLeft
{
my $self = shift;
$stop_command = "1";
Debug( "Move Diagonally Down Left" );
my $cmd = "decoder_control.cgi?command=92&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Stop
sub moveStop
{
my $self = shift;
Debug( "Move Stop" );
my $cmd = "decoder_control.cgi?user=admin&pwd=&command=1";
$self->sendCmd( $cmd );
}

#Move Camera to Home Position
sub presetHome
{
my $self = shift;
Debug( "Home Preset" );
my $cmd = "decoder_control.cgi?command=25&user=admin&pwd=";
$self->sendCmd( $cmd );
}

1;

+++


Now save that as ‘FoscamFI8908W.pm’ in the same location where you found the PanasonicIP.pm file.

(This file also assumes there is a user with the name admin and no password. If your setup is different, you will need to change this file). This is a first draft working version, I’ll tidy it up once ive learnt a bit more about perl 

Next you need to add the Control Type.

Click on edit and add a new control with these details:

Main: Name: Foscam FI8908W Type: Remote Protocol: FoscamFI8908W (No space in there) Move: Can Move: Tick Can Move Diagonally: Tick Can Move Continuous: Tick Pan: Can Pan: Tick Tilt: Can Tilt: Tick Presets: Has Presets: Tick Num Presets: 0 Has Home Presets: Tick

Add the IP address of the camera to the Control Address field in the Control tab of camera settings

Save all that and you should be up and running.



Here a list of more feature from decoder_control.cgi with the Firmware 11.14.2.28 (found
http://www.gadgetvictims.com/2010/10/fi8908w-old-and-new.html) --Lowbayer 21:39, 12 March 2011 (UTC)

Example: http://<IP_CAM>/decoder_control.cgi?command=30&user=<user>&pwd=<pass> = Set the preset 0

Parameters value

0 up
1 Stop up
2 down
3 Stop down
4 left
5 Stop left
6 right
7 Stop right
... Reserved
25 center
26 Vertical patrol
27 Stop vertical patrol
28 Horizon patrol
29 Stop horizon patrol
30 Set preset 0
31 Go preset 0
32 Set preset 1
33 Go preset 1
34 Set preset 2
35 Go preset 2
....
62 Set preset 16
63 Go preset 16
And the list goes further until preset 16
94 IO output high
95 IO output low

A few more notes that I found useful:

Turning off the annoying green LED: (where x.x.x.x is the IP of your camera)

http://x.x.x.x/set_misc.cgi?led_mode=2&user=admin&pwd=

led_mode=0 - the green led blinks only once connected.
led_mode=1 - the green led blinks while searching for a connection and when connected.
led_mode=2 - the green led is always off.

Stop the camera moving around when you reboot it:

http://x.x.x.x/set_misc.cgi?ptz_center_onstart=0&user=admin&pwd=

I initially had some issues with no images displaying in ZM. I found this to be a shared memory issue, see here:

http://www.zoneminder.com/wiki/index.php -> FAQ#What_does_a_.27Can.27t_shmget:_Invalid_argument.27_error_in_my_logs_mean.3F_and_my_cameras_won.27t_display_video_at_higher_resolutions.


Here a list of interesting feature
--Lowbayer 21:39, 12 March 2011 (UTC)

http://[ipcam]/get_misc.cgi ->Returns all the current values for the functions above.

http://[ipcam]/get_log.cgi -> Displays the visits log

http://[ipcam]/get_params.cgi ->Returns the complete configuration of the camera.

https://docs.google.com/fileview?id=0B-yhhBvC0DSlNWExZDU0NTQtMDlmZi00YzkzLWFkNDAtMGU4MTA1MDg2YjMz&hl=en

The feature list from the IPCAM CGI SDK V1.7

http://www.notesco.net/download/ipcamcgisdk21.pdf

The feature list from the IPCAM CGI SDK V2.1



I found this guide useful for getting ZM 1.24.2 installed in the first place on my ubuntu box:

http://www.howtoforge.com/video_surveillance_zoneminder_ubuntu

I replaced:

ftp://www.northern-ridge.com.au/zoneminder/ubuntu/dapper/zoneminder_1.22.3-8_i386.deb

with

ftp://www.northern-ridge.com.au/zoneminder/1.24/ubuntu/jaunty/zoneminder_1.24.2-1_i386.deb

I have also heard of people replacing the existing lens in the Foscam Camera (it simply unscrews) with a 160° Wide Angle lens to give a better view. (Search eBay for ‘2.1mm CCTV Lens’). I haven’t tried this myself yet, but will at some point in the future.

On more thing to add. Since upgrading to 1.24.2 (I was originally on 1.23) I have had a few issues with apache locking up. I followed the recommended fix in this thread:

http://www.zoneminder.com/forums/viewtopic.php?p=51045

Which has helped a little but I’m still having a few issues. I have to run this command:

sudo apache2ctl restart

every now and then on the box (which I VNC into from my windows box) to restart apache.

Hope this is useful to some people.

Cheers,

DAVE.

PS - As I'm not always on the forum, I tend to update my blog first (and the forum later - sorry!), it's here: http://dave.harris.net/foscam-fi8908w-ip-camera-with-pt-no-z-working-in-zoneminder/ :)

Wireless Setup

How to setup IP camera wirelessly http://foscam.us/forum/post15934.html#p15934

Test and Tweak IP Camera Setup and Configuration

Make sure your IP Camera is functioning at peak ability http://foscam.us/forum/post34164.html#p34164

Links;