In the name of Allah, the Compassionate the Merciful “Read in the name of your Lord. Who creates, man from a dot of Blood, Read, your Lord is most Gracious Who teaches by means of the pen, teaches man what does not know”.
INTELLIGENT SPY ROBOT Final Year Project
This project was decided upon because we have always had a huge interest in robotics. Also, this project involves work and research in several areas of electronics. we firstly submitted a guideline as to what we would like to do for the Project. Then our project supervisor added certain things to make it a more respectable project and a more practical one according to the availability of the equipment.
Research was carried out in several areas for this project. Firstly the right hardware had to be chosen for practical reasons. This involved talking to several members of staff and postgraduates, who were very informative and helped and helpful. The hardware decided was the PIC micro controller. The PIC microcontroller for the project is connected to a radio remote control decoder, which basically forms a wireless system between transmitter and receiver. Milestones were decided upon, which are included later in the report. After basic control of the Robot via RF remote had been achieved specific advanced add-ons were considered for the Robot. These are all mentioned later in the report also.
So far in this project we have encountered a number of obstacles and problems. A major setback at the moment is that recently, the tuning of the video camera because it is very much difficult to tune it.
Recently the PC being used in the project broke down and took several weeks to be fixed, which slowed my progress also.
Also due to the opening and closing times of the Labs in the EE Department and the volume of examination work , our progress was limited. Currently we have invested in some lab instruments and tools which now allow us to carry out project work outside the Lab. Now we are very happy because we have completed our project.
“Intelligent Spy Robot” project is designed for the spying purpose .
It is radio controlled and can be operated at a radial distance of 100 ft. Many time our armed soldiers need to venture into the enemy area just to track their activities. Which is often a very risky job, it may cost precious life. Such dangerous job could be done using small spy robot.
All the developed and advanced nations are in the process of making combat robot design, a robot that can fight against enemy. Our robot is just a step towards similar activity.
This robot is radio operated , self powered , and has all the controls like a normal car. A laser gun has been installed on it so that it can fire on enemy remotely when required. This is not possible until a wireless camera is installed. Wireless camera will send real time video signals which could be seen on a remote monitor and action can be taken accordingly. Spy robot System Overview Diagram
The aim of the project is to design a multipurpose R/C robot. This project will produce utility for the user to remotely monitor enemy activities, the destructed buildings and such places where it is hard for a human being to make a view point. After making a view point action can be taken accordingly.
Although we have applied this system to monitor and control some basic functions more complex functions can be added according to the requirement.
- Patrol the surrounding with sharp camera–eye.
- Send video and data captured to the server wirelessly .
- Easy control by a computer Wireless media .
- Mobile in all directions with miniature size.
- Conceal in camouflage without attracting attention.
- Can take appropriate action when needed.
Typical applications of the project includes
- Military reconnaissance mission
- Wireless security and surveillance in hot spots
- Search and rescue operation
- Manoeuvring in hazardous environment
- R/C soldier
- Home security
Our project is based upon the same concept.
- Design of robotic car
- Receiver circuitry
- Transmitter circuitry
- Tuning of wireless video camera
- Wireless transmission of video and control instructions
- Remotely control the direction and position of the robot and perform the specific action.
The system has two main functions:
First of all the video camera attached with the robotic car will send real time video signals to our monitoring device i. e monitor. The video camera is wireless and has a range of over 200 ft radius. After watching the video on the display , the operator can make his own decision and take an action accordingly.
After the user had made his decision, he sends the control commands via serial communication to the PIC micro controller which processes the digital data input. The user observes the real time video by a software called “”SUPERTVpro””
There are basically two circuit boards of the project
- Transmitter Circuitry
- Receiver Circuitry
The third most important design consideration is the choice of a video camera
The intelligent spy robot system consists of a transmitter ,a receiver and a video camera. The communication between receiver and transmitter is wireless i.e RF communication
The video camera is also wireless and operates on radio frequency.
The receiver circuitry is the heart of the system which moves the robot to left ,to right, forward and reverse. The user can monitor all the activities of the robot, infact user is controlling the spy robot. The user is controlling the spy robot by sending the control commands via serial communication to the transmitter circuitry.
The control section is mainly responsible of acquiring video from the site in order to monitor and control the activity of the spy robot. It is also responsible to perform some specific actions like torch on , gun fire etc. user remotely control the activity of the spy robot by RF communication.
On our control pc there is an application software superTVPRO which is responsible to show the video and provides a user interface as a control window.
An opto-coupler is used to avoid the interference between RF transmitter and the remaining circuitry in the transmitter section.
The radio transmitter has a range of 100 ft radius to be sufficiently received at the receiver.
For serial communication we used windows built-in software called HYPER TERMINAL.
The receiver section consists of
- a robotic car
- a video camera
- a receiver circuitry
The receiver circuitry receives the control commands from the transmitter of the control section via rf receiver. Two motors are connected to the robotic car and the receiver circuitry such that motors move the robot exactly to the same position and direction as directed by the control section. This is done by decoding the control instruction sent by th transmitter with the help of remote control decoder PT 2272. The PIC microcontroller of the receiver section is programmed in C language. The speed of the motors can be varied by varying the duty cycle of the PWM of the PIC micro controller. Greater the duty cycle of the PWM greater will be the speed of the motor.
Pwm duty cycle = (CCPR1L:CCP1CON<5:4>) •TOSC • (TMR2 prescale value)
Complete Function Diagram
The hardware of Intelligent Spy Robot is divided into three categories
- Transmitter and Control unit
- Receiver with Robotic car.
- Wireless Camera
In this type of project, it is often useful to have a conceptual model of the monitoring and controlling process. Some of the fundamental concepts in this context are as follows.
Transmitter is defined as the device which actually transmits the signals. In this project Transmitter is transmitting the control signals. In this project transmitter transmits control signals after monitoring the robotic car. This transmitter is connected with computer through serial port. Computer sends commands which comes to transmitter circuitry through serial port and then these are transmitted to receiver through RF to control robotic car.
Transmitter circuitry consists of the following parts.
- PIC microcontroller 16F877
- Serial Port
- RF Transmitter
PIC are popular with developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability.
A/D Converter :
Certain PIC pins can be set up as inputs to an analog-to-digital converter (ADC). The ’ 877 has eight analog inputs, which are connected to Port A and Port E. When used in this mode, they are referred to as AD0–AD7. The necessary control registers are initialized in CCS C using a set of functions that allow the ADC operating mode and inputs to be selected. An additional “ device ” directive at the top of the program sets the ADC resolution. An analog voltage presented at the input is then converted to binary and the value assigned to an integer variable when the function to read the ADC is invoked. The default input range is set by the supply (nominally 0–5 V). If a battery supply is us(which drops over time) or additional accuracy is needed, a separate reference voltage can be fed in at AN2 ( +VE V ref ) and optionally AN3 (–V ref ). If only +VE V ref is used, the lower limit remains 0 V, while the upper is set by the reference voltage. This is typically supplied using a zener diode and voltage divider. The 2.56 V derived from a 2V7 zener gives a conversion factor of 10 mV per bit for an 8-bit conversion. For a 10-bit input, a reference of 4.096 V might be convenient, giving a resolution of 4mV per bit. The essentials of ADC operation are illustrated .
Data EEPROM and FLASH Program Memory:
The 16F877A can be programmed in PL/M, C and a number of other high-level languages. In our project we have used C language for coding and used “Mikro C” compiler for compiling C code. Further details are given in chapter containing software section.
The Data EEPROM and FLASH Program Memory are readable and writable during normal operation over the entire VDD range. These operations take place on a single byte for Data EEPROM memory and a single word for Program memory. A write operation causes an erase-then-write operation to take place on the specified byte or word. So we can re-write in this microcontroller. There are three memory blocks in each of thePIC16F87X MCUs. The Program Memory and Data Memory have separate buses so that concurrent access can occur. The PIC16F87X devices have a 13-bit program counter capable of addressing an 8K x 14 program memory space. The PIC16F877/876 devices have 8K x 14 words of FLASH program memory,
The data memory is partitioned into multiple banks which contain the General Purpose Registers and the Special Function Registers. Bits RP1 (STATUS<6>) and RP0 (STATUS<5>) are the bank select bits. Each bank extends up to 7Fh (128 bytes). The lower locations of each bank are reserved for the Special Function Registers. Above the Special Function Registers are General Purpose Registers, implemented as static RAM. All implemented banks contain Special Function Registers. Some frequently used Special Function Registers from one bank may be mirrored in another bank for code reduction and quicker access.
The Special Function Registers are registers used by the CPU and peripheral modules for controlling the desired operation of the device. These registers are implemented as static RAM. GENERAL PURPOSE REGISTER FILE The register file can be accessed either directly, or indirectly through the File Select Register (FSR).
PIC16 Serial Interfaces:
- USART asynchronous link
- SPI synchronous bus
- I2C synchronous bus
Serial data connections are useful because only one or two signal wires are needed, compared with at least eight data lines for a parallel bus plus control signals. The typical PIC microcontroller offers a choice of serial interfaces. The best one for any given communication channel depends on the distance between nodes, the speed, and the number of hardware connections required.
The universal synchronous/asynchronous receive transmit (USART) device is typically used in asynchronous mode to implement off-board, one-to-one connections. The term asynchronous means no separate clock signal is needed to time the data reception, so only a data send, data receive, and ground wires are needed. It is quick and simple to implement if a limited data bandwidth is acceptable. A common application is connecting the PIC chip to a host PC for uploading data acquired by the MCU subsystem .The USART link can send data up to 100 meters by converting the signal to higher-voltage levels (typically+ 12 V). The digital signal is inverted and shifted to become bipolar (symmetrical about 0V, line negative when inactive) for transmission.
The PIC 16F877 has a dedicated hardware RS232 port, but CCS C allows any pin to be set up as an RS232 port, providing functions to generate the signals in software. The basic form of the signal has 8 data bits and a stop and start bit. The bit period is set by the baud rate. A typical value is 9600 baud, which is about 10k bits per second. The bit period is then about 100μ s, about 1 byte per millisecond, or 1 K byte per second.The data are transferred between shift registers operating at the same bit rate; the receiver has to be initialized to the same baud setting as the transmitter. Assuming we are looking at TTL level data, in the idle state, the line is high. When it goes low, the receiver clock is started, the data are sampled in the middle of each following data bit period, and data are shifted into the receive register . RS232 is used to access the standard serial LCD display, in which case, line drivers are not necessarily required. ASCII characters and control codes are sent to operate the display, which has its own MCU with a serial interface to receive and decode the data. It then drives the pixel array to display alphanumeric characters. Most LCD may also be set up to display simple bit-mapped graphics. In simulation mode, an RS232 virtual terminal provides a convenient way of generating alphanumeric input into the MCU for testing.
PIC16 C Program Basics :
The purpose of an embedded program is to read in data or control inputs, process them, and operate the outputs as required. Input from parallel, serial, and analog ports are held in the file registers for temporary storage and processing; and the results are output later on, as data or a signal. The program for processing the data usually contains repetitive loops and conditional branching, which depends on an input or calculated value. Variables Most programs need to process data in some way, and named variables are needed to hold their values. A variable name is a label attached to the memory location where the variable value is stored. When working in assembly language, a register label acts as the variable name and has to be assigned explicitly. In C, the variable label is automatically assigned to the next available location or locations (many variable types need more than 1 byte of memory). The variable name and type must be declared at the start of the program block, so that the compiler can allocate a corresponding set of locations. Variable values are assumed to be in decimal by default; so if a value is given in hexadecimal in the source code, it must be written with the prefix 0x, so that 0xFF represents 255, for example.
Longer labels are sometimes preferable, such as “ output value, ” but spaces are not allowed. Only alphanumeric characters (a–z, A–Z, 0–9) and underscore, instead of space, can be used. By default, the CCS compiler is not case sensitive, so ‘a’ is the same as ‘A’ (even though the ASCII code is different). A limited number of key words in C, such as main and include , must not be used as variable names.
Most real-time applications need to execute continuously until the processor is turned off or reset. Therefore, the program generally jumps back at the end to repeat the main control loop. In C this can be implemented as a “ while ” loop,. The condition for continuing to repeat the block between the while braces is contained in the parentheses following the while keyword. The block is executed if the value, or result of the expression, in the parentheses is not zero. In this case, it is 1, which means the condition is always true; and the loop repeats endlessly. This program represents in simple form the general structure of embedded applications, where an initialization phase is followed by an endless control loop. Within the loop, the value of x is incremented (x ++ . The output therefore appears to count up in binary when executing. When it reaches the maximum for an 8-bit count (11111111 =255), it rolls over to 0 and starts again.
The simplest way to illustrate basic decision making is to change an output depending on the state of an input. A circuit for this is shown in Figure 2.4 , INBIT.DSN. The switch generates an input at RC0 and RD0 provides the test output. The common keyword for selection in many high level languages is IF.The input state is read within the loop using the bit read function input(PIN_C0). This assigns the input value 1 or 0 to the variable x. The value is then tested in the if statement and the output set accordingly. Note that the test uses a double equals to differentiate it from the assignment operator used in the previous statement. The effect of the program is to switch on the output if the input is high. The switch needs to be closed before running to see this effect. The LED cannot be switched off again until the program is restarted.
Hi-Tech PIC C:
The Hi-Tech PIC C is a professional standard compiler supplied by a company established as a development system tool supplier. Hi-Tech supplies C compile wide range of microcontrollers on the market: PIC 16, 18, 24, and ds PIC (digi processors) as well as free scale 68000-based types, ARM, 8051 derivatives, T Instruments MSP430 devices, and other legacy products. The features claimed are these:
- ANSI C—full featured and portable.
- Reliable—mature, field-proven technology.
- Multiple C optimization levels.
- An optimizing assembler.
- Full linker, with overlaying of local variables to minimize RAM usage
- Comprehensive C library with all source code provided.
- Support for 24-bit and 32-bit IEEE floating point and 32-bit long data types
- Mixed C and assembler programming.
- Unlimited number of source files.
- Listings showing generated assembler.
- Compatible—integrates into the MPLAB
- IDE, MPLAB ICD, and most third party development tools.
- Runs on multiple platforms: Windows ,Linux , UNIX ,Mac OS X, Solaris™
Optimization involves reducing the final code size by removing redundant code and modifying the assembler version to reduce the number of instructions to the minimum achievable. The most obvious disadvantage of this compiler is that only the standard library functions for data conversion, memory management, mathematical operations, and basic I/O are provided. It is assumed that the user will develop the peripheral drivers as required, to suit the particular range of applications and hardware to be supported, or that the peripheral control registers will be accessed directly. On the other hand, a major advantage is that a fully featured freeware version, PICC-Lite, is available for hobbyists, students, and limited commercial purposes. At the time of writing, the following PIC MCUs are supported with no limitations, as compared to the full version: 12F629, 12F675, and 16F84. A further set of 16 series chips can be used with a limitation on RAM and program memory: ‘ 627, ‘ 684, ‘ 690, ‘ 877, ‘ 887, and ‘ 917. Other limitations are imposed due to the limited memory available in these chips. Hi-Tech also supplies Salvo RTOS, including a freeware version. This is a cooperative, event-driven, priority-based, multitasking, real-time operating system designed for microcontrollers with limited RAM and ROM. The manual supplied ( www.pumpkininc.com ) with this product contains a very useful introduction to RTOS principles and is recommended if further information is required on using RTOS in PICs. An example of Hi-Tech C source code is shown in Listing D.3 . It outputs a binary count at Port B that is incremented every second using a timer interrupt. The port register is addressed directly, using the label PORTB . The timer control bit labels are defined in the header file PIC.H and set directly in the main routine. Note that here the calculation of the initial loop count constant RELOADS is calculated in the initial directive block using the arithmetic and logic operations provided within the directive syntax. Recall that CCS C uses a directive to declare a function as an ISR; here, the compiler recognizes the keyword interrupt within the function name instead.
Mikro C :
Mikroelectronica supplies range evaluation and development boards for the PIC and other microcontrollers , as well as C, Pascal, and Basic compilers. The C compiler MikroC is well documented in a downloadable user manual and includes a good range ofperipheral driver libraries, including CAN, Ethernet, and graphical LCD drivers as part of a comprehensive I/O library. The packages are oriented toward the educational and hobby market, offering additional features designed to assist the beginner in developing C applications. An evaluation version does not appear to be available at the time of this writing, and the compiler syntax can be assessed prior to purchase only by reference to code fragments given in the manual. Aswe see, the control registers are set up by loading control codes as hex numbers, which requires the program designer to look up the necessary bit configurations. However, the ADC access function is simple and concise, allowing the input channel to be selected as the function parameter.
The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to supply TIA/EIA-232-F voltage levels from a single 5-V supply. Each receiver converts TIA/EIA-232-F inputs to 5-V TTL/CMOS levels. These receivers have a typical threshold of 1.3 V, a typical hysteresis of 0.5 V, and can accept D30-V inputs. Each driver converts TTL/CMOS input levels into TIA/EIA-232-F levels.
Actual DIP of MAX232Pin diagram of the MAX232
An optocoupler, also known as an opto-isolator, is an integral part of the opto electronics arena. It has fast proven its utility as an electrical isolator or a high-speed switch, and can be used in a variety of applications.
The basic design for optocouplers involves use of an LED that produces a light signal to be received by a photodiode to detect the signal. In this way, the output current or current allowed to pass can be varied by the intensity of light.
A very common application for the opto coupler is a FAX machine or MODEM, isolating the device from the telephone line to prevent the potentially destructive spike in voltage that would accompany a lightning strike.
Opto-couplers typically come in a small 6-pin or 8-pin IC package, but are essentially a combination of two distinct devices: an optical transmitter, typically a gallium arsenide LED (light-emitting diode) and an optical receiver such as a phototransistor or light-triggered diac. The two are separated by a transparent barrier which blocks any electrical current flow between the two, but does allow the passage of light. The basic idea is shown for a four pin optocoupler.
In this project optocoupler is performing the isolation between RF antenna and remaining circuit. Optocupler is behaving both as a switch as an isolator in this project. In order to avoid interference optocupler has been used between RF antenna and transmitter circuitry. In this project 4-pin optocoupler PC817 IC chip has been used.
To make the communication between transmitter and receiver sections we used RF communication. For that purpose we used a Transimtter and receiver .
Receiver and Robotic Car:
The second important portion of hardware design is Reciever circuitry and robotic car.
Receiver side consists of the following parts.
- Robotic Car
- Decoder PT2272
- PIC microcontroller 16F877
- Motor Driver L298
We have used RF module because of limitation of resources. Further it has a limited range. The range can be improved by using GSM and GPRS technologies. Wi-Max is also a better choice.
Robots of today are using the technologies mentioned above. These long range robots are used for spying, security and surveillance.
We have used a robotic car which has a larger size and it can not cross hurdles. However it can be improved by using a helicopter shaped robot. Now a days a Bee sized robots are also available which are lighter in size and have lesser mechanical considerations.Such a robotic bee is shown in figure.
The other option is to use such sensors which could detect hurdles and can change the direction of our robotic car. This is a better choice however mechanical structure will be complex.