You are on page 1of 84

APEX TECHONOLGY

CONTENTS

Introduction follower robot

Deference between grid solver robot and a common line Need of Grid Solving Robot Block Diagram

Sensors

Microcontroller Stepper Motor Components detail LM358

Microcontroller AT89S52

ULN2803 Algorithm Microcontroller Programming PCB Manufacturing Applications Component List Datasheets References

APEX TECHONOLGY

INTRODUCTION

This Project Grid solving Robot is based on 8 bit Microcontroller AT89S52. This Robot follows the black line which is drawn over the white surface or it follows the white line which is drawn over the black surface. The sensors are used to sense the line. When the light signal falls on the white surface, it gets reflected and if it falls on the black surface, it is not reflected, this principle is used to scan the Lines for the Robot. All the above systems are controlled by the Microcontroller. In our project we are using the popular 8 bit microcontroller AT89S52. It is a 40 pin microcontroller. The Microcontroller AT89S52 is used to control the motors. It gets the signals from the sensors and it drives the motors according to the sensor inputs. Two stepper motors are used to drive the robot. The basic principle used for grid following is detecting the intersection and taking a turn accordingly. When a junction is detected we take a single wheel turn, thus aligning the robot on to the right angled path. A small amount of delay is included after each turn to prevent false input to be taken by robot while turning.

APEX TECHONOLGY

GRID SOLVING ROBOT

APEX TECHONOLGY

GRID SOLVING ROBOT WITH POWER SUPPLY

APEX TECHONOLGY

Deference between grid solver robot and a common line follower robot
A common line follower robot follows a single path. This path is commonly made from black or white continuous strip on opposite color background. A pair of sensor is used to detect this path. The feedback signal is then sent to the motors using motor driver circuit, which drive and steer the wheels of robot. This problem can not be solved by simple line follower because there are no alternate path hence in such type of situation simple line follower robot are failed to serve. However even we provide alternate path, the path sensed by circuit will be unpredictable. This problem can be solved by enhancing circuit sensing capability with the help of microcontroller and few more sensor circuit. Unlike common line follower which usually consist of two sensors, enhanced circuit consists of four sensors. Now to serve the robot in number of places, whole area is divided into horizontal and vertical continuous path. Two center sensors are used to sense single line as in common line follower. Since there has been number of junctions created due to number of continuous horizontal and vertical lines crossing one another. To Sense these junction extra sensing capability required, which can be solved with the help of two sensors fitted on the side of middle sensors and using microcontroller. Now whenever junction occurs, two side sensors sense it and send the feedback signal to microcontroller, now microcontroller examine it and decide where to turn according to program stored into the memory of microcontroller. The microcontroller also controls the speed of motors and the direction of the robot. In this way we can steer the robot wherever we want in the given arena in a minimum time as compare to simple line follower robot.

APEX TECHONOLGY

NEED OF GRID SOLVING ROBOT


Grid solving robots are one of the most exciting and dynamic areas in material handling today. Grid solving robot is the computer remote controlled robots that operates automatically along desired pathways. Through the years the technological developments (mainly in electronics and robotics) have offered grid solver robots several advantages over other material handling systems, such as, routing, flexibility, reliability, low operating costs, unobstructed movement and easy integration with other systems. Grid solver robots have onboard microcontroller and are able to navigate a guided path network on the grid that is flexible and easy to program. Grid solver robots are programmed for many different and useful maneuvers such as in security, surveying and tracking systems. Some are designed for the use f an operator, but most are capable of operating independently. Corporations that use Grid solver robots, often factories, warehouses, hospitals and other large facilities, benefit from the many advantages Grid solver robots has to offer. One of the most beneficial is reduced labor costs and working speed. Grid solver robots do not tire like human workers, and when their batteries are drained, charging the Grid solver robots easily replenishes their energy. Loads that Grid solver robots carries as far heavier than any single human could manage, which makes transporting heavy objects quick and simple. Grid solver robots help to give companies a competitive edge because they increase productivity and complete the job in an effective and time efficient manner. They are flexible and can be adapted to many different needs. Also, using Grid solver robots as guided vehicle reduces damage to products and increases safety among workers. Currently, Grid solver robots are fairly pricey, and this discourages some companies, but in truth, the money is quickly earned back through reduction of other costs. Manufactures of Grid solver robots are working on reducing costs and making the units easier to understand to attract more potential buyers. Research on it is on going and new developments on software and movement techniques are frequently being made.

APEX TECHONOLGY

BLOCK DIAGRAM
Sensor 1

Sensor 2

Microcontroller AT89S52
(8051 Family)

Moto r1

Sensor 3

ULN 2803

Moto r2

Sensor 4

Power Supply

Block diagram shown above consist of mainly five sections; power supply, sensor circuit, microcontroller, ULN2803 (motor driver) and motors. Robot is powered by 12V DC supply either through 220VAC/12VDC converter or by 9V DC battery. Sensor circuit used to detect path and the respective information are then sent to microcontrollers input where microcontroller take decision according to programming. Microcontrollers Output is then given to the motors which drive and steer the wheels of robot. Since motor can not be driven directly from microcontrollers output, therefore a motor driver is used.

