How to use Motion Linux (4.1.1.1) with 2 web cams & Chinese IP camera on Ubuntu 17.10 (Artful Aardvark)

Motion Linux is a highly configurable easy to use cctv software.

The CCTV system that is explained here is based on 3 cheap cameras.

2 web cams and one Chines Yoosee IP Camera (wifi)

IMG_20180201_111426

The Motion linux  in the Ubuntu software is not the latest version .Therefore it is advisable to get the software from the Motion website

First install Motion Linux latest release  using the GDebi  Package Installer .

Screenshot from 2018-02-02 18-27-09

Now if you see the folder motion is being created at /etc/motion/. You can see  5  files in this folder as i the following figure

Screenshot from 2018-02-02 18-28-44

Out of the 5 files shown in the above figure ,the main file is motion.conf

Other 4 files are the configuration  files of linked cameras

If you open the motion.conf file you can see the commands of linking camera are placed at the bottom as follows (728-731).

sudo gedit /etc/motion/motion.conf

 

Screenshot from 2018-02-02 16-51-03

There was an error in the names of camera files in the default installation in the lines 728 to 731. Therefore you will have to correct and save the file as in the above picture.

You will have to delete ” ; ” placed at the beginning of the commands in order to activate the corresponding camera .You can see it in 728,729,and 730.

Now the corresponding configure files of cameras are edited as follows.

Usb camera 1

sudo gedit /etc/motion/camera1-dist.conf

Screenshot from 2018-02-02 12-55-58

Then save the file

Usb camera 2

sudo gedit /etc/motion/camera2-dist.conf

Screenshot from 2018-02-02 12-57-48

Then save the file

IP Camera

sudo gedit /etc/motion/camera3-dist.conf

Screenshot from 2018-02-02 12-57-03

For the netcam_url  you will have to enter your camera’s url . To see how to get your url using xeoma please refer this blog here 

I have created a target directory for videos generated when a motion is detected in my Video directory under the home directory as shown in the above .You can make your directory for videos as your wish .But you have to correctly mentioned path in the configure  files.

Now you can see the 3 cameras operating in the following figure when you open the Ubuntu terminal and enter the following command to start Motion

sudo /usr/bin/motion

Then open the web browser and enter the url

http://localhost:8080/

 

In the web panel itself there are facilities provided to start ,restart , stop motion program.  The stopping  or resuming motion detection also can be done using the web panel .

How to add a startup icon for start Motion

Please use the Mainmenu program to add an icon as in the following figure

launchercommand

How to upload motion detection videos instantaneously  to dropbox cloud using dropbox sync in order to view remotely

Make a symlink of the folder of motion detection videos and copy it to the dropbox sync directory in the home page as follows

link

sudo ln -s /home/bkjaya1952/Videos/bkj /home/bkjaya1952/

link

Now you can copy the symlink  folder to the dropbox sync floder

dropboxlinking

You can see the videos are being uploaded to the dropbox cloud in the above figure

How make alarm sounds when a motion is detected

First store a alarm sound clip in a folder of your PC

Install mplayer software using the Ubuntu software center

In my case My-recording-1.wav.wav  file has been saved in /home/bkjaya1952/Music

Open the terminal and enter

sudo gedit /etc/motion/camera2-dist.conf

Screenshot from 2018-02-03 09-31-32

Please enter the following line as shown in the above figure and save the file.

on_motion_detected mplayer /home/bkjaya1952/Music/My-recording-1.wav.wav

and save the file

Now you can hear an alarm sound when a motion is detected by the camera 1

 

How to record the sound using the camera microphone when a motion is detected

The program “arecord” needs to be installed on your system and you need a full working “motion” installation on your system.

Following example shows how to record sound using the camera 2

Open the terminal and enter

sudo gedit /etc/motion/camera2-dist.conf

Then the camera2-dist.conf

Edit the file as shown in the figure below

Screenshot from 2018-02-03 17-59-56

Please see the command line no 10

on_event_start arecord -d 60 -f cd /home/bkjaya1952/Videos/bkj/c4/%v-%Y%m%d%H%M%S.mp3

