Ieee Paper 2
Ieee Paper 2
Abstract—In this research work we have developed a to implement required functionality and zigbee wireless
platform to remotely control a surveillance robot over internet. It modules were used for wireless communication between the
will enable us to monitor the activities in the remote and sensitive nodes. In [2] G. Song et.al proposed hybrid node based
areas. In traditional security systems, fixed locations are used for networking with 3 layer architecture. Basically heterogeneous
monitoring and spying purposes. For such cases, our robotic
mobile sensor nodes were used to implement the system. In
system is mobile and it can go into those areas where human
access is risky, impossible or not suitable and provide us with the [3] W.Lao et.al presented a frame work for human surveillance
footage of those locations. The camera mounted on the robot which can detect & monitor health care problems. In [4], a
keeps on capturing the video. This live video from robot will be robotic arm was controlled & monitored on a web page using
streamed on web page and it will be used for both surveillance microcontroller and Raspberry Pi. Robotic arm was developed
and controlling the robot movement accordingly. The movement using ATmega microcontroller while the Raspberry Pi was
algorithm of the robot is implemented using CGI scripts and the used for monitoring and processing purpose. In 2017 a spy
monitoring is done by utilizing the MJPG video streamer. The robot was implemented using python language & IP using
aim is to control the robot from anywhere in the world via web Raspberry Pi [5]. In [6-7] autonomous robots were developed
page and to make the delay time as little as possible. The
using Arduino platform. We proposed a new idea to develop
proposed system has a great potential to be used commercially
due to its efficient response, vast applications and economical spy robot using CGI scripts and MJPG video streamer on
value. Raspberry Pi platform. CGI scripts are server readable shell
scripts. In our case, they are more efficient than any other
Keywords—RaspberryPi; CGI; Scripts; MJPGStreamer; Robot; high-level language like python as they don’t need GUI and
Web. any IDE but a simple text editor. Shell scripts are command
lines writing in a text file. We have used bash shell scripts
I. INTRODUCTION which are written in bash language developed by Brian Fox
In today’s world, robots are increasing rapidly and they are [8]. Main advantage behind using bash scripts is the simple
interface for writing and executing them. Limitation of the
being used in some of the popular fields like industrial areas,
system is that Wi-Fi or internet connection on both server and
for defense purpose and research communities. This research
client ends should be fast enough to avoid delay. On server
paper presents the designing and implementation of a robot for
the surveillance use as well as for the military purposes. Since side, we can also directly attach mobile network (3G/4G
the cost of a robot is very less than hiring a human being so, dongle) with Raspberry Pi to avoid Wi-Fi range issues.
we can invest in them easily. And by the time they can be Section II of this research article briefly describes the whole
reprogrammed with more efficient technology. The robot has overview of the system. In section III, IV, V, we have
sufficient intelligence to cover the larger areas to provide a described the project hardware & software in detail. Hardware
secured space. The intelligent robots can perform preferred mainly consists of Raspberry Pi board and other important
tasks in unstructured environments with or without human electrical equipment. While software we used are Nano text
direction. In [1] J.Zhang et.al presented an idea of surveillance editor for CGI scripts, on Raspberry pi platform. The working
robot for indoor security system. PIR sensor nodes were used of the hardware part includes the Raspberry Pi model & the
978-1-5386-7729-2/19/$31.00©2019 IEEE
Proceedings of 2019 16th International Bhurban Conference on Applied Sciences & Technology (IBCAST) 947
Islamabad, Pakistan, 8th – 12th January, 2019
motors. In section VI we have shown the results which are the board which supports many software packages and IDEs for
screenshots of different software codes and monitoring almost all languages like Perl, Python, Java, C++ etc. which
system. help the users to design anything they want.
II. SYSTEM OVERVIEW Raspberry Pi supports many Linux and non-Linux operating
systems. Raspbian OS is installed in Raspberry Pi, which is
The whole working of the surveillance robot is shown in
the official operating system for it. Raspbian is a Linux based
figure 1. The system comprises of two nodes. One is server
operating system designed for Raspberry Pi. Raspberry Pi 3 is
side and the other one is the client side. On the server side,
known for its versatility and inexpensiveness. In our case,
there is a robot body, motor driver circuitry, Raspberry Pi and
Raspberry Pi is working as server for web page and driving
camera attached to it while on the client side, there is a web
the robot. As the internet doesn’t have any range limitation, so
page showing live video stream from the site under
the web page can be accessed from anywhere we want. Robot
surveillance and different buttons to control the robot.
is being controlled through the web page by the user which is
Raspberry Pi, attached to the robot, is also working as a
sitting on the client side. The web page is being used to
webserver for web page. The client and the server are
perform two tasks i.e. controlling the direction of robot and
communicating through internet. On the server side four
streaming the live video of the field. A Raspberry Pi camera is
motors are being used to drive the robot. The speed of the
mounted on the robot to get the live video stream. Web page is
robot is controlled by varying Pulse Width Modulation
then accessed using Port Forwarding. The application is
(PWM) signal applied to the motors from Raspberry Pi’s
developed by utilizing CGI Scripts. CGI Scripts are server
PWM pin. It will move in a particular direction based on the
readable scripts. We have written our code in shell (Bash)
scripts. Bash is an interpreter for our shell scripts. It is a
scripting language developed for Linux and UNIX-based
operating systems.
The robot has four motors which are being controlled by the
Figure 2: Server side hardware block diagram
Raspberry Pi through the GPIO pins. We have connected the
two left side motors in parallel so they can run together.
The robot is actually based on Raspberry Pi 3 model B Similar method is applied to right side motors. The GPIO pin
which has some important features like 64bit, 1.2 GHz quad 05 (physical pin 29), GPIO pin 6 (physical pin 31) are used to
core processor, 1 GB RAM and inbuilt wireless controller. It run the left-side motors and GPIO pin 13 (physical pin 33),
also has 4x USB 2.0 ports, full size HDMI 1.3a port, camera GPIO pin 19 (physical pin 35) are used to run the right-side
interface and Micro SD card slot. Raspberry Pi is a small motors. As Raspberry Pi cannot provide required current to the
Proceedings of 2019 16th International Bhurban Conference on Applied Sciences & Technology (IBCAST) 948
Islamabad, Pakistan, 8th – 12th January, 2019
motors so we are using L298N motor driver module to cater placed in folder named CGI-bin in the default directory of the
this problem. Furthermore, the web page has different webserver.
directions buttons like forward, left, right, reverse, stop and
By default, the lighty webserver will look for the files for
speed buttons like slow speed, normal speed and fast speed.
web page in /var/www/html directory of Raspberry Pi. It is
The screenshot of web page is given in the figure 6.
changed to /var/www directory by editing the lighttpd
To increase the view angle of camera, a pan/tilt mechanism configuration file in /etc/lighttpd/lighttpd.conf directory. Then
is implemented for horizontal and vertical movement of the CGI-bin folder is created in this directory and all the CGI
camera. The setup is implemented using two servo motors. We scripts are copied in it. After that web page files (HTML, CSS
have controlled the setup from the web page successfully and JavaScript) are placed in this folder along with the images
using python CGI Scripts. which will be used in place of buttons on web page. To enable
all changes just reload the server by following command,
A power bank of 5 volts, 2.4 Ampere rated current is used
for Raspberry Pi. Its other port of 5 volts and 2.1 Amperes of Sudo service lighttpd restart
current is being used for powering servo motors.
To access the web page on local network, just open the IP
IV. SOFTWARE IMPLEMENTATION address of Raspberry Pi on a device connected to same
network and web page will be opened.
To implement the software functionality, we have used bash
scripts and web languages like HTML, CSS and JavaScript. Since a media (pics/video) is needed on web page for
HTML provides basic structure for designing sites which is controlling the robot and for spying purposes as well, MJPG
improved by CSS. CSS customizes the color schemes, streamer is used for simple video streaming which fulfilled our
presentation and formatting. JavaScript is used for running requirement [10]. After downloading it, its directory is
scripts at server side. Internet of things is the communication changed by following command,
between human to human, human to things and things to
cd ~/MJPG-streamer/MJPG-streamer-experimental.
things. It is the controlling of sensors, actuators and devices
over the internet. The robot is also controlled over internet by To compile and run we used following commands,
sending commands through web page and respective function
make clean all
is performed at the remote end.
To run the streamer on startup, rc.local file is opened, which
To make Raspberry Pi work as a webserver for our web
execute the commands on startup of Raspberry Pi.
page, we have installed Lighttpd webserver, also known as
Lighty. Lighty is a very responsive webserver with very less sudo nano /etc/rc.local
load on CPU, as compared to other available options. To
Following lines are placed in this file,
install this, following command is used.
LD_LIBRARY_PATH=/opt/MJPG-streamer/ /opt/MJPG-
sudo apt-get -y install lighttpd
streamer/MJPG_streamer –I”input_raspicam.so –fps 15 –q
Shell scripts are written in text file just by adding a bash line 50 –x 640 –y 480”-o”output_http.so –p 9000 –w/opt/MJPG-
in start. CGI scripts are shell scripts ended with .CGI streamer/www”
extension, which enable them to be executed by the server as
After that, MJPG streamer starts automatically when
server cannot read scripts directly with .sh format. As in
Raspberry Pi boots up.
Raspberry Pi, we have used Nano text editor for writing them.
In start we have added the following line, To access the web page outside of network, Port Forwarding
is used. It enables the remote access to servers and computers
#!/bin/bash
which are inside private networks, by using the IP address and
This command enables the Raspberry Pi to know that file is port numbers.
a script which will be interpreted by Bash placed in /bin/bash
The main thing is, port forwarding is tested on network with
directory.
a Dynamic IP address. Dynamic DNS Services from NO-
The code is written in these multiple scripts for controlling IP.com is used which gives a hostname for a device and
motor direction (forward, backward, left, and right) and speed. automatically updates the WAN IP address behind that
hostname. So, the client has fixed hostname behind which the
To enable CGI scripts handling by the lighttpd webserver,
IP address changes as soon as the WAN IP address of remote
we have used following command on terminal window of
network is changed.
Raspberry Pi.
Figure 4 explains the execution of CGI scripts in Raspberry
sudo lighttpd-enable-mod CGI
Pi. Raspberry Pi is working as server. It can be accessed by IP
Now lighttpd can handle CGI scripts as well [9]. The above address and specified port number. After opening web page,
command creates a new file in /etc/lighttpd/mods-enabled/10- button is pressed and respective script is called and robot
CGI.conf which have the required settings to handle the CGI performs the corresponding function. The robot will keep
scripts. This file specifies that the CGI scripts should be moving in desired direction unless any other button is pressed.
Proceedings of 2019 16th International Bhurban Conference on Applied Sciences & Technology (IBCAST) 949
Islamabad, Pakistan, 8th – 12th January, 2019
"use strict";
xmlhttp.open("GET","CGI-bin/forward.CGI", true);
xmlhttp.send(); }
When the forward() function runs, forward.CGI script in
Raspberry Pi will be executed. The sample of this is given as
under,
#!/bin/bash
gpio -g write 5 1
gpio -g write 6 0
gpio -g write 13 1
gpio -g write 19 0
Similarly, the HTML tag, CGI scripts codes and functional
implementation of backward, right and left button are
implemented in Raspberry Pi in similar fashion.
Figure 4: Software design flowchart
Figure 5 explains the speed controlling of robot. Four
buttons are specified for speed controlling on basis of PWM.
The Raspberry Pi has PWM range of 0-1023. So when any
speed button is pressed, script will be called and respective
PWM will be set to maintain the required speed until any other
speed button is pressed.
V. RESULTS
Figure 6 shows the web page of secured surveillance robot.
function forward() {
Proceedings of 2019 16th International Bhurban Conference on Applied Sciences & Technology (IBCAST) 950
Islamabad, Pakistan, 8th – 12th January, 2019
Figure 7 is a screenshot showing the rc.local script file After all, Pan/Tilt mechanism is also installed using servo
placed in /etc/rc.local directory in Raspberry Pi. rc scripts motors and controlled from web page using python scripts.
which are used to start and stop system services in Linux.
rc.local script runs after all normal system services are started. VI. CONCLUSION
This file contains the commands and code lines to be executed
In this research paper we have presented a new idea to
on startup. So, to run our MJPG Streamer on startup, we
implement a surveillance robot based on CGI scripts and
placed the relevant command in this file. After boot,
MJPG video streamer using Raspberry Pi. The movement of
Raspberry Pi automatically starts streaming from camera
robot is controlled using a web page on a client side through
module. Required pins are also declared as output and input in
internet. On the server side a camera is mounted on a
this file. So, robot is ready to move on Raspberry Pi start-up.
Raspberry Pi which is continuously capturing the video. That
real-time video is streamed to webpage by utilizing MJPG
streamer and robot is controlled accordingly. We have tested
and implemented the whole system practically. The system
can be made a universally accessed robot using port
forwarding or other suitable techniques. It may be connected
to an external webserver so that the web page can be accessed
using a domain of our own choice like a website. The
Figure 8: Forward driving script
Prototype we presented, can be manipulated and modified for
various purposes.
Figure 8 shows how our CGI scripts look like in Nano text
editor of Raspberry Pi’s Terminal window. Screenshot of REFERENCES
forward.CGI script shows the pin values to drive our robot
motors in forward direction.
[1] J. Zhang, G. Song, G. Qiao, T. Meng and H. Sun, "An indoor
security system with a jumping robot as the surveillance
terminal," in IEEE Transactions on Consumer Electronics, vol.
57, no. 4, pp. 1774-1781, November 2011.
[2] G. Song, Z. Wei, W. Zhang and A. Song, "A Hybrid Sensor
Network System for Home Monitoring Applications," in IEEE
Transactions on Consumer Electronics, vol. 53, no. 4, pp. 1434-
1439, Nov. 2007.
[3] W. Lao, J. Han and P. H. n. De With, "Automatic video-based
human motion analyzer for consumer surveillance system," in
IEEE Transactions on Consumer Electronics, vol. 55, no. 2, pp.
591-598, May 2009.
[4] Pandapotan Siagian and Kisno Shinoda, “Web Based Monitoring
and Control of Robotic Arm Using Raspberry Pi”, International
Conf. on Science in Information Technology, pp. 192-196, 2015
Figure 9: HTML File of web page
[5] P. Siagian and K. Shinoda, “Web based monitoring and control of
Similarly, the above screenshot in Figure 9 shows the robotic arm using Raspberry Pi,” in 2015 International Conference
index.html file, opened in Nano text editor of Raspberry Pi, on Science in Information Technology (ICSITech), 2015.
[6] Mondal, I., & Chatterjee, S. (2018). Temperature sensing dynamic
placed in /var/www/ directory which is default directory of our autonomous robot with video streaming capability. In 2018
lighttpd server. Similarly other files like style.css and java.js Second International Conference on Computing Methodologies
are also placed in this directory to be used for web page. and Communication (ICCMC). IEEE.
[7] Chen, L., Zhang, J., & Wang, Y. (2018). Wireless Car Control
System Based on ARDUINO UNO R3. In 2018 2nd IEEE
Advanced Information Management, Communicates, Electronic
and Automation Control Conference (IMCEC). IEEE.
[8] G. Venkitachalam and Tzi-cker Chiueh, "High performance
Common Gateway Interface invocation," Proceedings 1999 IEEE
Workshop on Internet Applications (Cat. No.PR00197), San Jose,
CA, 1999, pp. 4-11.
[9] W. ZhenXing and R. XianYi, "A Study on CGI of Embedded
Webserver," 2008 International Symposium on Computer Science
and Computational Technology, Shanghai, 2008, pp. 480-483.
doi: 10.1109/ISCSCT.2008.16
[10] Yanjia Cao, Jing Hu, Tiecheng Song, Hao Zhang, jinghong Guo,
“Design and implementation of power communication terminal
based on link aggregation technology”, International Conf. on
Figure 10: The front view of the surveillance robot. Control Automation and Information Sciences 2016, pp. 48-53,
2016
Proceedings of 2019 16th International Bhurban Conference on Applied Sciences & Technology (IBCAST) 951
Islamabad, Pakistan, 8th – 12th January, 2019