APEX TECHONOLGY

Circuit Diagram

APEX TECHONOLGY

Components Location

1. LM358 2. Voltage Regulator. 3. ULN2803. 4. Connecting wires of stepper motor coils. 5. Capacitor 1000F. 6. Voltage Regulator. 7. Diodes 1N4007 (4). 8. Crystal 11.0592 MHz. 9. Microcontroller AT89S52. 10.10k resistance network. 11.Output from LM358 to microcontrollers input. 12.Variable resistance or preset.

APEX TECHONOLGY

SENSORS

There are four sensors in our Robot. Working of each sensor is same. Each sensor consists of a Red LED and a LDR and an OpAmp comparator LM358. The LDR is two terminal semiconductor device: two terminals are connected to a thin sheet of photo conducting material. When this thin layer of photo conducting material is exposed to light, its resistance varies. In absence of light a very low current called dark current flows through LDR. The resistance corresponding to this dark current called dark resistance. It is in order of few hundred mega ohm. When light falls on semiconductor electron hole pair are generated, this generated electron hole pair change the condutivity of the material and these generated electron hole pair moves in opposite direction under the influence of external electric field, if applied across it, leading to current flow.

10

APEX TECHONOLGY

The circuit is quite self explanatory. The light emitted from the LED is falls on the black or white surface. The black surface absorbs the large component of light and the white surface reflects the incident light. The reflection of light from balck and white surface is taken into account. This reflected light varies the resistance of the LDR. The LM358 OpAmp is used in the comparator mode. The LDR (receiver) is used in a potential divider in a reverse bias mode. A threshold voltage is set at the inverting terminal of the OpAmp using a potentiometer. So when the Red light reflects from a lighter surface, say white, the resistance of the light dependant resistor would decrease and this in turn when exceeds the threshold voltage will make the output of the OpAmp go high. The out put from the comparator is send to the port 1 of the microcontroller. LM358 has two OpAmps in its 8 pin package, thus two sensors could be built out of one IC. For four sensors, two LM358 used. We can also use LM 324 which has 4 OpAmps inside it.

11

APEX TECHONOLGY

MICROCONTROLLER
MICROCONTROLLRER VERSUS GENERAL PURPOSE MICROPROCESSOR: microprocessor is meant the general-purpose microprocessors such as Intels family (8086,80286,80386,80486 and the Pentium) or Motorolas 680x0 family(68000,68010,68020,68030,68040,etc.). These microprocessors contain no RAM, no ROM, and no I/O ports on the chip itself. For this reason, they are commonly referred to as general-purpose microprocessors. A system designer using a general purpose microprocessor such as the Pentium or the 68040 must add RAM, ROM, I /O ports, and timers externally to make them functional. Although the addition of external RAM, ROM, I /O ports make these systems bulkier and much more expensive, they have the advantage of versatility such that the designer can decide on the amount of RAM, ROM, I /O ports needed to fit the task at the hand. This is not the case with microcontrollers. A microcontroller has a CPU (a microprocessor) in addition to fixed amount of RAM, ROM, I /O ports, and a timer all on a single chip. In other words, the processor, RAM, ROM, I /O ports, and timer are all embedded together on one chip; therefore, the designer cannot add any external memory, I /o, or timer to it. The fixed amount of on chip ROM, RAM, and number of I/ O ports in a microcontrollers make them ideal for many applications in which cost and space are critical. In many applications, for example a TV remote control, there is no need for the computing power of a 48/6 or even an 8086 microprocessor. In many applications, the space it takes, the power it consumes, and the price per unit are much more critical considerations than the computing power. These applications most often require some I /O operations to read and turn on and off certain bits. It is interesting to note that some microcontroller manufacturers have gone as far as integrating an ADC (analog-to-digital converter) and other peripherals into the microcontroller.

12

APEX TECHONOLGY

CHOOSING A MICROCONTROLLER There are four major 8-bit microcontrollers. They are: Freescales 6811, Intels 8051, Zilogs Z8, and PIC 16X from Microchip Technology. Each of these microcontrollers has a unique instruction set and register; therefore, they are not compatible with other. Programs written for one will not run on the others. There are also 16-bit and 32-bit microcontrollers made by various chip makers. With all these different microcontrollers, what criteria do designers consider in choosing one? Three criteria in choosing microcontrollers are as follows: 1. Meeting the computing needs of the task at and efficiently and cost effectively, 2. Availability of software development tools such as compilers, assemblers, and debuggers.
3. Wide availability and reliable sources of the microcontroller.

13

APEX TECHONOLGY

STEPPER MOTORS
Motors convert electrical energy into mechanical energy. A stepper motor converts electrical pulses into specific rotational movements. The movement created by each pulse is precise and repeatable, which is why stepper motors are so effective for positioning applications. Permanent Magnet stepper motors incorporate a permanent magnet rotor, coil windings and magnetically conductive stators. Energizing a coil winding creates an electromagnetic field with a north and South Pole as shown in figure 1. The stator carries the magnetic field which causes the rotor to align itself with the magnetic field. The magnetic field can be altered by sequentially energizing or stepping the stator coils which generates rotary motion

