Python based spy robot controlled over Ethernet using Raspberry pi

Aim of the project:

In this project we have developed a platform to remotely control surveillance robot controlled over Ethernet. It will enable us to monitor the activities in the remote and sensitive areas such as naxalite areas and etc.

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 it will send an indication to the user. Meanwhile, the camera mounted on the robot will keep on capturing the photos from the surroundings to keep a record of the details of the incident happened and this is readily available to the user.

General Application of circuit:


In military it is mainly used in  boarder, in boarder it will monitor the  motion of enemies and it alerts the army and it also capture the photos of enemies and it will send the data with high security and  high speed  through Ethernet cable .Python based spy robot controlled over Ethernet using Raspberry pi


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 .


Block diagram:

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, and has since been refined to support higher bit rates and longer link distances. Over time, Ethernet has largely replaced competing wired LAN technologies such as token ringFDDI, 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 damaged data can be detected and re-transmitted. As per the OSI model, Ethernet provides services up to and including the data link layer.

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 but different surface characteristics may also have a different infrared emission pattern, and thus 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:-

The 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 it 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 megapixel, and has a fixed focus lens onboard. In terms of still images, the camera is capable of 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, which includes 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 the different models all 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,.

Pin diagram of the 8051 DIP

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 only connect 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 which 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.


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 from 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 can be seen from 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. 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. We now 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 suited for 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.Python based spy robot controlled over Ethernet using Raspberry pi schematic


DC motor is any of 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 type 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.

Working of the circuit:-

Raspberry pi consist internally python IDE tool. We use this tool we write the code for control the pi camera,pir sensor and motors. in this pir sensor activate i.e. if any motion is detected the pi camera automatically capture the images and displayed on screen. for control the robot a GUI is designed .click the required button in GUI for the motion of the robot. the raspberry pi give the instructions to the AT89S52 microcontroller and the controller will control the related moving task and display the lcd display to the status of robot.


For more detail: Python based spy robot controlled over Ethernet using Raspberry pi

About The Author

Scroll to Top
Read previous post:
Push Button Sample

In this sample, we connect a push button to your Raspberry Pi 2/MinnowBoard Max and use it to control an...