How to control your Foscam HD cameras - PTZ

From ZoneMinder Wiki
Jump to navigationJump to search


Making PTZ work for Foscam HD cameras (9831W, but should work on all others)

Zone minder already comes with a control script called by Christophe Dapremont that does all the hard work. I only had to trivially modify it. the key change I made was that the script hardcodes an authentication login/password in the script. I removed it, and made it so that you can use the "Control Device" field of ZM to specify the password

I also noticed he did not add cruise mode - I might do that myself when I have the inclination (which I currently don't as I never use PTZ within ZM).

The updated PTZ script

You can find it here:

How to set up ZM to recognize the script

Quick and Dirty way

If you are trivially modifying an existing script, you don't need any of the below - you can just modify the script and be done I could have just modified the _y2k script since my changes were very small, but I preferred to do a new script and not mess with the original

The proper way

  • Copy to /usr/share/perl5/ZoneMinder/Control
  • Make sure OPT_CONTROL is checked in Options->System of ZM
  • You also need to make sure you create a new control in ZM. To do this
    • Click on any monitor "source" column. That will bring up your configuration screen for that monitor
    • Click on "Edit" next to Control Type. This brings up a big list of existing controls (you won't see your new script here)
    • Click on "Add New Control"
      • Main Tab
        • Name: Foscam 9831W
        • Type: FFmpeg
        • Protocol:FI9831W_arc (IMPORTANT: needs to be exactly the same as the .pm file you just copied, except the .pm extension)
        • Check "Can Reset" leave the rest unchecked
      • Move Tab
      • Pan Tab
        • Check CAN PAN, min pan range =0, max pan range = 360, min pan step = 0, max pan step = 360
        • Check HAS PAN SPEED, min pan speed =0, max pan speed = 4
      • Tilt Tab
        • Check CAN TILT, and min tilt range=0, max tilt range=90; min tilt step=0, min tilt step=90
        • Check HAS TILT SPEED, min speed = 0, max speed = 4
      • Zoom, Focus, White, Iris Tabs -- leave unchecked (though I think it has WB)
      • Preset Tab

How to associate a camera to your new control

  • Click on the "source" column of your monitor
  • Click on Control Tab
  • Check "Controllable"
  • Control Type: Your new Control (FI9831W_arc) should now be in this list. If not, reboot ZM once, or restart it and it should show up. If not, you messed up something. Review previous section
  • In Control Device type in

replace xxxx with your foscam login and password. IMPORTANT: Remember its "usr" not "user" and "pwd" not "password"

  • In Control Address type in

of your camera

I also put in a value of 1 in auto stop timeout (I don't think it matters)

That's all, click and save

How to test

  • First off, monitor your logs while testing - it can tell you a lot if things don't work (I just do tail -f /var/log/syslog)
  • Click on the Name column of your monitor to which you just added PTZ control
  • Click on the "Control" link at the top of the new window showing your live stream
  • Control away (don't get impatient, ZM sometimes takes some time to process your control commands)

More fine tuning

Foscam has released its CGI User Manual - all PTZ controls are listed there. It's pretty easy to modify your script to make it more accurate and feature rich (example Cruise control) You can read the CGI document here. I'd strongly recommend you read it if you want to tinker.