COMMON CHARACTERISTICS OF STEPPER MOTORS Stepper motors are not just rated by voltage. The following elements characterize a given stepper motor: Voltage Stepper motors usually has a voltage rating. This is either printed directly on the unit, or is specified in the motor's datasheet. Exceeding the rated voltage is sometimes necessary to obtain the desired torque from a given motor, but doing so may produce excessive heat and/or shorten the life of the motor. Resistance Resistance-per-winding is another characteristic of a stepper motor. This resistance will determine current draw of the motor, as well as affect the motor's torque curve and maximum operating speed.

14

APEX TECHONOLGY

Degrees per step This is often the most important factor in choosing a stepper motor for a given application. This factor specifies the number of degrees the shaft will rotate for each full step. Half step operation of the motor will double the number of steps/revolution, and cut the degrees-per-step in half. For unmarked motors, it is often possible to carefully count, by hand, the number of steps per revolution of the motor. The degrees per step can be calculated by dividing 360 by the number of steps in 1 complete revolution Common degree/step numbers include: 0.72, 1.8, 3.6, 7.5, 15, and even 90. Degrees per step are often referred to as the resolution of the motor. As in the case of an unmarked motor, if a motor has only the number of steps/revolution printed on it, dividing 360 by this number will yield the degree/step value. STEPPER MOTOR WORKING Stepper motors are very different from a regular DC motors. Instead of spinning like DC motors do stepper motor steps at a specific resolution for each pulse. The motor that we are using needs 48 steps / pulses just to complete a single revolution! That should be enough to tell about its precision. Another advantage of stepper motors is the fact that their speed of rotation can be achieved almost instantly even if you change the spinning direction.

15

APEX TECHONOLGY

Stepper motor consists of a rotor - the permanent magnet that rotates inside, and stator - four coils (north, east, south, and west) that are part of the case, and which don't move. Rotor can be moved by sequentially applying a pulsed DC voltage to one or two coils at a time. The most common stepper motors have four stator windings that are paired with a center tapped common as shown. This type of stepper motor is commonly referred as a four-phase or unipolar stepper motor. The center tap allows a change of current direction in each of the two coils when a winding is grounded, thereby resulting in polarity change of the stator. We see that while a conventional motor shaft runs freely, stepper motor shaft moves in fixed repeatable increment, which allow one to move it to a precise position. This repeatable fixed movement is possible as a result of basic magnetic theory where poles of the same polarity repel and of opposite polarity attract each other. The direction of rotation is dictated by the stator poles. The stator poles are determined by the current sent through the wire coils. As the direction of current is changed, the polarity is also changed causing the reverse motion of the rotor. The stepper motor used has 6 leads: 4 leads representing 4 stator windings and 2 commons for the centre tapped leads. As the sequence of power is applied to each stator winding, the rotor will rotate. There are some widely used sequences where each has a different degree of precision. The table shows 2-phase, 4-step stepping sequence. Normal 4-step Sequence Step # 1 2 3 4 Winding A 1 1 0 0 Winding B 0 1 1 0 Winding C 0 0 1 1 Winding D 1 0 0 1

It must be noted that we can start with any of the sequences; once we start it must be in a proper sequence. For example, if we start with step 3(0110), we must continue in the sequence of steps 4, 1, 2 etc.

16

APEX TECHONOLGY

STEP ANGLE The amount of movement associated with a single step depends on the internal construction of the motor, in particular number of teeth on the stator and rotor. The step angle is the minimum angle of rotation associated with a single step. Various motors have different step angles. The table some step angles for various motors. Table: Stepper motor Step angles Step Angle 0.72 1.8 2.0 2.5 5.0 7.5 15 Steps per Revolution 500 200 180 144 72 48 24

The term steps per revolution is the total number of steps need to rotate one complete rotation or 360 degree (e.g., 180 steps*2 degree=360). STEPS PER SECOND and RPM RELATION The relation between rpm (revolutions per minute), steps per revolution and steps per second is as follows. Steps per second= rpm* steps per revolution 60

17

APEX TECHONOLGY

UNIPOLAR versus BIPOLAR stepper motor interface There are three common types of stepper motor interfacing: universal, unipolar and bipolar. They are identified by the number of connections to the motor. A universal stepper motor has eight, while unipolar has six and bipolar has four. The universal stepper motor can be configured for all three modes, while unipolar can either be unipolar or bipolar. Unipolar stepper motor can be controlled using the basic interfacing circuitry as shown, while bipolar stepper requires H-bridge circuitry. Bipolar requires high operation current than unipolar; advantage of this is a higher holding torque. ADVANTAGES OF STEPPER MOTORS Position error is noncumulative. A high accuracy of motion is possible, even under open-loop control. Large savings in sensor (measurement system) and controller costs are possible when the open-loop mode is used. Because of the incremental nature of command and motion, stepper motors are easily adaptable to digital control applications. No serious stability problems exist, even under open-loop control. Torque capacity and power requirements can be optimized and the response can be controlled by electronic switching. Brushless construction has obvious advantages. DISADVANTAGES OF STEPPER MOTORS They have low torque capacity (typically less than 2,000 oz-in) compared to DC motors. They have limited speed (limited by torque capacity and by pulse-missing problems due to faulty switching systems and drive circuits). They have high vibration levels due to stepwise motion. Large errors and oscillations can result when a pulse is missed under openloop control.

