Dear, all
In my home I use a Zoneminder surveillance (linux based security and surveillance opensource system).
I have the necessity to start to recording on some camera in case of external events.... with arduino (+ arduino ethernet) is very simple!
Now I want to share my solution with you.
On Zonemineder:
On ZM is necessary to enable the external trigger; it is possible to start recording on external event using serial comunication, network comunication or file in a folder "comunication" (ZM check for a file in a specific folder); I have chosen the networdk comunication.
1 Enable external trigger:
Edit the file zmtrigger.pl:
Check for the some comunication system row definition and comment the not used (put # at the start of the lines):
[cut]
my @connections;
push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan1", channel=>ZoneMinder::Trigger::Channel::Inet->new( port=>6802 ), mode=>"rw" ) );
#push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan2", channel=>ZoneMinder::Trigger::Channel::Unix->new( path=>ZM_PATH_SOCKS.'/zmtrigger.sock' ), mode=>"rw" ) );
#push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan3", channel=>ZoneMinder::Trigger::Channel::File->new( path=>'/tmp/zmtrigger.out' ), mode=>"w" ) );
#push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan4", channel=>ZoneMinder::Trigger::Channel::Serial->new( path=>'/dev/ttyS0' ), mode=>"rw" ) );
[cut]
This procedure enable ZM to listen on udp port 6082 for external command.... (in case you can change this port...)
From the web interface of ZM:
2 Take a camera, put "Nodect" for function type (instead of motion detection, recording,...)
3 In the ZM options (System Page/TAB) put the check on "OPT_TRIGGERS" (enable zm to check for external triggers)
Ok, zm configuration is finish!; now on arduino...
Is necessary to create a program that connect ZM on port 6802 (UPD using ethernet) and send the command...
Command format:
6|on+60|255|Arduino alarm
Synstax:
6 is the ID (in the database of ZM), you can find it on the web interface of ZM moving the mouse on the camera (in the link you can see the ID; eg: ...../index.php?view=watch&mid=6)
on+60 Start recording and stop it after 60 seconds
255 the amount of the point for the motion detection (fixed to 255; is the top)
Arduino allarm comment of the alarm
All parameters must be separate with pipe char (|)
another eg
6|on
Start to recording without end (is necessary to send the command 6|off for stop the recording)
Send this type of command for each camera needed (changing the ID of the camera)
At the moment I cant send a sample of the code of arduino... but using the sample in the ide is very simple to implement; in my case a pin of the arduino is conneceted to a switch, when I close it, ZM start to recording...
Zoneminder info on www.zoneminder.org
I love Opensource!
Pier