Professional Documents
Culture Documents
Ball Follower Robot Using Image Processing: Project Report
Ball Follower Robot Using Image Processing: Project Report
Contents:
S.No. 1 2 3 4 5 6 7 TOPIC Introduction Introduction to robots and robotics Requisites : Software tools Hardware tools Introduction to Image processing Introduction to Project Codes for basic and matlab Explanation and implementation
Introduction
About Ball Follower Robot
The project deals with a robot that locates and follows a ball across mounted with a web camera above and being controlled by a pc. The robot specified uses a Atmel microcontroller ATMega16 with a web camera mounted on it which is having video stream in a running mode where actually it sees the ball and where ever the ball is moving it just follows it automatically without any external control. For using a web cam we need to include a software which is MATLAB, it helps in taking images in current stream and allows camera to locate the ball and follow it using the concept of threshold.
Although the appearance and capabilities of robots vary vastly, all robots share the features of a mechanical, movable structure under some form of autonomous control. The structure of a robot is usually mostly mechanical and can be called a kinematic chain (its functionality being similar to the skeleton of the human body). The chain is formed of links (its bones), actuators (its muscles) and joints which can allow one or more degrees of freedom. Most contemporary robots use open serial chains in which each link connects the one before to the one after it. These robots are called serial robots and often resemble the human arm. Some robots, such as the Stewart platform, use closed parallel kinematic chains. Other structures, such as those that mimic the mechanical structure of humans, various animals and insects, are comparatively rare. However, the development and use of such structures in robots is an active area of research (e.g. biomechanics). Robots used as manipulators have an end effector mounted on the last link. This end effector can be anything from a welding device to a mechanical hand used to manipulate the environment.
Components of robots
Actuation
A robot leg in the form of wheels with the help of motors
The actuators are the 'muscles' of a robot; the parts which convert stored energy into movement. By far the most popular actuators are electric motors, but there are many others, some of which are powered by electricity, while others use chemicals, or compressed air.
Motors: By far the vast majority of robots use electric motors, of which
there are several kinds. DC motors, which are familiar to many people, spin rapidly when an electric current is passed through them. They will spin backwards if the current is made to flow in the other direction. Stepper motors: As the name suggests, stepper motors do not spin freely like DC motors, they rotate in steps of a few degrees at a time, under the command of a controller. This makes them easier to control, as the controller knows exactly how far they have rotated, without having to use a sensor. Therefore they are used on many robots and CNC machining centres.
Manipulation
Robots which must work in the real world require some way to manipulate objects; pick up, modify, destroy or otherwise have an effect. Thus the 'hands' of a robot are often referred to as end effectors, while the arm is referred to as a manipulator. Most robot arms have replaceable effectors, each allowing them to perform some small range of tasks. Some have a fixed manipulator which cannot be replaced, while a few have one very general purpose manipulator, for example a humanoid hand.
A simple gripper
The processing phase can range in complexity. At a reactive level, it may translate raw sensor information directly into actuator commands. Sensor fusion may first be used to estimate parameters of interest (e.g. the position of the robot's gripper) from noisy sensor data. An immediate task (such as moving the gripper in a certain direction) is inferred from these estimates. Techniques from control theory convert the task into commands that drive the actuators.
Requisites of Project
Software used:
BASCOM-AVR MATLAB Programming language: Basic language in BASCOM: BASIC (an acronym for Beginner's Allpurpose Symbolic Instruction Code) is a family of high-level programming languages
Key Features
High-level language for technical computing Development environment for managing code, files, and data Interactive tools for iterative exploration, design, and problem solving Mathematical functions for linear algebra, statistics, Fourier analysis, filtering, optimization, and numerical integration 2-D and 3-D graphics functions for visualizing data Tools for building custom graphical user interfaces Functions for integrating MATLAB based algorithms with external applications and languages, such as C, C++, Fortran, Java, COM, and Microsoft Excel
Hardware used: Nextsapiens basic robot with atmega16 microcontroller and all other features like:
Development board of nextsapiens with lcd DC geared motor Chassis 2 Tyres Web Camera
40 pin Atmel ATmega16/32 microcontroller with internal system clock upto 8 MHz and externally upto 16 MHz. 16/32 KB Flash RAM memory for programs KB of SRAM 512/1024 Bytes of EEPROM Dual 7805 Voltage regulator Dual power input options Two programmable LEDs Lcd for display
Config Lcd = 16 * 2 Config Porta = Input Config Portb = Output Config Portd = Output Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portl = B.5 , Db6 = Portb.6 , Db7 = Portb.7 , E = Portb.3 , Rs = Portb.2 Config Adc = Single , Prescaler = Auto , Reference = Avcc Config Timer1 = Pwm , Pwm = 8 , Prescale = 1 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down Dim A As String * 10 Start Adc Start Timer1 Cls Do A = Waitkey() If A = "l" Then Cls Print " moving left " Lcd "left" Lowerline Lcd "NEXTSAPIENS" Pwm1b = 0 Portd.3 = 0 Pwm1a = 200 Portd.6 = 0 Waitms 180 Pwm1b = 0
Elseif A = "r" Then Print " moving right " Cls Lcd "right" Lowerline Lcd "NEXTSAPIENS" Pwm1b = 200 Portd.3 = 0 Pwm1a = 00 Portd.6 = 0 Waitms 180 Pwm1b = 0 Portd.3 = 0 Pwm1a = 0 Portd.6 = 0
Elseif A = "s" Then Cls Lcd "stop" Lowerline Lcd "NEXTSAPIENS" Print " stop moving " Pwm1b = 0 Portd.3 = 0 Pwm1a = 0 Portd.6 = 0 Waitms 180 Cls Elseif A = "f" Then Cls Lcd "forward" Lowerline Lcd "NEXTSAPIENS" Print " moving forward " Pwm1b = 200
Portd.3 = 0 Pwm1a = 200 Portd.6 = 0 Waitms 180 Pwm1b = 0 Portd.3 = 0 Pwm1a = 0 Portd.6 = 0
Elseif A = "b" Then Cls Lcd "backward" Lowerline Lcd "NEXTSAPIENS" Print " moving backward" Pwm1b = 0 Portd.3 = 1 Pwm1a = 0 Portd.6 = 1 Waitms 180 Pwm1b = 0 Portd.3 = 0 Pwm1a = 0 Portd.6 = 0 End If Loop End
disp('success!!!'); else if(y<Ymin) fprintf(ser,'f'); else if(y>Ymax) fprintf(ser,'b'); end end end else if(x<Xmin) fprintf(ser,'l'); else if(x>Xmax) fprintf(ser,'r'); end end end fclose(ser); Explanation First of all for running the function it is necessary to calibrate I.e. know the exact values of pixel elements of the ball to be followed. This is done by capturing the image of ball and checking the value of its pixels at various points bu using command imview Imview(i) Shows the image just like imshow But it also displays the value of pixel where the cursor is currently located at the bottom of the screen. For more accuracy take atleast ten images at different angles and find minimum and maximum pixel value for the ball and put it in the code given. Now the function moves as follows The camera attached to the robot takes images at frequent intervals and processes it by converting the image to binary image such that image is white if pixel value lies in desired range and black otherwise. Next we determine the centroid of the image so that robot moves towards the centroid as found out. The algorithm for finding the centroid is self explanatory . Next after finding the centroid we open the serial port for communication with the robot. This is achieved by command Ser(com1);
Fopen(ser); Note:- after your work with serial port is over always close the port using command fclose(ser); When the serial port is open and we know the centroid, we send the direction to be followed by robot over the serial port and the robot follows accordingly when programmed as a simple pc controlled algorithm.