Sie sind auf Seite 1von 25

Introduction This course will provide senior secondary class students a base to robotics.

This course and associated workshop doest aim at giving the deep technical knowledge to the student but to aware them that where the world is in term of robotics and to create their interest in robotics . They will learn the Automation technology and get better understanding and grip on its application. They will be developing their own models by their own hands. The workshop focus on the application and use of technology rather than their internal working so that the student can grasp the concepts well. Course Content
1. 2. 3. 4. 5. 6. 7. 8. 9.

Introduction to robotics Locomotion in Robotics Introduction to Mechanical systems Motor and its control Introduction to Microcontrollers (8051 microcontroller family) Sensors Introduction to Unmanned & Intelligent Systems Introduction to basic programming language(c/c++). Building line follower robot

1. Introduction to robotics Robotics is the branch of technology that deals with the design, construction, operation, structural disposition, manufacture and application of robots.[3] Robotics is related to the sciences of electronics, engineering, mechanics, and software
History of robotics

The word robot was introduced to the public by the Czech writer Karel apek in his play R.U.R. (Rossum's Universal Robots), published in 1920.[5] The play begins in a factory that makes artificial people called robots creatures who can be mistaken for humans - though they are closer to the modern ideas of androids. Karel apek himself did not coin the word.

He wrote a short letter in reference to an etymology in the Oxford English Dictionary in which he named his brother Josef apek as its actual originator.[5] In 1927 the Maschinenmensch ("machine-human") gynoid humanoid robot (also called "Parody", "Futura", "Robotrix", or the "Maria impersonator") was the first and perhaps the most memorable depiction of a robot ever to appear on film was played by German actress Brigitte Helm) in Fritz Lang's film Metropolis. In 1942 the science fiction writer Isaac Asimov formulated his Three Laws of Robotics and, in the process of doing so, coined the word "robotics" (see details in "Etymology" section below). In 1948 Norbert Wiener formulated the principles of cybernetics, the basis of practical robotics. Fully autonomous robots only appeared in the second half of the 20th century. The first digitally operated and programmable robot, the Unimate, was installed in 1961 to lift hot pieces of metal from a die casting machine and stack them. Commercial and industrial robots are widespread today and used to perform jobs more cheaply, or more accurately and reliably, than humans. They are also employed in jobs which are too dirty, dangerous, or dull to be suitable for humans. Robots are widely used in manufacturing, assembly, packing and packaging, transport, earth and space exploration, surgery, weaponry, laboratory research, safety, and the mass production of consumer and industrial goods.[8]

2. Locomotion in Robotics Rolling robots

For simplicity most mobile robots have four wheels or a number of continuous tracks. Some researchers have tried to create more complex wheeled robots with only one or two wheels. These can have certain advantages such as greater efficiency and reduced parts, as well as allowing a robot to navigate in confined places that a four wheeled robot would not be able to. Two-wheeled balancing robots Balancing robots generally use a gyroscope to detect how much a robot is falling and then drive the wheels proportionally in the opposite direction, to counter-balance the fall at hundreds of times per second, based on the dynamics of an inverted pendulum. Many different balancing robots have been designed. While the Segway is not commonly thought of as a robot, it can be thought of as a component of a robot, such as NASA's Robonaut that has been mounted on a Segway.

One-wheeled balancing robots Main article: Self-balancing unicycle A one-wheeled balancing robot is an extension of a two-wheeled balancing robot so that it can move in any 2D direction using a round ball as its only wheel. Several one-wheeled balancing robots have been designed recently, such as Carnegie Mellon University's "Ballbot" that is the approximate height and width of a person, and Tohoku Gakuin University's "BallIP". Because of the long, thin shape and ability to maneuver in tight spaces, they have the potential to function better than other robots in environments with people. Six-wheeled robots Using six wheels instead of four wheels can give better traction or grip in outdoor terrain such as on rocky dirt or grass. Tracked robots Tank tracks provide even more traction than a six-wheeled robot. Tracked wheels behave as if they were made of hundreds of wheels, therefore are very common for outdoor and military robots, where the robot must drive on very rough terrain. However, they are difficult to use indoors such as on carpets and smooth floors. Examples include NASA's Urban Robot "Urbie".[55]

3.Motor and its control

