Ubuntu, Dahua IPC HFW 4300S POE Camera, and Zoneminder

POE (power over ethernet) allows you to run end devices without having to also run or install a power source.  If you can run ethernet cable to where you want an end device, and if the end device supports POE then he power can be supplied on the “unused” pairs of wires within the ethernet cable.  If the end device does not have an RJ45 connector then you can “split out” the power into a normal jack arrangement much like you get with power transformers and plug this into your end device

I.    POE jargon:

POE Power Over Ethernet
PSE Power Sourcing Equipment – devices which supply power to the cat 5 cable, i.e., a poe injector, a switch capable of providing power over its network ports
PD Power Device – end devices i.e., ip camera, access point

 

Two standards for POE:

    1. IEEE 802.3af – capable of supplying 15.40 W
    2. IEEE 902.3at – capable of supply 25.50

Four classifications of POE

  1. Class 1 —  4.5 watts at PoE port; 3.84 watts at device
  2. Class 2 —  7.5 watts at PoE port; 6.49 watts at device
  3. Class 3 —  15.4 watts at PoE port; 12.95 watts at device
  4. Class 0 —  15.4 watts at PoE port; .44 to 12.95 watts at device

Things to be aware of:

  • two kinds of switches:
      • a switch that can provide guaranteed power per port
      • a switch that operates with a total power budget

In the case of a switch with a total power budget you can run out of power before running out of  PDs. 

If you do not have a POE capable switch and you only need to support one or two PDs then you may opt for an POE injector.  It has its own power source and two RJ45 ports:  one data to the non POE switch and one data/POE port to the PD, i.e., your ip camera. The injector on the data/POE port will deliver power to the end device.  Again these injectors support the 802.3af or the 802.3at standard based upon your end devices requirements.  Be sure to know the “classes” of your end device.  I am currently using an 802.3at injector supplying power to a 802.3af device and the injector makes adjustments.  My spec sheet also stated it could power either.  Read the spec sheets.

A temporary setup for a POE injector:

This picture shows the injector or a PSE (the black Trendnet box).  From the bottom there is a black power cable that runs into the wall plug.  From its top are two ethernet cables –a yellow and a grey.  The yellow cable is plugged into the data port and it plugs into the Netgear wireless network extender’s right side.  The grey cable plugs into the injectors Data/Poe port and the other end plug into  the IP POE camera as shown to the right.In the final setup I will be employing an SOE capable 8 port switch.  

IMG_00023IMG_00031

 

The final location/setup:

The rack unit finally arrived so I assembled it and placed the 3 main componenets:  POE switch (top), shelf, and power strip (bottom).

The pics to the right show both a front and rear image of the main components less the shelf.

 IMG_00093 IMG_00142IMG_00063-300x225 IMG_00462 IMG_0012
The unit in its final resting place.  You might notice that I had to relocate the power strip to a higher location.  You can see the wall plate (upper left) which provides the “connection” to the cat 6 cabling running to the end devices.  I am using red patch cables from the wall plate to the switch as a reminder that this is a POE setup.  For now there is only one camera installed.

The cameras wire into the switch and the switch wires into a wireless extender shown in the bottom picture.  This then connects this wireless POE IP camera setup to the rest of the house network wirelessly.

IMG_00421-150x150IMG_0046IMG_0044 IMG_0047_thumb1-226x300
For now there is only one camera connected.  I wanted to “test” my ability to low crawl an attic (have not been forty in many years) as well as my cable making skills.  Everything went reasonably well although running the cat 6 from the front of the house to the NE corner was a challenge.  The best tool I bought for threading cable was a 10 piece fiberglass rod set.  It made life so much easier.  Each piece had a male/female end to you could connect them for a max length of around 33 feet.  Your other option is a robotic crawler:  $2000+ .  Not much of an option for me.

To the right are some “behind the scenes” pics of a roofing structure.  Some show the old cabling that has since been removed.  Without the fiberglass rod set traversing this mess would have been impossible because you are working in the blind for the most part.

IMG_00184-300x225 IMG_00223-300x225IMG_0027_thumb5

II.  Getting your Dahua IPC HFW 4300S POE Camera to work.

The documentation with this camera says that its “fixed ip” is 192.168.1.108.  And that would imply that your subnet must also be 192.168.1.x .  This would normally be true.  However when I got into the camera under its TCP/IP settings it was set up to use DHCP to get an IP address.  If your network support DHCP just plug the camera in and it will obtain and IP address.  To find the camera’s ip:

nmap -A -T4 192.168.10.*

 

III.  ZONEMINDER

A. Software installation and configuration from Ubuntu source

1. Unless you are already using the MySQL server or you are running it
remotely you will need to ensure that the server is installed.
prerequisites for Zoneminder are:  apache, mysql, and php

After installing apache, mysql, and php update to the latest fixes/patches. I had a problem by not doing this. The problem generated an error like the following when running zoneminder: “The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead”. This was fixed by upgrading to the latest patch level. This would prevent Zoneminder from running.

2  You will need to create the ZoneMinder database.

During the install of Zoneminder using Ubuntu’s package manager the Zoneminder’s database is automatically created in mysql.  If you want to be sure do the following:

login to mysql
mysql -u root –p <—-leave blank if no password defined
show databases;
exit;