Here the duration of the recording is limited to 60 seconds (-d 60) in my case as the maximum duration of a motion detection of an alarm  event in the main file (motion.conf) is limited to 60 seconds.

In my case the recorded sound file is saved at  the directory of  /home/bkjaya1952/Videos/bkj/c4/

 

Motion linux is a very useful software in making cctv systems.

We must be thankful to the developers of Motion Lunux for providing us a great cctv software free of charge

Advertisements

How to access Box.com account using cadaver on the Ubuntu terminal

cadaver is a command-line WebDAV client for Unix

Install cadaver

Open the Ubuntu terminal

sudo apt-get cadaver

After installation if you enter following command on the terminal you will able to access box.com account ( you will have to enter the user and password of the box.com account)

sudo cadaver https://dav.box.com/dav

Screenshot from 2017-12-31 19-36-56

Then enter help to obtain cadaver commands

Screenshot from 2017-12-31 19-38-19

If you enter ls you will be able to see the files and folders in your box.com account

Screenshot from 2017-12-31 19-38-47

 

You can upload or download files on box.com account as follows

 

Uploading a file (bk.jpg)  in the home directory of PC to box.com

Using lls command you can access file list in the home directory of PC

then enter

put remote bk.jpg

details are in the following figures

 

Our next  target is to make  above process automatically

 

  1. making a script to load box.com
  2. save user and password of box.com account in file in order to access automatically

 

Saving password on netrc

sudo gedit ~/.netrc

Screenshot from 2017-12-31 16-41-55

machine dev.box.com login USERNAME password PASSWORD

Here your USERNAME and PASSWORD of the box.com account has to be entered

 

Save file in the home directory of the PC and exit to shell prompt. Make sure, only owner can read the file:
$ chmod 0600 ~/.netrc

 

Screenshot from 2017-12-31 16-42-47

Making a script file to load box.com

sudo gedit boxcom.sh

Enter following lines in boxcom.sh file and save it in the home directory of the Ubuntu PC

Screenshot from 2017-12-31 23-56-20

Then using Main Menu software make an executable icon

 

 

 

 

How to solve the problem of blank screen in RealVNC viewer when connecting with remote Desktop of Ubuntu 17.10 (Artful Aardvark)

To get the details of installing RealVNC server on the computer Please Refer this site

The default desktop of Ubuntu 17.10 can not be viewed remotely using  RealVNC viewer as it gives a blank screen.

Screenshot from 2017-10-22 18-51-59

Desktop view of the Ubuntu 17.10 PC with RealVNC server

 

Screenshot_2017-10-22-18-52-48

Blank screen of the mobile phone with RealVNC viewer when trying to connect with the Ubuntu 171.10 PC

 

To view the remote desktop I have successfully adopted the following simple procedure.

The default desktop of Ubuntu 17.10 ,has to be changed from Ubuntu to Ubuntu on Xorg

Start computer and make changes (select Ubuntu on Xorg) in the Ubuntu login screen as follows

IMG_20171022_174754

Ubuntu login screen

Then enter the password of the computer and start

Now the problem is solved

Screenshot from 2017-10-22 18-05-09

Desktop screen of the Ubuntu 17.10 PC (wih RealVNC server)

 

Screenshot_2017-10-22-18-05-25

Remote view of the Ubuntu 17.10 PC on a mobile phone ( with RealVNC viewer)

How to install Zoneminder 1.30.4 on Ubuntu 17.10(Artful Aardvark)

First  remove  zoneminder completely using synaptic package manager or some other method .Then  clean the remaining items using  the janitor of  Ubuntu Tweak .

Open the Ubuntu terminal

You will have to refer iconnor  for adding Adding Zoneminder  PPA to your system.

Open the Ubuntu terminal

sudo su

add-apt-repository ppa:iconnor/zoneminder
 apt-get update
 apt-get upgrade
 apt-get dist-upgrade
Install Zoneminder

 

Install Zoneminder 1.30.4 using the Synaptic package manager

(Ubuntu Software Center in Ubuntu 17.10 does not have Zoneminder)

rm /etc/mysql/my.cnf

cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf

gedit /etc/mysql/my.cnf

add the following line at 32

sql_mode = NO_ENGINE_SUBSTITUTION