The output system consists of the motors (DC geared or without gears) and a motor driver (L293D IC). For the line follower robot we have two DC motors attached with the wheels. Dc motors are most easy to control. A DC motor requires only two signals for its operation. To change its direction we just need to reverse the polarity of the battery. *DC geared motors are advantageous over the DC motors without gears because the torque provided by the geared motors is quite high as compared to the simple ones. The use of two motors: By using two motors we can move the robot in any direction. This steering mechanism of the robot is called differential drive. Lets check how it works. counterclockwise.(SHARP LEFT TURN) Left wheel is reversed and the right wheel is forwarded stopped and the right wheel is forwarded forwarded and right wheel is stopped. forwarded and right wheel is reversed.

4.Introduction to Microcontrollers A microcontroller (also MCU or _C) is a functional computer system-on-a-chip. It contains a processor core, memory, and programmable input/output peripherals. Microcontroller is sum times compared to microprocessor but there are significant differences between them. Microprocessor is just the processing unit while microcontroller is the whole system on chip (including the input/output ports, RAM, ROM etc). What is the difference between microcontroller and microprocessor?

Microcontroller 1. It is also known as system on chip i.e. processor, I/O Ports, Timer, interrupt, RAM, ROM on a single chip. 2. It is also known as MPU (micro processing unit). 3. This type of system is cost efficient.

Microprocessor 1. It is just the processing unit. External RAM, ROM, Bus, I/O Ports, must be added to make a functional unit. 2. It is also known as CPU (central processing unit). 3. System becomes costly and bulky.

8051 microcontroller was introduced in 1981 by INTEL Corporation. Its a 8 bit microcontroller (CPU works on 8 bits at

a time) 8051 microcontroller The 8051 is the original member of the 8051 family. Intel refers to it as MCS-51.Here is a table showing its main features. Feature ROM RAM Timer I/O Pins Serial port Interrupt sources Quantity 4K bytes 128 bytes 2 32 1 6

ARCHITECTURE OF 8051 The simple architecture of 8051 microcontroller is shown in the following figure.

This figure shows the main features and components that the designer can interact with. The 8051 microcontroller has 4 different ports, each one having 8 Input/output lines providing a total of 32 I/O lines. Those ports can be used to output DATA and orders do other devices, or to read the state of a sensor, or a switch. Most of the ports of the 8051 have 'dual function' meaning that they can be used for two different functions: the fist one is to perform input/output operations and the second one is used to implement special features of the microcontroller like counting external pulses, interrupting the execution of the program according to external events, performing serial data

transfer or connecting the chip to a computer to update the software. Each port has 8 pins, and will be treated from the software point of view as an 8-bit variable called 'register', each bit being connected to a different Input/ Output pin. You can also notice two different memory types: RAM and EEPROM. Shortly, RAM is used to store variable during program execution, while the EEPROM memory is used to store the program itself, that's why it is often referred to as the 'program memory'. The special features of the 8051 microcontroller are grouped in the blue box at the bottom of figure. 8051 incorporates hardware circuits that can be used to prevent the processor from executing various repetitive tasks and save processing power for more complex calculations. Those simple tasks can be counting the number of external pulses on a pin, or generating precise timing sequences. It is clear that the CPU (Central Processing Unit) is the heart of the microcontrollers; it is the CPU that will Read the program

PIN DESCRIPTION OF 8051

PIN DESCRIPTION (MUST FOR ALL) 1. Port 0: Pins 32-40 are the 8 pins of port 0.They are used as address lines or data lines when the microcontroller is interfaced with external memory. 2. Port 1: Pins 1-8 are the 8 pins of port 1. 3. Port 2: Pins 21 to 28 are the pins of port 2.They are used as address lines when microcontroller is interfaced with external memory. 4. Port 3: Pins 10-17 are pins of port 3.Cn be used for special purpose as mentioned in brackets. 5. Pin 9:Reset pin; when high its sets the value of program