18

APEX TECHONOLGY

Here we are using unipolar magnetic motor.

Unipolar stepper motors are recognized by their centre-tapped windings. The number of phases is twice the number of coils, since each coil is divided in two. So the diagram below, which has two centre-tapped coils, represents the connection of a 4-phase unipolar stepper motor.

19

APEX TECHONOLGY

COMPONENT DETAILS
Operational Amplifier LM358
The LM358 consists of two independent, high gain, internally frequency compensated operational amplifiers which were designed specifically to operate from a single power supply over a wide range of voltages. Operation from split power supplies is also possible and the low power supply current drain is independent of the magnitude of the power supply voltage. Application areas include transducer amplifiers, dc gain blocks and all the conventional op amp circuits which now can be more easily implemented in single power supply systems. For example, the LM358 can be operated off of the standard +5V power supply voltage which is used in digital systems and will easily provide the required interface electronics without requiring the additional 15V power supplies.

Unique Characteristics 1. In the linear mode the input common-mode voltage range includes ground and the output voltage can also swing to ground, even though operated from only a single power supply voltage. 2. The unity gain cross frequency is temperature compensated. 3. The input bias current is also temperature compensated.

20

APEX TECHONOLGY

Advantages 1. Two internally compensated op amps 2. Eliminates need for dual supplies 3. Allows direct sensing near GND and VOUT also goes to GND 4. Compatible with all forms of logic 5. Power drain suitable for battery operation 6. Pin-out same as LM1558/LM1458 dual op amp Features 1. Internally frequency compensated for unity gain 2. Large dc voltage gain: 100 dB 3. Wide bandwidth (unity gain): 1MHz (Temperature compensated) 4. Wide power supply range: Single supply: 3V to 32V Or dual supplies: 1.5V to 16V 5. Very low supply current drain (500 A)essentially independent of supply voltage

21

APEX TECHONOLGY

MICROCONTROLLER
Features Compatible with MCS-51 Products

AT89S52

8K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000 Write/Erase Cycles 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz Three-level Program Memory Lock 256 x 8-bit Internal RAM 32 Programmable I/O Lines Three 16-bit Timer/Counters Eight Interrupt Sources Full Duplex UART Serial Channel Low-power Idle and Power-down Modes Interrupt Recovery from Power-down Mode Watchdog Timer Dual Data Pointer Power-off Flag Fast Programming Time Flexible ISP Programming (Byte and Page Mode) Green (Pb/Halide-free) Packaging Option

22

APEX TECHONOLGY

1. Description The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry- standard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a Sixvector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset.

23

APEX TECHONOLGY

2. Pin Configurations

24

APEX TECHONOLGY

3. Block Diagram

25

APEX TECHONOLGY

26

APEX TECHONOLGY

4. Pin Description 4.1 VCC Supply voltage. 4.2 GND Ground. 4.3 Port 0 Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups.Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification. 4.4 Port 1 Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups.In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table. 4.5 Port 2 Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special

27

APEX TECHONOLGY

Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. 4.6 Port 3

Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S52, as shown in the following table. 4.7 RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled. 4.8 ALE/PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit

28

APEX TECHONOLGY

set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode. 4.9 PSEN Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. 4.10 EA/VPP External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. 4.11 XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. 4.12 XTAL2 Output from the inverting oscillator amplifier.

29

APEX TECHONOLGY

ULN 2803
The ULN2803 consists of 8-bit TTL-input NPN Darlington sink drivers. Each Darlington Driver can handle a maximum of 500mA continuous (when using a single channel only) and can withstand a maximum 50V in its off state. This makes the ULN2803 well suited to provide an interface between the low logic level interfaces and higher current/voltage devices such as relays, solenoids, motors and lamps. The ULN2803 is designed to be compatible with standard TTL families

The output of the ULN2803 is "inverted". This means that a HIGH at the input becomes a LOW at the corresponding output line. The ULN2803 is described as an "8-line driver". This means that it contains the circuitry to control eight individual output lines, each acting independently of the others. The IC can be thought of an 8-line 'black box'. The 'schematic diagram' (above) is all we need to understand.

30

APEX TECHONOLGY

The "common" line is connected to the positive rail via a 15 volt Zener diode to prevent damage to the IC due to "back emf" when loads such as motors and relays switch ON and OFF. These Darlington arrays are furnished in 18-pin dual in-line Plastic packages (suffix A) or 18-lead small-outline plastic packages (Suffix LW). All devices are pinned with outputs opposite inputs to facilitate ease of circuit board layout. Prefix ULN devices are rated for operation over the temperature range of -20C to +85C; prefix ULQ devices are rated for operation to -40C. FEATURES Output current (Single Output) 500mA (max.) High sustaining output voltage 50mV (min.) Output clamp diodes. Input compatible with various types of logic.

31

APEX TECHONOLGY