Screenshot from 2016-04-23 21-38-28

Then save my.cnf

systemctl restart mysql

Create Zoneminder database in MySQL (Note: this also creates the default Zoneminder user and permissions in MySQL)

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
mysql -uroot -p -e "grant all on zm.* to 
'zmuser'@localhost identified by 'zmpass';"

mysqladmin -uroot -p reload

chmod 740 /etc/zm/zm.conf

chown root:www-data /etc/zm/zm.conf

adduser www-data video

a2enmod cgi

a2enconf zoneminder

a2enmod rewrite

chown -R www-data:www-data /usr/share/zoneminder/

systemctl enable zoneminder

service zoneminder start

Add timezone to PHP

gedit /etc/php/7.1/apache2/php.ini

edit line 939 with your timezone

Screenshot from 2017-10-20 14-36-56

Then save the file php.ini

Your time zone can be get from here 

service apache2 reload

Open Zoneminder http://localhost/zm/
 Screenshot from 2017-10-20 14-42-57
Referance Zoneminder Wiki

 



 

How to access localhost using ngrok free account and dropbox over the internet (Ubuntu 16.10)

OS of my PC is Ubuntu 16.10

First install ngrok on the the PC  Please refer the official web site

Extract  the downloaded zip file in to the home directory of the PC

Now if you run ./ngrok http 80 you will get the ngrok panel as follws

Screenshot from 2017-03-21 00-00-55

ngrok running on the terminal

Screenshot from 2017-03-21 00-02-13

ngrok web interface

If you copy the Forwarding web links on the web browser of a remote computer ,local host of the forwarding computer will appear on the screen.

The main problem in the free ngrok is ,the forwarding link is not a fixed one .Every time you start ngrok ,you will get a different link address .Therefore you can not access the localhost of the computer ,without knowing the forwarding address .

If you can save the ngrok web interface as a pdf file and upload in to a free dropbox account ,you will be able to access it over the internet and connect with the link .

Therefore it is necessary to install dropbox on the hosting computer.Installation of  dropbox  can be easily done using the Ubuntu Software center .


 

wkhtmltopdf is installed for saving html files as pdf

 

sudo apt-get install wkhtmltopdf

 

In order to start dropbox , ngrok at the startup of the PC and saving ngrok forwarding links to dropbox and uploading to the cloud automatically , I have written a script shown below

 

Open the terminal and run

 

sudo gedit testngrok.sh

 

Copy the following script in to the testngrok.sh and save the file in the home directory

 


 

#!/bin/bash

dropbox start -i

gnome-terminal -e ‘./ngrok http 80 ‘

xdg-open http://127.0.01:4040/inspect/http