counter to first instruction, hence whole code is executed from the beginning. 6. RXD: Serial input port. 7. TXD: Serial output port. 8. INT0: External interrupt 0(active low). 9. INT1: External interrupt 1(active low). 10. T0: Timer 0 external input. 11. T1: Timer 1 external input. 12. WR: External data memory write strobe (active low). 13. RD: External data memory read strobe (active low). 14. XTAL2 and XTAL1: Oscillator(freq-11.0592 MHz). 15. GND: Ground potential. 16. VCC: Supply voltage. 17. EA/VPP: for external memory interfacing (active 18. ALE: address latch enable, to use port 0 as address lines or data lines with external memory interfacing (High-address; low-data). 19. PSEN: It is the read strobe to external program memory

6. PROGRAMMING OR MICROCONTROLLER IN C
Programming of the microcontroller can be done in assembly language or C language. Compiler produce Hex file that is burned into the microcontroller (size of Hex file should be small because we have limited on-chip ROM).While assembly language produces a hex file which is much smaller than C, programming in assembly is quite tedious and time consuming.

C DATA TYPES FOR 8051

1. Unsigned char: Its a 8-bit data type, takes a value 0255(00-FFH).Most widely used data type. *In declaring variables, we must pay attention to size of data and try to use unsigned char in place of int if possible. Because the 8051 has limited amount of RAM, using int in place of char data type will cause large Hex file. e.g 8051 C program to toggle all the bits of P1 continuously //Toggle P1 forever #include <reg51.h> Void main (void) { for (;;) //repeat forever { P1=0x55; //0x indicate Hex data P1=0xAA; } } 2. Signed char:8 bit data type ,uses the MSB to denote ve or +ve. Has a range of -128 to +127. 3. Unsigned int:16 bit data type, can take values from 065535(0000-FFFFH). 4. Signed int:16 bit data type, uses MSB for sign, range is 32,768 to +32,767. 5. Sbit: The Sbit keyword is widely used 8051 C data type designed to access single bit addressable registers. It allow access to single bits of SFRs.

e.g 8051 program to toggle bit D0 of the port P1 (P1.0) 50,000 times. #include <reg51.h> Sbit MYBIT=p1^0; //sbit is declared outside main Void main (void) { Unsigned int z; for (z=0;z<50,000;z++) { MYBIT=0; MYBIT=1; } } 6. Bit and sfr: The bit data type allows access to single bits of bit addressable memory spaces 20-2FH and sfr is used to access the byte size SFR registers. TIME DELAY There are two ways to provide time delay 1. Using simple loops 2. Using the 8051 timer.(discussed in next chapter) e.g 8051 C program to toggle the bits of port P1 continuously with a 250ms delay.(crystal freq=11.0592MHz). #include <reg51.h> Void Delay(unsigned int); Void main (void) { While(1) { P1=0x55;

Delay(250); P1=0xAA; Delay(250); } } Void Delay (unsigned int itime) { Unsigned int I,j; for (i=0;i<itime,i++) for (j=0;j<1275;j++); } I/O PROGRAMMING IN 8051 C 1. Byte size I/O: Ports P0-P3 are byte addressable. e.g 8051 program to get a byte from P0 and send it to P1 or P2 depending on its value whether less than or greater than 100. #include <reg51.h> Void main (void) { Unsigned char MYBYTE; P0=0xFF; //make P0 as input port While(1) { MYBYTE=P0; //get byte from P0 If(MYBYTE<100) P1=MYBYTE; //send to P1 Else P2=MYBYTE; //send to P2 }

} *I/O ports are also bit addressable as shown in the previous examples. USING BIT DATA TYPE FOR BIT ADDRESSABLE RAM sbit data type is used for bit addressable SFRs only. Sometimes we need to store some data in the bit addressable section of RAM space 20-2FH.to do so we need bit data type. Its use is as shown below. e.g get the status of P1.0,save it and send it to P2.7 continuously. #include <reg51.h> Sbit inbit =P1^0; Sbit outbit=P2^7; //sbit is used to declare SFR bits Bit membit; //bit addressable memory Void main (void) { While (1) { Membit=inbit; //get bit from P1.0 Outbit=membit; //send it to P2.7 } } ACCESSING CODE ROM SPACE IN 8051 C Using the code(program) space for predefined data type is the widely used option in the 8051.To make C compiler use the

code space instead of the RAM space we need to put the keyword code in front of variable declaration. e.g code unsigned char mynum[]=012345ABCD;

LINE FOLLOWER ROBOT