ALGORITHM
Algorithm for Programming the Grid Robot First we under stand the algorithm for simple two sensor line follower: -Start -Check for line -If center two sensors are on line go straight -If only left sensor is on the line, turn left till both sensors are on the line -If only right sensor is on the line, turn left till both sensors are on the line

32

APEX TECHONOLGY

Let under stand the algorithm for four sensor line follower with junction detection: -Start -Check for line -If center two sensors are on line go straight -If only left sensor is on the line, turn left till both sensors are on the line -If only right sensor is on the line, turn left till both sensors are on the line -If side sensors detect line, decide which direction to turn or go straight A simple question where are the sensors placed? If 4 sensors are placed in a straight line at the front of the robot? Than

33

APEX TECHONOLGY

To overcome this problem the sensors should be placed at the centre of the wheels axel or as possible near to axel.

34

APEX TECHONOLGY

Now the question arises how to turn the robot 90 degree? There are many tricks to solve this problem Trick No. 1: The simplest approach is using Delay loops. Using delay the algorithm will be as follows - Junction detected. - Stop - Turn Left/Right (as desired) for a delay - Stop - Go Straight In this approach we need to calibrate the delay such that the motors are on till the robot completes a 90 degree turn. Well no other approach can get simpler than this while coding. After having many runs, the battery of the robot has drained out, so the motor turns at a much lower speed, but the delay generated by the software is for the same amount of time. So at a slower speed the angle turned will be less than what it was calibrated for Trick No.2 Write a program such that when it detects a junction it stops, it turns and when it turns through 90 degrees it will again detect a junction, at that time stop and go straight. Trick No.3 Another approach that we can have is that we depend on the delay for a much menial task. This is the extension to make approach no. 2 feasible. After detecting a junction, stop and turn, execute a small delay such that it turns either junction sensors are not on the junction. Then stop when both junction sensors detect the line.

35

APEX TECHONOLGY

Trick No.4 Detect the transition between the white and black areas. The algorithm in this method will be - Junction detected - Stop - Turn Left/Right - Set a variable when first transition when sensor moves over from junction to white area - Reset it when transition occurs from white to junction again at the end of desired turn - If variable reset then Stop - Go straight As we are using DC12V regulated power supply from 220V AC than there is no chance of getting weak power hence we use the first approach using delay.

36

APEX TECHONOLGY

MICROCONTROLLER PROGRAMMING
WHY PROGRAM THE 8051 IN C? Compilers produce hex files that we download into the ROM of the microcontroller. The size of the hex file produced by the compiler of microcontroller programmers, for two reasons: Microcontrollers have limited on-chip ROM. The code space for the 8051 is limited to 64KB.

How does the choice of programming language affect the compiled program size? While Assembly language is tedious and time consuming. C programming, on the other hand, is less time consuming and easier to write, but the hex file size produced is much larger than if we used Assembly language. The following are some of the major reasons for writing programs in C instead of Assembly: It is easier and less time consuming to write in C than Assembly. C is easier to modify and update. C code is portable to other microcontrollers with no modification.

TIME DELAY There are two ways to create a time delay in 8051 C: Using a simple for loop Using the 8051 timers In either case, when we write a time delay we must use the oscilloscope to measure the duration of our time delay. Next we use the for loop to create delays.

37

APEX TECHONOLGY

In creating a time delay using a for loop, we must be mindful of three factors that can affect the accuracy of the delay. 1. The 8051 design. Since the original 8051 was designed in 1980, both the fields of IC technology and microprocessor architectural design have seen great advancements. The number of machine cycles and the number of clock periods per machine cycle vary among different versions of the 8051/52 microcontroller. While the original 8051/52 design used 12 clock periods per machine cycle. 2. The crystal frequency connected to the X1-X2 input pins. The duration of clock period for the machine cycle is a function of this crystal frequency. 3. Compiler choice. The third factor that affects the time delay is the compiler used to compile the C program. When we program in Assembly language, we can control the exact instructions and their sequences used in the delay subroutine. In the case C programs, it is the compiler that converts then C statements and functions to Assembly language instructions. As a result, different compilers produce different code. In other words, if we compile a given 8051 C programs with different compilers, each compiler produce different hex code. For the above reasons, when we write time delays for C, we must use oscilloscope to measure the exact duration. I/O PROGRAMMING IN 8051 C Byte size I/O Ports P0-P3 are byte-accessible. We use the P0-P3 labels as defined in the 8051/52 C header file. Bit-addressable I/O programming The I/O ports of P0-P3 are bit addressable. We can access a single bit without distributing the rest of the port. We use the sbit data type to access a single bit of P0-P3. One way to do that is to use the Px^y format where x is the port 0, 1, 2, or 3, and y is the bit 0-7 of that port. For example, P1^7 indicates P1.7. When using this method, you need to include the reg51.h file.

38

APEX TECHONOLGY

39

APEX TECHONOLGY

