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

Post here to indicate any hardware you have used and which is known to work with ZoneMinder. Not for questions.
wollo
Posts: 9
Joined: Wed Sep 29, 2010 8:05 pm

Post by wollo »

I've eventually got round to trying 1.23.3 myself. my control file isn't working. Ive even tried overwriting the PanasonicIP.pm file and selecting that one instead, but thats an other story.
I've only been running 1.23.3. for a few hours and set up my 3 cams with rate 11.
I've noticed that they report under 5 fps when its low light. don't suppose that means anything though. I'm running out of settings and distos here not sure what else to try.
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

With 1.23.3 control file is working fine with Foscam. I also have a Panasonic IP cam and its control file works well also. Initially when configuring the control file for the Foscam I mistyped the name and it didn't work until I saw that piece of it.

Let us know how long it runs with the Foscam IP cams. Are you streaming at 640X480 or 320X240?

Took the other box with 1.24.2; turned it on a few minutes ago. I set it up a while ago but never played with it.

I like the updates from 1.23.3 to 1.24.2

This one Arch Linux / ZMLarch build.

It has the same style as the other ZM box 8 chip (878A) card in it.

I configured the Foscam on it at 640X480.

No control file as I want to see it stream for a while.

It streamed fine all day at 640X480.
wollo
Posts: 9
Joined: Wed Sep 29, 2010 8:05 pm

Post by wollo »

320 x 240. I've has one stream running for about 12 hours now. Thats unusal however. It seems most of the time each camera crasher within about 4-6 hours. I'm thinking of running windows xp and blue iris on this machine now. Problem is I lose the ability to link up to xAP then. I believe I've tried every setting on the cameras now. Unfortunately I don't really know enough Linux to try anything meaningfull on the zoneminder install.
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

Sounds good Wollo. Much of the ZM documented "tweaking" if very simple. I use both Webminder and Winscp to make adjustments. IE: the adjustments have speed up booting, etc.


Last night played some more with memory configurations for Foscam on the ZM link at 640X480. Foscam is still up this morning running fine (which is a first).

I also utilize Xap relating to events etc with my HA server. I tried a few windows programs a couple of years ago. I like the fact though that ZM never crashes and remains up (witht he 8 analogue cams).
wollo
Posts: 9
Joined: Wed Sep 29, 2010 8:05 pm

Post by wollo »

Pete, I really want to use zoneminder to, just the best feature set imho. I'm really interesterd in the memory tweaks you speak of, in case running 3 cameras at 320x240 is having the same effect as your 1 640x480.
What type of hardware are you using. I'm qondering if my rather non standard hardware could be causing/ adding to my problems. To keep power usage down I'm running on a Compaq TC1000 tablet - 743MB ram, 1000Mhz Trans-meta crusoe processor. Low specced I know but it does seem quite responsive and only uses 10-30% cpu when monitoring 3 cams.

I think my next attempt now will be to try your memory tweak then try installing on a spare 2Ghz homebrew tower I have sitting gathering dust. Only problem there is I suspect it will draw 4x the power.

What are you using for HA? I have homeseer HS2 and xAP running here. xAP is the newbie though and I'm still learning with that.
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

I have a similiar tablet with a Trans-Meta 400Mhz or 500Mhz CPU running a Touch screen application. Its a bit slow though. The ZM new and old are running 3.X dual core CPU's with 2Gb of memory.

This is what I did for the memory tweak. 50% of the cameras are color and the others are B&W cams.