A line following robot is a self operating robot which follows a path (black line on white floor or vice versa).The task is to sense the line and

remain on the desired path. The robot is designed to follow tight curves. Here are some samples of path that a line follower needs to follow. Width of path can vary from 3cm to 5cm.There can be some lateral displacement too. These are very simple paths to follow and in most of the competitions the task can be a bit tedious.

BASIC DESIGN AND REQUIREMENTS


The robot is build using ATMEL microcontrolloer(AT89C51),IR sensors,LM324 IC,two motors(dc motors with or without gears),motor driver(L293D IC),mounted on chassi(toy car or aluminium sheets).Sensors are placed facing downward towards the path.

Basic operation:
1.capture the line position with the help of of IR sensors. 2.Decide the logic;what to do(move straight,left or right) with the code contained by the microcontroller 3.Steer the robot to the track.For this we use two motors to govern the movement of the wheels.

Block diagram:
The above mentioned block diagram shows the basic design of line follower. The sensors and comparator comprises input system, microcontroller is the processing system and motor driver and motors form the output system of robot. Now lets see the details of the systems

INPUT SYSTEM

Sensors
Each opto coupler(the sensor that we are using) has one emitter (IR LED) and a receiver (photo transistor or photo diode). If white space is present beneath the IR LED then IR rays are reflected and they are sensed by the receiver, while in case of black surface all of
SENSORS
COMPARATOR IC LM 324 MICROCONTROLLOER AT89C51 MOTOR DRIVER L293D M1 M2

the IR rays are absorbed by the surface and nothing is sensed by the receiver. Photo diode has a property that its electric resistance decreases when IR rays fall on it. Hence in case of white surface the electric resistance of the receiver is less than the case of black surface. The circuit used for sensors is: R1=300 and R2=10K The +ve power supply is 5V. Let Vp is the output voltage to comparator. *When there is black line then no IR light is sensed by the receiver and its resistance is high. So the output voltage Vp is also high (approx 4.68V). *When there is white line then IR rays are sensed by the receiver and its

resistance decreases hence output voltage also decreases (approx 2.5V). *The reference voltage is set as the mean of the output voltage(Vp) at the time of black line and the white line. Vref =(4.68+2.5)/2=3.59V

Comparator:
Comparator is a device which compares two input voltages and gives output as high or low. In a circuit diagram it is shown as a triangle having two inputs(+ve and ve) and a output. +ve or non inverting input is given reference voltage in this case. ve or inverting input is provided with the output of the sensors. *Incase of white path Vref is greater than the other input, So, the output of comparator is high. While in case of black line Vref is less than the other input. So the output of the comparator is low. We use LM324 IC for the comparator: There are four comparators in this IC.So it can support upto four sensors.

Arrangement of sensors
Any number of sensors can be used while making line follower. A simple line follower can be made with just two sensors. If we use more sensors(say more than 4),the programming becomes complex and the hardware requirements are more. Using more number of sensors accurately increases the accuracy. Different arrangements for the placement of sensors can also be used .e.g we can use array of sensors,we can place the sensors in V shape or we can have sensors placed at the corners of a

rhobus(diagonal). Here lets take the simplest example of two sensors placed just outside the line(path is black on white surface). Sensor 1 Sensor 2 Simple logic behind this arrangement is that the sensors are placed just outside the line. As soon as one of them detects black, then we can conclude that the robot is deviating from the path and we can correct its move.

Tips for the input system PCBs are used for the circuit. Breadboard is not preferable
because it has loose connections (breadboard is just used for the module testing). Proper orientation of IR LEDs should be done (there distance from the surface should not be more than 1.5cm). The other two important components used in the line follower circuit are voltage regulator and the potentiometer.

Voltage regulator:
Voltage regulator fixed DC output voltage from a varying DC source. As the microcontroller and other IC require constant DC supply of 5V,So we use voltage regulator. They help to maintain a steady voltage level despite various current demands and varying input voltages. There are three pins in the

13
2

voltage regulator. Middle one (pin no. 2) is grounded, pin no. 1 is given the input(7-12V) and we get the output(5V) from pin no. 3.

Potentiometer:
Potentiometer is the variable resistor which is used to vary the resistance by rotating the shaft. They are available in the range of 100 to 470K. Potentiometer is used as the voltage divider in the circuit.