PROGRAMME CODE:
#include<at89x52.h> #include<stdio.h> /* P0 for stepper control P1_2 for ldr detect */ #define ldra P1_3 #define ldrb P1_1 #define ldrc P1_2 #define ldrd P1_4 unsigned char speed=20; void delay() { unsigned char i,j; for(i=0;i<speed;i++) for(j=0;j<128;j++); } void dely(int i) //stop for 40 seconds { int j,k; for(k=0;k<i;k++) for(j=0;j<1250;j++); } void left(int i) { int k; for(k=0;k<i;k++) { P0=0x11; delay(); P0=0x33; delay(); P0=0x22; delay(); P0=0x66;
40

APEX TECHONOLGY

delay(); P0=0x44; delay(); P0=0xCC; delay(); P0=0x88; delay(); P0=0x99; delay(); } } void forw(int i) { int k; for(k=0;k<i;k++) { P0=0x91; delay(); P0=0x83; delay(); P0=0xC2; delay(); P0=0x46; delay(); P0=0x64; delay(); P0=0x2C; delay(); P0=0x38; delay(); P0=0x19; delay(); } } void leftforwmix(int i) { int k; for(k=0;k<i;k++) { P0=0x90;
41

APEX TECHONOLGY

delay(); P0=0x81; delay(); P0=0xC0; delay(); P0=0x43; delay(); P0=0x60; delay(); P0=0x22; delay(); P0=0x30; delay(); P0=0x16; delay(); P0=0x90; delay(); P0=0x84; delay(); P0=0xC0; delay(); P0=0x4C; delay(); P0=0x60; delay(); P0=0x28; delay(); P0=0x30; delay(); P0=0x19; delay(); } } void rightforwmix(int i) { int k; for(k=0;k<i;k++) {
42

APEX TECHONOLGY

P0=0x09; delay(); P0=0x91; delay(); P0=0x03; delay(); P0=0x82; delay(); P0=0x06; delay(); P0=0xC4; delay(); P0=0x0C; delay(); P0=0x48; delay(); P0=0x09; delay(); P0=0x61; delay(); P0=0x03; delay(); P0=0x22; delay(); P0=0x06; delay(); P0=0x34; delay(); P0=0x0C; delay(); P0=0x18; delay(); } } void right(int i) { int k; for(k=0;k<i;k++) {
43

APEX TECHONOLGY

P0=0x88; delay(); P0=0xCC; delay(); P0=0x44; delay(); P0=0x66; delay(); P0=0x22; delay(); P0=0x33; delay(); P0=0x11; delay(); P0=0x99; delay(); } } void takeleft() { // forw(6); right(22); forw(20); } void takeroto() { // forw(6); right(44); forw(20); } void takeright() { // forw(6); left(22); forw(20);
44

APEX TECHONOLGY

} void stop() //stop { while(P2_0!=0); } void main() {unsigned char c,d; int i=0,junction=0; P0=0x00; P1=0xFF; P2=0xFF; ira=1; irb=1; irc=1; ird=1; forw(13); while(1) { c=P1&0x1E; if(c==0x18)// if robot is at the center { c=P1&0x06; forw(1); } else if(c==0x1C)// if right misalign { c=P1&0x06; leftforwmix(1); } else if(c==0x1A)// if left misalign { c=P1&0x06; rightforwmix(1); } else if(c==0x00) { junction++; forw(10); d=P1&0x18; switch(junction) { case 2:speed=15;takeright();break;
45

APEX TECHONOLGY

case 4:speed=15;dely(5000);takeleft();break; case 7:speed=15;takeright();break; case 8:speed=15;dely(5000);break; case 9:speed=15;takeright();break; case 13:speed=15;takeright();break; case 17:speed=8;P0=0x00;stop();break; } } else { forw(1); } //P0=0x00; } }

46

APEX TECHONOLGY

P.C.B. MANUFACTURING PROCESS


It is an important process in the fabrication of electronic equipment. The design of PCBs (Printed Circuit Boards) depends on circuit requirements like noise immunity, working frequency and voltage levels etc. High power PCBs requires a special design strategy. The fabrication process to the printed circuit board will determine to a large extent the price and reliability of the equipment. A common target aimed is the fabrication of small series of highly reliable professional quality PCBs with low investment. The target becomes especially important for customer tailored equipments in the area of industrial electronics. The layout of a PCB has to incorporate all the information of the board before one can go on the artwork preparation. This means that a concept which clearly defines all the details of the circuit and partly defines the final equipment, is prerequisite before the actual lay out can start. The detailed circuit diagram is very important for the layout designer but he must also be familiar with the design concept and with the philosophy behind the equipment. BOARD TYPES: The two most popular PCB types are: 1. Single Sided Boards The single sided PCBs are mostly used in entertainment electronics where manufacturing costs have to be kept at a minimum. However in industrial electronics cost factors cannot be neglected and single sided boards should be used wherever a particular circuit can be accommodated on such boards. 2. Double Sided Boards Double-sided PCBs can be made with or without plated through holes. The production of boards with plated through holes is fairly expensive. Therefore plated through hole boards are only chosen where the circuit complexities and density of components does not leave any other choice.

47

APEX TECHONOLGY