I am also using Homeseer Pro (since the late 1990's) in addition to also using an HAI Omni Pro II. Once you have Xap set up you can run specfic events either on the ZM server or the HS server. IE: Delivery of a package creates Xap Events on the HS server with pictures, text messages and email.

The way I edit files on ZM.

1 - Login to ZM Webmin (webmin/servers tab) and enable SSH
2 - Run WinSCP and log into ZM as root. (looks like windows explorer)
3 - Run Putty to get to a log on prompt concurrently. Do a (here's mine).

[quote]You can often find out how much shared memory is available by typing the following :-
cat /proc/sys/kernel/shmall[/quote]

[quote]cat /proc/sys/kernel/shmall
268435456[/quote]

[quote]and the most you can allocate in one go :-

cat /proc/sys/kernel/shmmax[/quote]

[quote]cat /proc/sys/kernel/shmmax
4194304000[/quote]

Edited and added the following to /etc/sysctl.conf

[quote]# Memory modifications for ZoneMinder (kernel.shmall = XX MB, kernel.shmmax = XXX MB)
kernel.shmall = 268435456
kernel.shmmax = 4194304000[/quote]

Reboot ZM to run new memory settings.

There was another thing I did (I have to find it) where before I did it; it would take a few minutes to boot up. With the change ZM boots up in less than a minute. I have to find it.

ZM plays well with HS. Many folks on the HS forum try to do camera captures using Windows concurrently running HS; which really pushes it a bit.
wollo
Posts: 9
Joined: Wed Sep 29, 2010 8:05 pm

Post by wollo »

So... some positive news caused by some not so..

Last night my windows 2003 server running mediaportal finally annoyed me to the point that I decided to do a rebuild. I decided to put my last copy of windows 7 ultimate onto that box. Since I've done that about 22 hours ago none of my 3 cameras have failed. This is a massive improvement. I've not even has a chance to try the memory tweaks you have posted. It'll take a few days to prove to myself that my problems are gone but at this stage it looks promising.

I don't know if I had conflicting setting or software. I'll keep an eye as I slowly install more software.

Bill.
wollo
Posts: 9
Joined: Wed Sep 29, 2010 8:05 pm

Post by wollo »

Cameras all still running, however on trying to control my cameras I get error message

---------------------------
Message from webpage
---------------------------
Control response was status = 2
message =
---------------------------
OK
---------------------------


I've followed the instructios above to the best of my knowledge however after I've saved Foscam8908W.pm along with the other .pm files in the control files folder. It started to go wrong about then. The control type drop down menu doesnt show Foscam8908W as an option(even after a reboot. I then tried overwriting PanasonicIP.pm with the text from Foscam8908W.pm and selcting PanasonicIP.pm as the control type. This hasn't worked either. Anyone any ideas?
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

I'm using both the Panasonic and the Foscam PM. I'll attach the one that Dave wrote up. The first time I set it up I made a mistake on the spelling.

I use Windows 7 on the Media Center PC...but I keep going back to using the NMT instead.

http://img696.imageshack.us/img696/9707/foscam2.jpg

Code: Select all

# ==========================================================================
#
# 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;
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Foscam still locking up

Post by pete_c »

Noticed now that Foscam will run 5-7 days great.

After between 5-7 days though its locking up.

I am not sure why. It would be great if the Foscam log showed something other than access to the camera.
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

Bricked it last night; plugging the camera on and off a few times in a matter of a few minutes.

Now when you plug in the power the green LED goes on and off every few minutes and I hear a click coming from the camera.

Here is the procedure for unbricking. Will give it a try today.

The procedure is here:

http://www.gadgetvictims.com/2009/12/br ... ck-to.html

I have a 3 wire USB Nokia phone serial interface (modded a bit) that I made for my Patriot Memory NMT.

1 - Download recovery files.
2 - Utilize Hyperterm
3 - JTAG pinouts - if pins are not there you have to solder new ones on the board.
Pin #1 - INPUT
Pin #2 - OUTPUT
Pin #3 - GROUND
Pin #4 - POWER (not needed) - my Nokia cable only has 3 wires - power comes from USB port.

I will give it a try today. Maybe it'll fix the problems I've been having.
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

I didn't have any JTAG pins so needed to install some.

While setting it up I must have cold booted it (mixing the RX,TX and Ground) because it came back to life. I did get a boot loader prompt so reconfiguring while I watch via the terminal connection.
wollo
Posts: 9
Joined: Wed Sep 29, 2010 8:05 pm

Post by wollo »

Sorry I havent posted back. got a nasty eye injury. Just to say over 7 days with all 3 cameras at 320x240 10 fps no crashes by cameras or zoneminders. hopefully the eye will be up to trying your control file next week.
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

Take care of the eye. Good news on your ZM/Foscam setup!
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

Got my Foscam back up. It needed the newest FW file from Foscam Tech.

Installed the wide angle lens. Very difficult to install. Looks good except with the IR illuminators on. Because the lens is just about flush with the camera the light from the LEDs distort the lens due to reflections.

The original PM file was posted by Dave here on the Foscam Wiki.

Ivan Francolin Martinez has modified it a bit.

Code: Select all

# ==========================================================================
#
# 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
#    Updated by Ivan Francolin Martinez
#
# 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
# 
# On ControlAddress use the format :
#   USERNAME:PASSWORD@ADDRESS:PORT
#   eg : admin:@10.1.2.1:80
#        zoneminder:zonepass@10.0.100.1:40000
#
# ==========================================================================

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?";
    $self->sendCmd( $cmd );
}

#Up Arrow
sub moveConUp
{
    my $self = shift;
    my $params = shift;
    $stop_command = "1";
    Debug( "Move Up" );
    my $cmd = "decoder_control.cgi?command=0";
    $self->sendCmd( $cmd );
    $self->autoStop( $stop_command, $self->getParam( $params, 'autostop', 0 ) );
}

#Down Arrow
sub moveConDown
{
    my $self = shift;
    my $params = shift;
    $stop_command = "3";
    Debug( "Move Down" );
    my $cmd = "decoder_control.cgi?command=2";
    $self->sendCmd( $cmd );
    $self->autoStop( $stop_command, $self->getParam( $params, 'autostop', 0 ) );
}

#Left Arrow
sub moveConLeft
{
    my $self = shift;
    my $params = shift;
    $stop_command = "5";
    Debug( "Move Left" );
    my $cmd = "decoder_control.cgi?command=4";
    $self->sendCmd( $cmd );
    $self->autoStop( $stop_command, $self->getParam( $params, 'autostop', 0 ) );
}

#Right Arrow
sub moveConRight
{
    my $self = shift;
    my $params = shift;
    $stop_command = "7";
    Debug( "Move Right" );
    my $cmd = "decoder_control.cgi?command=6";
    $self->sendCmd( $cmd );
    $self->autoStop( $stop_command, $self->getParam( $params, 'autostop', 0 ) );
}

#Diagonally Up Right Arrow
sub moveConUpRight
{
    my $self = shift;
    my $params = shift;
    $stop_command = "1";
    Debug( "Move Diagonally Up Right" );
    my $cmd = "decoder_control.cgi?command=91";
    $self->sendCmd( $cmd );
    $self->autoStop( $stop_command, $self->getParam( $params, 'autostop', 0 ) );
}

#Diagonally Down Right Arrow
sub moveConDownRight
{
    my $self = shift;
    my $params = shift;
    $stop_command = "1";
    Debug( "Move Diagonally Down Right" );
    my $cmd = "decoder_control.cgi?command=93";
    $self->sendCmd( $cmd );
    $self->autoStop( $stop_command, $self->getParam( $params, 'autostop', 0 ) );
}

#Diagonally Up Left Arrow
sub moveConUpLeft
{
    my $self = shift;
    my $params = shift;
    $stop_command = "1";
    Debug( "Move Diagonally Up Left" );
    my $cmd = "decoder_control.cgi?command=90";
    $self->sendCmd( $cmd );
    $self->autoStop( $stop_command, $self->getParam( $params, 'autostop', 0 ) );
}

#Diagonally Down Left Arrow
sub moveConDownLeft
{
    my $self = shift;
    my $params = shift;
    $stop_command = "1";
    Debug( "Move Diagonally Down Left" );
    my $cmd = "decoder_control.cgi?command=92";
    $self->sendCmd( $cmd );
    $self->autoStop( $stop_command, $self->getParam( $params, 'autostop', 0 ) );
}

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

#autoStop
sub autoStop
{
    my $self = shift;
    my $stop_command = shift;
    my $autostop = shift;
    if( $autostop && $self->{Monitor}->{AutoStopTimeout} )
    {
        Debug( "Auto Stop" );
        usleep( $self->{Monitor}->{AutoStopTimeout} );
        my $cmd = "decoder_control.cgi?command=".$stop_command;
        $self->sendCmd( $cmd );
    }

}

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

#Horizontal Patrol
sub horizontalPatrol
{
    my $self = shift;
    Debug( "Horizontal Patrol" );
    my $cmd = "decoder_control.cgi?command=28";
    $self->sendCmd( $cmd );
}

#Horizontal Patrol Stop
sub horizontalPatrolStop
{
    my $self = shift;
    Debug( "Horizontal Patrol Stop" );
    my $cmd = "decoder_control.cgi?command=29";
    $self->sendCmd( $cmd );
}

#Vertical Patrol
sub verticalPatrol
{
    my $self = shift;
    Debug( "Vertical Patrol" );
    my $cmd = "decoder_control.cgi?command=26";
    $self->sendCmd( $cmd );
}

#Vertical Patrol Stop
sub verticalPatrolStop
{
    my $self = shift;
    Debug( "Vertical Patrol Stop" );
    my $cmd = "decoder_control.cgi?command=27";
    $self->sendCmd( $cmd );
}

1;
Post Reply