POTENTIOMETER
Lead A is connected to V(5V) and lead B is connected to ground. Then we can vary voltage from 0V to 5V and the output is taken from the lead W. Potentiometer is used to generate reference voltage for LM324 IC.

PROCESSING SYSTEM
Processing system is the brain of the robot which generates desired output corresponding to the inputs. Microcontroller is the processing system of our line follower robot. Microcontroller are present in different forms such as 8051,AVR and PIC. Also a lot of companies also produce microcontroller. We are using ATMEL AT89C51, it is 8051 microcontroller.

Hardware details:
The basics of 8051 microcontroller are already discussed. Below is the connection diagram for 8051 microcontroller for the line follower robot. The connections are as follows: Pin no. 9,31 and 40 are connected to Vcc (5V). Pin no.20 is connected to ground. Pin no 18 and 19 are connected to oscillator.

Pin no. 1 and 2 i.e. P1.0 and P1.1 are used for the output from the comparator corresponding to the two sensors. Pin no 21 to 26. i.e. P2.0 to P2.5 are used to connect the motor driver (Interfacing of motors and the motor driver is dealt in detail in a short while). P2.5=-ve of left motor P2.4=-ve of right motor P2.3=Enable for left motor P2.2=+ve of left motor P2.1=Enable for right motor P2.0=+ve of right motor Software details: The program code acts as the decision maker embedded in the microcontroller i.e. it decides what would be the output corresponding to each set of input. Programs can be written in assemble or C language. C language is easier to use. The program is compiler and simulated with the help of software, KEIL C. KEIL C generates a hex file which is burned into microcontroller. Here is the code for our line follower having 2 sensors. #include <reg51.h> void main(void) { P1=0xFF; P2=0x00; while(1) { if(P1^0==1 &&P1^1==1) P2=0x0F; else if(P1^0==0 &&P1^1==1) P2=0x0B;

else if(P1^0==1 &&P1^1==0) P2=0x0E; } }

OUTPUT SYSTEM
The output system consists of the motors (DC geared or without gears) and a motor driver (L293D IC). For the line follower robot we have two DC motors attached with the wheels. Dc motors are most easy to control. A DC motor requires only two signals for its operation. To change its direction we just need to reverse the polarity of the battery. *DC geared motors are advantageous over the DC motors without gears because the torque provided by the geared motors is quite high as compared to the simple ones.

The use of two motors:


By using two motors we can move the robot in any direction. This steering mechanism of the robot is called differential drive. Lets check how it works. To rotate robot counterclockwise.(SHARP LEFT TURN) Left wheel is reversed and the right wheel is forwarded To rotate robot counterclockwise.( LEFT TURN): Left wheel is stopped and the right wheel is forwarded To rotate robot clockwise.( RIGHT TURN):left wheel is forwarded and right wheel is stopped. To rotate robot clockwise.(SHARP RIGHT TURN):left wheel is forwarded and right wheel is reversed. To move straight: both motors forwarded.

Motor driver:
We cannot connect the motor directly to the microcontroller because

microcontroller can not provide required current to drive DC motor. Motor driver is a current enhancing device; it is also used as switching device. Motor driver takes input from the microcontroller and generates the output signal for the motor. IC L293D is used as motor driver. L293D IC Its a 16 pin IC. This IC can drive two motors simultaneously. Description of the IC: Pin no. 1 and 9 are ENABLE pins to make a channel active. Pin 1 to P2.3 Pin 9 to P2.1 Pin no 4,5,12 and 13 are connected to ground. Pin no. 16 is the logic supply voltage i.e. the voltage we need to provide to the motor. Pin no 8 is the supply voltage. Pin no 2,7,10 and 15 are input pins connected to the microcontroller. In our robot, Pin 2 to P2.2 Pin 7 to P2.5 Pin 15 to P2.0 Pin 10 to P2.4. Here we have discussed the line following robots systems. After the module testing of all the systems is done, the circuit is assembled on a PCB; universal PCB can be used for this purpose. The placement of sensors and the code is path dependent. I.e. The path should be taken into consideration for the sensors and for writing the algorithm. This study material is just the starting and all of you need to explore the

world of robotics on your own.

Das könnte Ihnen auch gefallen