DESIGN SPECIFICATION:
STEPS TAKEN WHILE PREPARING CIRCUIT (A) PCB DESIGNING:The main purpose of printed circuit is in the routing of electric currents and signal through a thin copper layer that is bounded firmly to an insulating base material sometimes called the substrate. This base is manufactured with an integrally bounded layer of thin copper foil which has to be partly etched or removed to arrive at a pre-designed pattern to suit the circuit connections or other applications as required. The term printed circuit board is derived from the original method where a printed pattern is used as the mask over wanted areas of copper. The PCB provides an ideal baseboard upon which to assemble and hold firmly most of the small components. From the constructors point of view, the main attraction of using PCB is its role as the mechanical support for small components. There is less need for complicated and time consuming metal work of chassis contraception except perhaps in providing the final enclosure. Most straight forward circuit designs can be easily converted in to printed wiring layer the thought required to carry out the inversion cab footed high light an possible error that would otherwise be missed in conventional point to point wiring .The finished project is usually neater and truly a work of art. Actual size PCB layout for the circuit shown is drawn on the copper board. The board is then immersed in FeCl3 solution for 12 hours. In this process only the exposed copper portion is etched out by the solution. Now the petrol washes out the paint and the copper layout on PCB is rubbed with a smooth sand paper slowly and lightly such that only the oxide layers over the Cu are removed. Now the holes are drilled at the respective places according to component layout as shown in figure.

48

APEX TECHONOLGY

LAYOUT DESIGN:When designing the layout one should observe the minimum size (component body length and weight). Before starting to design the layout we need all the required components in hand so that an accurate assessment of space can be made. Other space considerations might also be included from case to case of mounted components over the printed circuit board or to access path of present components. It might be necessary to turn some components around to a different angular position so that terminals are closer to the connections of the components. The scale can be checked by positioning the components on the squared paper. If any connection crosses, then one can reroute to avoid such condition. All common or earth lines should ideally be connected to a common line routed around the perimeter of the layout. This will act as the ground plane. If possible try to route the outer supply line to the ground plane. If possible try to route the other supply lines around the opposite edge of the layout through the center. The first set is tearing the circuit to eliminate the crossover without altering the circuit detail in any way. Plan the layout looking at the topside to this board. First this should be translated inversely; later for the etching pattern large areas are recommended to maintain good copper adhesion. It is important to bear in mind always that copper track width must be according to the recommended minimum dimensions and allowance must be made for increased width where termination holes are needed. From this aspect, it can become little tricky to negotiate the route to connect small transistors. There are basically two ways of copper interconnection patterns under side the board. The first is the removal of only the amount of copper necessary to isolate the junctions of the components to one another. The second is to make the interconnection pattern looking more like conventional point wiring by routing uniform width of copper from component to component.

49

APEX TECHONOLGY

(C)

ETCHING PROCESS:-

Etching process requires the use of chemicals. Acid resistant dishes and running water supply. Ferric chloride is mostly used solution but other etching materials such as ammonium per sulphate can be used. Nitric acid can be used but in general it is not used due to poisonous fumes. The pattern prepared is glued to the copper surface of the board using a latex type of adhesive that can be cubed after use. The pattern is laid firmly on the copper using a very sharp knife to cut round the pattern carefully to remove the paper corresponding to the required copper pattern areas. Then apply the resistant solution, which can be a kind of ink solution for the purpose of maintaining smooth clean outlines as far as possible. While the board is drying, test all the components. Before going to next stage, check the whole pattern and cross check with the circuit diagram. Check for any free metal on the copper. The etching bath should be in a glass or enamel disc. If using crystal of ferricchloride these should be thoroughly dissolved in water to the proportion suggested. There should be 0.5 lt. of water for 125 gm of crystal. To prevent particles of copper hindering further etching, agitate the solutions carefully by gently twisting or rocking the tray. The board should not be left in the bath a moment longer than is needed to remove just the right amount of copper. Inspite of there being a resistive coating there is no protection against etching away through exposed copper edges. This leads to over etching. Have running water ready so that etched board can be removed properly and rinsed. This will halt etching immediately. Drilling is one of those operations that call for great care. For most purposes a 0.5mm drill is used. Drill all holes with this size first those that need to be larger can be easily drilled again with the appropriate larger size.

50

APEX TECHONOLGY

(D) COMPONENT ASSEMBLY: From the greatest variety of electronic components available, which runs into thousands of different types it is often a perplexing task to know which is right for a given job. There could be damage such as hairline crack on PCB. If there are, then they can be repaired by soldering a short link of bare copper wire over the affected part. The most popular method of holding all the items is to bring the wires far apart after they have been inserted in the appropriate holes. This will hold the component in position ready for soldering. Some components will be considerably larger .So it is best to start mounting the smallest first and progressing through to the largest. Before starting, be certain that no further drilling is likely to be necessary because access may be impossible later. Next will probably be the resistor, small signal diodes or other similar size components. Some capacitors are also very small but it would be best to fit these afterwards. When fitting each group of components mark off each one on the circuit as it is fitted so that if we have to leave the job we know where to recommence. Although transistors and integrated circuits are small items there are good reasons for leaving the soldering of these until the last step. The main point is that these components are very sensitive to heat and if subjected to prolonged application of the soldering iron, they could be internally damaged. All the components before mounting are rubbed with sand paper so that oxide layer is removed from the tips. Now they are mounted according to the component layout.