If you need to drop the database and regenerate it then login as above and do:

show databases;
drop database zm;
exit;

from the command line:

mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
mysqladmin -u root -p{yourpassword} reload

3.   add database user:

mysql -u root -p
your_passwd or “enter” if you don’t have one defined yet
show databases;
use zm;
grant select,insert,update,delete on zm.* to ‘zm’@’localhost’ identified by ‘{your zm user’s passwod}’;
exit;

4.  edit /etc/zm/zm.conf to reflect above changes

ZM_DB_USER={your zm user}
ZM_DB_PASS={your zm user’s passwd}

5.  create the following directories/links as root user

mkdir /etc/apache2/conf.d
ln –s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
ln -s/etc/zm/apache.conf /etc/apache2/conf-enabled/zoneminder.conf
sudo a2enmod cgi
sudo adduser www-data video
service apache2 restart

6.      set mysql root’s passwd:

mysqladmin -u root password ‘your_passwd_here’

7.      If after following these steps the “localhost/zm” web page is looking wrong then I would go back to step 2 – drop the database and reload it.  I believe that the package installation loads the ZM database but neglects to drop it if it already exists.  This can end in a corrupted database and cause zoneminder to start cleanly.

8.  Stopping/Starting Zoneminder

zmpkg.pl [start][stop][restart]  This must run cleanly.  If there are errors you need to address them before proceeding.

On the local hosts machine enter:  http://localhost/zm in the browser of your choice.

B.  Configuring your camera in Zoneminder.

Assuming zoneminder is functioning correctly bring up your Zoneminder webpage on the Zoneminder node: “localhost/zm” (no quotes).

Select “Add a New Monitor and refer to the screens below.  Leave most settings as is and refer to the “changes in the screen shots that follow”.

This should present you with the following page:

zm1

Next “click” on the entry under Source – “live” in my case.  This will present you with the following menu:

zm2

In the following screen shots make sure that you do not have any leading or trailing “blanks”. They will be treated as being part of the specified field and will cause the live stream to fail.

What is important here with respect to the Dahua IPC HFW 4300S POE Camera is the “Source Type” entry:  Ffmpeg.

Click on the “Source tab” in the above picture and you will get the following menu:

zm3

This is the key.  Source Path must contain:  rtsp://username:password@your_cameras_ip_addr:554/live

Remember I am addressing a specific camera in the Source Path parameter.  If you are using a different camera your source path might be different, especially in the part following the cameras IP addr.  Port 554 is standard but you might have changed it in the camera’s configuration.  Also the “/live” will probably be different for another brand of camera.

In the installation of the camera you either allowed it to get an IP address through DHCP or you manually configured it to have a set IP address.  If you allowed it to receive a DHCP address then your router MUST assign this camera this same IP address. If you don’t do this then the camera might receive a different IP address from the DHCP server and become unknown to Zoneminder.

Note: the “red” and “blue” strike throughs are username/password and IP address respectively.

Live feed has been removed.

There is a difference in times shown. I need to time sync the camera.

7 comments on “Ubuntu, Dahua IPC HFW 4300S POE Camera, and Zoneminder”

  1. Will Reply

    Excellent post, well written, thoroughly detailed!

    Any idea how to access the mjpeg substream in a similar manner? and snapshot?

  2. Ron Reply

    Thanks.

    In the “source tab” for zoneminder you can put the following into the “source path” field/attribute:
    “rtsp://your_user:your_password@your_ip_address:554/cam/realmonitor?channel=1&subtype=1”

    by changing the “subtype=#” attribute in the string you select different streams from the camera. 0 seems to be the “main_stream” i.e., the highest resolution.

    For a snapshot try:
    “http://[YOUR-IP]/cgi-bin/snapshot.cgi?loginuse=[USERNAME]&loginpas=[PASSWORD]”

    I am currently using Blue Iris to manage my cameras. While it is a windows product I find to be a full featured and relatively intuitive application. If you have Dahua cameras the vendors usually provide a small disk containing a software application that works well with their cameras (I belive the the product is called PSS), however not so well with other vendor cameras. Blue Iris seems compatible with most cameras on the market. You can download an evaluation copy to ensure compatability with your equipment before buying.

  3. chad Reply

    Were you able to get Zoneminder to work w/ the 4300S using the highest resolution of the camera? When I set my camera and Zoneminder to 2048 by 1536 I get vertical striping intermittently which triggers a false positive for motion.

  4. Ron Reply

    Chad I never tried 2048 X 1536 in Zoneminder so I can’t respond to your question. I no longer use Zoneminder so I am unable to give it a try at those resolutions. Motion capture is always a challenge regardless of which product you use. Some apps are more attentive to the intricacies of motion capture then are others and these reduce the false positives but if you have blowing palm trees then you will have to make multiple adjustments to various attributes based upon time of day, time of year, etc.

    • ron Reply

      I stopped using Zoneminder over a year ago. I now use Blue Iris, a windows application. It is quite robust and provides all of the options that I require. You can download a free version here: http://blueirissoftware.com/ . Please note that the free version has an annoying banner across the video fields. The paid for version does not have the banner.

Leave A Reply

Your email address will not be published. Required fields are marked *

*

Bad Behavior has blocked 845 access attempts in the last 7 days.