rm ~/Dropbox/Public/ngrok/*

sleep 20

wkhtmltopdf http://127.0.01:4040/inspect/http ~/Dropbox/Public/ngrok/ngrok.pdf

 


 

Then to make executable testngrok.sh run on th terminal

chmod +x ~/testngrok.sh

Now if you run ./testngrok.sh on the terminal ,dropbox and ngrok will 
start and the forwarding links are uploaded to the dropbox cloud.

If you want to start the above process at the startup of PC ,the script
has to be added in to the startup applications .
Screenshot from 2017-03-21 00-38-01

Adding the script to the menu launcher
Screenshot from 2017-03-21 00-40-46.png
Adding the script to the startup applications

When you start the computer the above script will activate automatically
and save the forwarding links in the dropbox cloud so that the localhost
can be accessed remotely.


Screenshot from 2017-03-21 00-45-24.png  

Saved forwarding links file on the dropbox folder of the local computer

Screenshot from 2017-03-21 00-48-06


Saved forwarding links in the dropbox cloud

If you place the cursor and press on the link you will be able to 
access the local host of the forwarding computer

How to Install and Configure VNC® Server 6.0.2 on Ubuntu 16.10 and remotely connect the computer with a mobile phone using free VNC cloud home connction

VNC Connect is a flexible and secure remote access software for computers.The details can be obtained from the official web site of RealVNC.

First download the linux vnc connect deb file from the vnc web site. in to the computer

and extract the deb file .(you will get 2 files of server and viewer installers)

install VNC-Server-6.0.2-Linux-x64.deb using the official installer of Ubuntu.Screenshot from 2017-03-13 17-03-50

To start the server open the Ubuntu terminal and run

sudo systemctl start vncserver-x11-serviced.service

Now you can see an icon on the panel to indicate  the sever is running

Screenshot from 2017-03-13 20-33-59

After installing you will not be able to see any launcher icon. In this type of situation Mainmenu appication is useful in creating a launcher.Since  Mainmenu is not a default software in Ubuntu 16.10  we will have to install it manually.

Open the Ubuntu terminal and run

sudo apt-get update
sudo apt-get install alacarte


Now if you run  the mainmenu you will find the vnc server under the 
applications/other menu

Screenshot from 2017-03-13 19-04-27

If the VNC server is not available, you can add an item.

Go to the Launcher properties and edit as follows

Screenshot from 2017-03-13 19-09-13

Under the Command cage enter the following  to enable the server start at the boot time of the computer and include it to Startup Applications

gksu systemctl start vncserver-x11-serviced.service

and press OK

Screenshot from 2017-03-13 19-21-43

Now the VNCServer is installed on Ubuntu 16.10 correctly

Screenshot from 2017-03-13 19-27-57


The next step is to sign up for a free VNC Cloud home account

Go to this REAL VNC website and sign up for a free cloud home account

To connect the sever with the cloud

Now place the mouse pointer on the vnc sever icon on the  panel at the top of the desktop and right click to get the menu and make the licensing for the cloud connection

 

 

Screenshot from 2017-03-13 17-10-56

Now open the cloud to see weather the computer is connected

Go to the vnc  cloud and sign in

Screenshot from 2017-03-13 19-59-25.png

Screenshot from 2017-03-13 20-00-44

Screenshot from 2017-03-13 20-01-32

 

Now you can see the computer with the vnc server is connected to the vnc cloud


The next step is to connect the computer running   the vnc server remotly  over the inter net using a mobile phone

First VNC Viewer for remote desktop application is installed on the phone

Open the app and connect to the computer using the vnc password saved in the server previously .

2017-03-13-123814

 

 

How to remotely control your Raspberry pi 3 over the internet using a RealVNC cloud connection

The VNC connect (RealVNC Server and the Viewer) has  been installed by default on the Raspbian OS make available for  Raspberry pi 3 .

But the VNC connect installed by default on Raspberry seems to be an Old version which does not permit VNC cloud connection.Therefore you will have to upgrade the software to version 6 at the start.

Updating software

Open the terminal an run

sudo apt-get update

sudo apt-get upgrade

Then sign up for a free VNC Cloud account  available for the home users

Signing up for free home cloud account

Then you will have to make changes in the Raspberry setup to activate the VNC Server at the booting and to facilitate the connection with the cloud and the licensing

screenshot-from-2017-03-05-22-43-22

Activating VNC Server at boot time

On the Raspberry pi menu go to

Preferences/Raspberry Pi Configuration/interfaces/

Screenshot from 2017-03-05 22-43-51.png

and enable VNC and SSH

Then re boot the Rasberry pi

Now you can see the Sever icon on the panel.

screenshot-from-2017-03-04-22-34-44

VNC server running on Raspberry Pi 3

Place the mouse pointer on the vnc sever icon and  right click

Then go to Licensing and connect the Raspberry with the cloud

Licensing for free cloud account

facilitating head less remote connection for the Raspberry  Pi 3

Place the mouse pointer on the vnc sever icon and  right click

Select Options/connections/

Make the check  boxes as shown in the following figures

Now If you sign in to your cloud account, you can see your Raspberry pi is connected to the cloud

screenshot-from-2017-03-04-22-43-51


Cloud connection with raspberry Pi

Accessing the Raspberry Pi desktop from the remote computer

Install the VNC Viwer on the remote computer

My Os on the remote  computer is Ubuntu 16.10

Start the VNC Viwer  and connect to the Raspberry Pi  over the cloud

screenshot-from-2017-03-06-11-48-05

screenshot-from-2017-03-05-23-28-02

Raspberry Pi desktop on the remote computer

 

Controlling Zoneminder CCTV system installed on the Rasberry Pi using the remote computer