51

APEX TECHONOLGY

(E) SOLDERING: This is the operation of joining the components with PCB after this operation the circuit will be ready to use to avoid any damage or fault during this operation following care must be taken. 1. A longer duration contact between soldering iron bit & components lead can exceed the temperature rating of device & cause partial or total damage of the device. Hence before soldering we must carefully read the maximum soldering temperature & soldering time for device. 2. The wattage of soldering iron should be selected as minimum as permissible for that soldering place. 3. To protect the devices by leakage current of iron its bit should be earthed properly. 4. We should select the soldering wire with proper ratio of Pb & Tn to provide the suitable melting temperature. 5. Proper amount of good quality flux must be applied on the soldering point to avoid dry soldering.

52

APEX TECHONOLGY

PCB LAYOUT

53

APEX TECHONOLGY

APPLICATIONS
Such robots can also be called as and function as that of an AGV (Automated Guided Vehicle). The major applications are: 1). Manufacturing Transportation of raw materials and finished products is typical in an industry. Controlled transportation and product identification, as well as safe movement throughout the facility, are the key to such type of installations. 2). Automotive the automotive industry utilizes such robots or we can say guided vehicles in a number of applications. In many assembly plants they are used for delivering the parts and kits to the assembly line, ensuring that the stations never stop the process. 3). Roll Handling Awkward rolls of paper, plastics or textiles are easily and safely be handled. Handling these rolls by the core, eye to he sky or on the bilge will drastically reduce the opportunity for product damage. 4). Towing applications We can use it for the bulk movement of the product into and out of warehouse or manufacturing/assembly operations. Chain movement of product is also popular. 5). Unit load applications unit load vehicles move individual loads, each on a specific mission. They are a very efficient means of horizontal transportation between hardware intensive material handling subsystems. The unit load carrier over moderate distances, moves high volumes of material, linking other automated subsystems in a totally integrated facility. Typically, the unit load systems involve an automatic pickup and delivery of product with remote management of vehicles.

54

APEX TECHONOLGY

COMPONENT LIST
Component ICs AT89S52 LM358 ULN2803 LM7805 LED Diode(1N4007) Capacitors 1000F/25V 10F Variable Resister (Preset 10K) 10K resistance network(Ladder) Carbon Resistors (0.25W) (10K,270K) Transformers 12V/0V/12V 1Amp PCB 6X9 IC Base 40pin 18pin 8pin Crystal(11.0592MHz) Stepper Motor Castor Wheel Soldering wire Connecting wires Plug+ wire Arena for driving robot Robot Base Ferric Chloride Miscellaneous Total Quantity 1 2 1 3 6 4 1 1 4 2 15 1 1 1 1 2 1 2 1 20gms. 2mtrs. 3mtrs. 1 1 100gms. -Rate 200/40/65/60/18/20/12/8/20/10/25/125/30/15/10/10/30/1600/50/20/30/25/100/50/30/500/3143/-

55

APEX TECHONOLGY

DATA SHEETS

56

APEX TECHONOLGY

57

APEX TECHONOLGY

58

APEX TECHONOLGY

59

APEX TECHONOLGY

60

APEX TECHONOLGY

61

APEX TECHONOLGY

62

APEX TECHONOLGY

63

APEX TECHONOLGY

64

APEX TECHONOLGY

65

APEX TECHONOLGY

66

APEX TECHONOLGY

67

APEX TECHONOLGY

68

APEX TECHONOLGY

69

APEX TECHONOLGY

70

APEX TECHONOLGY

71

APEX TECHONOLGY

72

APEX TECHONOLGY

73

APEX TECHONOLGY

74

APEX TECHONOLGY

75

APEX TECHONOLGY

76

APEX TECHONOLGY

77

APEX TECHONOLGY

78

APEX TECHONOLGY

79

APEX TECHONOLGY

80

APEX TECHONOLGY

81

APEX TECHONOLGY

82

APEX TECHONOLGY

REFERENCES
BOOKS:

AJOY KUMAR RAY & KISHOR M BHURCHANDI, Advanced Microprocessor & Interfacing, Tata McGraw Hill Publishing Company Ltd., New Delhi, 2006.

JOHN LOVINE, Robots, Androids, and Animatrons 12 Incredible Projects You Can Build, Tata McGraw Hill Publishing Company Ltd., New Delhi, 2002.

AJAY DESHMUKH, The 8051 Microcontroller, Tata McGraw Hill Publishing Company Ltd., New Delhi, 2005.

MUHAMMED ALI MAZIDI, 8051 Microcontroller & Interfacing, Prentice Hall, 2005.

MYKE PREDKO, 8051 Programming & Customizing, Tata McGraw Hill Publishing Company Ltd., New Delhi, 1999.

WEB SEARCH:

www.robotroom.com www.howstuffworks.com www.wikipedia.com www.answers.com www.datasheet.in www.nationalsemi.com www.fairchildsemi.com

83

APEX TECHONOLGY

84

You might also like