Aim of the project:
In this project we have developed a platform to remotely control a surveillance robot over Ethernet. It will enable us to monitor the activities in the remote and sensitive regions such as naxalite areas.
In traditional security systems, monitoring devices are usually mounted on fixed locations. In such cases, we may use the proposed robotic system which will go into those areas and provide us with the photos of those locations. When someone enters such secured places, then PIR sensor senses it and immediately sends an indication to the user. Meanwhile, the camera mounted on the robot keeps on capturing the photos from the surroundings to keep a record of the details of the incident and this is readily available to the user.
General Application of circuit:
Military:
In banks, it is mainly used in locker rooms for more security. If any motion is detected in locker rooms, it captures the photos automatically.
Banks:
In banks it is mainly used in locker rooms for more security. If any motion is detected is in locker rooms it will capture the photos automatically .
3.Description:-
Block diagram:
Fig. 1: Block Diagram of Raspberry Pi and Pi Camera Based Intruder Detector
Ethernet :
Fig. 2: Image showing Ethernet Cable connecting Raspberry Pi with PC
It is a family of computer networking technologies for local area networks (LANs) and metropolitan area networks (MANs). It was commercially introduced in 1980 and first standardized in 1983 as IEEE 802.3, Since then it has been refined to support higher bit rates and longer link distances. Over time, Ethernet has largely replaced competing wired LAN technologies such as token ring, FDDI, and ARCNET. The primary alternative for contemporary LANs is not a wired standard, but instead a wireless LAN standardized as IEEE 802.11 and also known as Wi-Fi.
The Ethernet standards comprise several wiring and signaling variants of the OSI physical layer in use with Ethernet. The original 10BASE5 Ethernet used coaxial cable as a shared medium. Later, the coaxial cables were replaced with twisted pair and fiber optic links in conjunction with hubs or switches. Over the course of its history, Ethernet data transfer rates have been increased from the original 3 megabits per second (Mbit/s) to the latest 100 gigabits per second (Gbit/s), with 400 Gbit/s expected by early 2017.
Systems communicating over Ethernet divide a stream of data into shorter pieces called frames. Each frame contains source and destination addresses and error-checking data so that the damaged data can be detected and re-transmitted. As per the OSI model, Ethernet provides up-to-date services including the data link layer.
PIR sensor:-
Fig. 3: Typical Image of PIR Sensor
An individual PIR sensor detects changes in the amount of infrared radiation impinging upon it, which varies depending on the temperature and surface characteristics of the objects in front of the sensor.] When an object, such as a human, passes in front of the background, such as a wall, the temperature at that point in the sensor’s field of view will rise from room temperature to body temperature, and then back again. The sensor converts the resulting change in the incoming infrared radiation into a change in the output voltage, and this triggers the detection. Moving objects of similar temperature to the background and different surface characteristics may also have a different infrared emission pattern, which may sometimes trigger the detector.
PIRs come in many configurations for a wide variety of applications. The most common models have numerous Fresnel lenses or mirror segments, an effective range of about ten meters (thirty feet), and a field of view less than 180 degrees. Models with wider fields of view, including 360 degrees, are available—typically designed to mount on a ceiling. Some larger PIRs are made with single segment mirrors and can sense changes in infrared energy over one hundred feet away from the PIR. There are also PIRs designed with reversible orientation mirrors which allow either broad coverage (110° wide) or very narrow “curtain” coverage or with individually selectable segments to “shape” the coverage.
Raspberry pi:-
The Raspberry Pi is a series of credit card-sized single-board computers developed in the UK by the Raspberry Pi Foundation with the intention of promoting the teaching of basic computer science in schools.
The original Raspberry Pi is based on the Broadcom BCM2835 system on a chip (SoC), which includes an ARM1176JZF-S700 MHz processor, Video Core IV GPU, and was originally shipped with 256 megabytes of RAM, later upgraded (models B and B+) to 512 MB. The system has Secure Digital (SD) (models A and B) or Micro-SD (models A+ and B+) sockets for boot media and persistent storage. In 2014, the Raspberry Pi Foundation launched the Compute Module, which packages a BCM2835 with 512 MB RAM and MMC flash chip into a module for use as a part of embedded systems.
Pi camera:-
Fig. 4: Typical Image of Pi Camera
Raspberry Pi Camera Module is a custom designed add-on for Raspberry Pi. It attaches to Raspberry Pi by way of one of the two small sockets on the board upper surface. This interface uses the dedicated CSI interface, which was designed especially for interfacing to cameras. The CSI bus is capable of extremely high data rates, and exclusively carries pixel data.
The board itself is tiny, at around 25mm x 20mm x 9mm. It also weighs just over 3g, making it perfect for mobile or other applications where size and weight are important. It connects to Raspberry Pi by way of a short ribbon cable. The camera is connected to the BCM2835 processor on the Pi via the CSI bus, a higher bandwidth link which carries pixel data from the camera back to the processor. This bus travels along the ribbon cable that attaches the camera board to the Pi. The sensor itself has a native resolution of 5 megapixels, and has a fixed focus lens onboard. In terms of still images, the camera is capable of capturing 2592 x 1944 pixel static images, and also supports 1080p30, 720p60 and 640x480p60/90 video.
8051 microcontroller:-
The Intel 8051 microcontroller is one of the most popular general purpose microcontrollers in use today. The success of the Intel 8051 spawned a number of clones which are collectively referred to as the MCS-51 family of microcontrollers, including chips from vendors such as Atmel, Philips, Infineon, and Texas Instruments.
About 8051
The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited to 8 bits. There are 3 basic “sizes” of the 8051: Short, Standard, and Extended. The Short and Standard chips are often available in DIP (dual in-line package) form, but the Extended 8051 models often have a different form factor, and are not “drop-in compatible”. All these things are called 8051 because they can all be programmed using 8051 assembly language, and they all share certain features (although all different models have their own special features, some of the features that have made the 8051 popular are:
· 4 KB on chip program memory.
· 128 bytes on chip data memory(RAM)
[ 32 bank reg + 16 bit addressable reg + 80 general purpose reg ]· 4 reg banks.
· 128 user defined software flags.
· 8-bit data bus
· 16-bit address bus
· 16 bit timers (usually 2, but may have more, or less).
· 3 internal and 2 external interrupts.
· Bit as well as byte addressable RAM area of 16 bytes.
· Four 8-bit ports, (short models have two 8-bit ports).
· 16-bit program counter and data pointer.
· 1 Microsecond instruction cycle with 12 MHz Crystal.
8051 models may also have a number of special, model-specific features, such as UART, ADC,.
Fig. 5: Pin Diagram of 8051 Microcontroller
Basic Pins
PIN 9: PIN 9 is the reset pin which is used to reset the microcontroller’s internal registers and ports upon starting up. (Pin should be held high for 2 machine cycles.)
PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to connect only a crystal at these pins to provide clock pulses to the circuit.
PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V 500mA to function properly, although there are lower powered versions like the Atmel 2051 which is a scaled down version of the 8051 that runs on +3V.
PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash memory. In order to program this, we need to supply a voltage of +12V at pin 31. If external memory is connected then PIN 31, also called EA/VPP, should be connected to ground to indicate the presence of external memory. PIN 30 is called ALE (address latch enable), which is used when multiple memory chips are connected to the controller and only one of them needs to be selected. We will deal with this in depth in the later chapters. PIN 29 is called PSEN. This is “program store enable”. In order to use the external memory, it is required to provide the low voltage (0) on both PSEN and EA pins.
Ports
There are 4 8-bit ports: P0, P1, P2 and P3.
PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used for a variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or additional functions associated with them based upon the context of their usage. The port 1 output buffers can sink/source four TTL inputs. When 1s are written to portn1 pins are pulled high by the internal pull-ups and can be used as inputs.
PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional functions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external counter inputs, read and write pins for memory access.
PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P2 will act as an address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as A8-A15, as can be seen in fig 1.1
PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P0 acts as a multiplexed address and data bus that can be used to access external memory in conjunction with PORT P2. P0 acts as AD0-AD7, as seen in fig 1.1
PORT P10: asynchronous communication input or Serial synchronous communication output
Features of raspberry pi:
The model B+ is the final revision of the original Raspberry Pi. It replaced the model B in July 2014 and was superseded by the Raspberry Pi 2 Model B in February 2015. As compared to the Model B, it has:
· More GPIO. The GPIO header has grown to 40 pins, while retaining the same pin out for the first 26 pins as the Model A and B.
· More USB. Now we have 4 USB 2.0 ports, compared to 2 on the Model B, and better hot plug and over current behavior.
· Micro SD. The old friction –fit SD card socket has been replaced with much nicer push –push micro SD version.
· Lower power consumption. By replacing linear regulator with switching ones, we‘ve reduced power consumption by between 0.5W and 1W.
· Better audio. The audio circuit incorporates a dedicated low –noise power supply.
· Neater form factor .We‘ve aligned the USB connectors with the board edge ,moved composite video onto 3.5mm jack, and added four squarely-placed mounting holes.
The Model B+ is perfectly suitable to be use in schools. It offers more flexibility for learners than the learner Model A or A+,which are more useful for embedded projects and projects which require very low power, and has more USB ports than the Model B.
Motor:-
A DC motor is a class of electrical machines that converts direct current electrical power into mechanical power. The most common types rely on the forces produced by magnetic fields. Nearly all types of DC motors have some internal mechanism, either electromechanical or electronic; to periodically change the direction of current flow in part of the motor. Most types produce rotary motion; a linear motor directly produces force and motion in a straight line.
DC motors were the first types to be widely used, since they could be powered from existing direct-current lighting power distribution systems. A DC motor’s speed can be controlled over a wide range, using either a variable supply voltage or by changing the strength of current in its field windings. Small DC motors are used in tools, toys, and appliances.
Fig. 6: Typical Image of Brushless DC Motor
Working of the circuit:-
Raspberry pi consists of internal python IDE tool. We use this tool to write the code for controlling the pi camera, pir sensor and motors. In this, pir sensor is activated i.e. if any motion is detected the pi camera automatically captures the images and displays them on screen. For controlling the robot, a GUI is designed. Click on the required button in GUI for the motion of the robot. The raspberry pi gives the instructions to the AT89S52 microcontroller and the controller will control the related moving task and display the status of robot on the LCD.
Number of components
1 raspberry pi model B+ board
2 pi camera
3 AT89S52 micro controller
4 PIR sensor
5 16×2 LCD display
6 Motors
Pin number:-
Fig. 7: Pin Diagram of Raspberry Pi
Description of Raspberry Pi:-
Connect PIR sensor output to the GPIO 16 and 1st pin connected 2nd pin and 3rd connected to 6th pin of raspberry pi.
The GPIO 5 is connected to the port 1.0 of the AT89S52 controller and GPIO6,19,13,20,21,26are connected to the Port 1.1,1.2,1.3,1.4,1.5,1.6,of the controller. The LCD data pins are connected to port 3 of the controller, R/W pin is connected to ground, RS,EN pins are connected to port 2.4,2.5 and motors are connected with L293D motor driver to the controller port 2 of micro controller.
Supply voltage values:-
· Raspberry pi – 5v
· AT89S52 – 5v
· L293D – 5v
· LCD – 5v
Project Source Code
###
#include<reg51.h>
sbit sw1=P1^0;
sbit sw2=P1^1;
sbit sw3=P1^2;
sbit sw4=P1^3;
sbit sw5=P1^4;
sbit sw6=P1^5;
sbit sw7=P1^6;
sbit rs=P2^4;
sbit e=P2^5;
void delay(int t)
{
int i,j;
for(i=0;i<t;i++)
for(j=0;j<1275;j++);
}
void lcd_cmd(char p)
{
P3=p;
rs=0;
e=1;
delay(3);
e=0;
}
void lcd_data(char r)
{
P3=r;
rs=1;
e=1;
delay(3);
e=0;
}
void main()
{
char i=0;
char msg1[6]={0x38,0x0e,0x06,0x01};
char msg2[16]="MOVING FORWARD";
char msg3[16]="MOVING BACKWARD";
char msg4[16]="MOVING RIGHT";
char msg5[16]="MOVING LEFT";
char msg6[16]="CAMERA RIGHT";
char msg7[16]="CAMERA LEFT";
char msg8[16]="STOP";
P1=0x00;
P2=0x00;
for(i=0;i<4;i++)
{
lcd_cmd(msg1[i]);
}
lcd_cmd(0x80);
if(sw1==1)
{
while(1)
{
P2=0x0a;
if((sw2==1)||(sw3==1)||(sw4==1)||(sw5==1)||(sw6==1)||(sw7==1))
break;
for(i=0;i<16;i++)
{
lcd_data(msg2[i]);
}
}
}
if(sw2==1)
{
while(1)
{
P2=0x05;
if((sw1==1)||(sw3==1)||(sw4==1)||(sw5==1)||(sw6==1)||(sw7==1))
break;
for(i=0;i<16;i++)
{
lcd_data(msg3[i]);
}
}
}
if(sw3==1)
{
while(1)
{
P2=0x06;
if((sw2==1)||(sw1==1)||(sw4==1)||(sw5==1)||(sw6==1)||(sw7==1) )
break;
for(i=0;i<16;i++)
{
lcd_data(msg4[i]);
}
}
}
if(sw4==1)
{
while(1)
{
P2=0x09;
if((sw2==1)||(sw3==1)||(sw1==1)||(sw5==1)||(sw6==1)||(sw7==1) )
break;
for(i=0;i<16;i++)
{
lcd_data(msg5[i]);
}
}
}
if(sw5==1)
{
while(1)
{
P2=0x40;
if((sw2==1)||(sw3==1)||(sw1==1)||(sw4==1)||(sw6==1)||(sw7==1) )
break;
for(i=0;i<16;i++)
{
lcd_data(msg6[i]);
}
}
}
if(sw6==1)
{
while(1)
{
P2=0x80;
if((sw2==1)||(sw3==1)||(sw1==1)||(sw5==1)||(sw4==1)||(sw7==1) )
break;
for(i=0;i<16;i++)
{
lcd_data(msg7[i]);
}
}
}
if(sw7==1)
{
while(1)
{
P2=0x00;
if((sw2==1)||(sw3==1)||(sw1==1)||(sw5==1)||(sw4==1)||(sw6==1) )
break;
for(i=0;i<16;i++)
{
lcd_data(msg8[i]);
}
}
}
}
For raspberry pi using python:
For PIR sensor:-
from time import sleep
import RPi.GPIO as GPIO
import picamera
from tkinter import *
from threading import Thread
def motion():
photo = PhotoImage(file="hero.gif")
w = Label(master, image=photo)
w.photo = photo
w.pack()
mainloop()
def threadings():
GPIO.setmode(GPIO.BCM)
GPIO.setup(16, GPIO.IN)
while True:
if ( GPIO.input(16) == True ):
print ("Warning - MOTION has been detected!")
with picamera.PiCamera() as camera:
camera.start_preview()
sleep(2)
camera.capture('/home/pi/Desktop/hero.gif')
camera.stop_preview()
master = Tk()
photo = PhotoImage(file="hero.gif")
w = Label(master, image=photo)
w.photo = photo
w.pack()
mainloop()
else:
print ("All is QUIET in RPi...")
sleep(1);
motion()
while True:
t=Thread(target=threadings)
t.start()
t.join()
for robot moving (GUI):-
#! /usr/bin/python
import time # import the time library
from tkinter import * #import Tkinter GUI library
from time import sleep
import RPi.GPIO as GPIO
import picamera
import os
import threading
GPIO.setmode(GPIO.BCM)
GPIO.setup(5,GPIO.OUT)
GPIO.setup(6,GPIO.OUT)
GPIO.setup(16, GPIO.IN)
GPIO.setup(13,GPIO.OUT)
GPIO.setup(19,GPIO.OUT)
GPIO.setup(26,GPIO.OUT)
GPIO.setup(20,GPIO.OUT)
GPIO.setup(21,GPIO.OUT)
def forward():
GPIO.output(5,1)
print ("moving forward")
sleep(2)
GPIO.output(5,0)
def backward():
GPIO.output(6,1)
print ("reverse")
sleep(2)
GPIO.output(6,0)
def Left():
GPIO.output(13,1)
print ("moving left")
sleep(2)
GPIO.output(13,0)
def Right():
GPIO.output(19,1)
print ("moving right")
sleep(2)
GPIO.output(19,0)
def Stop():
GPIO.output(26,1)
print ("robot stoped")
sleep(2)
GPIO.output(26,0)
def camleft():
GPIO.output(20,1)
print ("camera left")
sleep(2)
GPIO.output(20,0)
def camright():
GPIO.output(21,1)
print ("camera right")
sleep(2)
GPIO.output(21,0)
def camon():
with picamera.PiCamera() as camera:
camera.start_preview()
time.sleep(3)
camera.capture('/home/pi/Desktop/hero.gif')
camera.stop_preview()
print ("camera on")
def view1():
os.system('python3 imgaggg.py')
appWindow = Tk()
appWindow.wm_title("PIR BASED VIDEO SURVILLANCE SYSTEM")
appWindow.config(bg = "#828481")
controlFrame = Frame(appWindow, width=50, height = 50, bg="#037481", highlightthickness=2, highlightbackground="#111")
controlFrame.grid(row=10, column=5)
controlFrame1 = Frame(appWindow, width=50, height = 50, bg="#037481", highlightthickness=2, highlightbackground="#111")
controlFrame1.grid(row=10, column=0)
btnFrame = Frame(controlFrame, width=300, height = 300, bg="#037481")
btnFrame.grid()
btnFrame1 = Frame(controlFrame1, width=300, height = 300, bg="#037481")
btnFrame1.grid()
about = "ROBOT CONTROL"
name = Label(btnFrame, width=18, height=1, text=about, font="bold", justify=CENTER, bg="#037481")
name.grid(row=0, column=2)
about = "CAMERA CONTROL"
name1 = Label(btnFrame1, width=18, height=1, text=about, font="bold", justify=CENTER, bg="#037481")
name1.grid(row=0, column=2)
upBtn = Button(btnFrame, text="FORWARD", command=forward, bg="yellow")
upBtn.grid(row=2, column=2, padx=5, pady=5)
downBtn = Button(btnFrame, text="BACKWARD", command=backward, bg="yellow")
downBtn.grid(row=4, column=2, padx=5, pady=5)
leftBtn = Button(btnFrame, text="LEFT", command=Left, bg="yellow")
leftBtn.grid(row=3, column=0, padx=5, pady=5)
rightBtn = Button(btnFrame, text="RIGHT", command=Right, bg="yellow")
rightBtn.grid(row=3, column=3, padx=5, pady=5)
stopBtn = Button(btnFrame, text="STOP", command=Stop, bg="red")
stopBtn.grid(row=3, column=2, padx=5, pady=5)
crightBtn = Button(btnFrame1, text="CAM RIGHT", command=camright, bg="yellow")
crightBtn.grid(row=3, column=3, padx=5, pady=5)
cleftBtn = Button(btnFrame1, text="CAM LEFT", command=camleft, bg="yellow")
cleftBtn.grid(row=3, column=0, padx=5, pady=5)
camon = Button(btnFrame1, text="CAM ON", command=camon, bg="yellow")
camon.grid(row=2, column=2, padx=5, pady=5)
camoff = Button(btnFrame1, text="VIEW", command=view1, bg="yellow")
camoff.grid(row=4, column=2, padx=5, pady=5)
appWindow.mainloop()
GPIO.cleanup()###
Circuit Diagrams
Project Video
Filed Under: Electronic Projects
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.