Project...Maze Robot

77
1. Introduction The Maze Robot is a kind of robot which can move in any possible direction. But, this is not the basic purpose of this robot. As the name suggests, a Maze robot can change its direction whenever any obstacle occurs in a particular direction. So Maze robot basically is a helpful device so as to explore any particular hidden region which is beyond human intervention. In the Maze robot, we have made use of certain infrared transmitters as well as receivers that continuously transmit as well as receive signals. As and when any obstacle such as wall occurs in front of the robot during its motion, receiver sends a signal to the microcontroller which sends appropriate signals to the driver IC. The driver IC starts and stops the appropriate wheels to be needed at the time. And thus the purpose of moving the robot in a direction other than the obstacle is served. The Maze robot we have designed here is a very basic form of the big Maze robots that are actual building blocks of any exploration project etc. The Maze Robot can also be upgraded with many other modifications. One of the most known modification among these is to design it in such a way that it can move on any terrain. Then it can be called as All-terrain Maze Robot. There are several techniques that can be used in solving mazes: Random Wall Following Mapping Random navigation does not seem like a very elegant way to master a maze so my choices were mapping or wall following algorithms. Mapping a maze can be very difficult to do and this competition did not really reward such a task. So that leaves wall following as the best bet to complete the maze.

Transcript of Project...Maze Robot

Page 1: Project...Maze Robot

1. Introduction

The Maze Robot is a kind of robot which can move in any possible direction. But, this is not the basic purpose of this robot. As the name suggests, a Maze robot can change its direction whenever any obstacle occurs in a particular direction. So Maze robot basically is a helpful device so as to explore any particular hidden region which is beyond human intervention.

In the Maze robot, we have made use of certain infrared transmitters as well as receivers that continuously transmit as well as receive signals. As and when any obstacle such as wall occurs in front of the robot during its motion, receiver sends a signal to the microcontroller which sends appropriate signals to the driver IC. The driver IC starts and stops the appropriate wheels to be needed at the time. And thus the purpose of moving the robot in a direction other than the obstacle is served.

The Maze robot we have designed here is a very basic form of the big Maze robots that are actual building blocks of any exploration project etc. The Maze Robot can also be upgraded with many other modifications. One of the most known modification among these is to design it in such a way that it can move on any terrain. Then it can be called as All-terrain Maze Robot.

There are several techniques that can be used in solving mazes:

Random

Wall Following

Mapping

Random navigation does not seem like a very elegant way to master a maze so my choices were mapping or wall following algorithms. Mapping a maze can be very difficult to do and this competition did not really reward such a task. So that leaves wall following as the best bet to complete the maze.

Wall following can be best explained by imagining yourself in a maze with your eyes closed. If you could place one hand on a wall and never let the hand leave the wall you will eventually find the end of the maze as long as the finish is not an island in the middle of the maze. It is very important to follow only one wall until you reach the end.

Page 2: Project...Maze Robot

The following drawings show right and left wall following paths for a given maze.

Notice that in some cases it is better to choose one wall to follow over another. Here the shortest path from start (S) to finish (F) is via the right wall. So it is good practice to be able to command your robot to follow one wall over another before it is set in the start box. This can be accomplished by using the left and right bumper switches. Tapping the left or right switch before the start commands the robot to follow the left or right wall.

So we set out to build and program a maze robot to follow one wall. We choose to use a differential drive system on a round body. This would allow us to control the robot rather easily and prevent it from getting hung up on maze walls. We mounted two GP2D02 IR Sensors on a single shaft on top of a servomotor. The sensors were positioned 90 degrees apart. The motor allowed the robot to look straight ahead and the left or right wall at the same time.

2

Page 3: Project...Maze Robot

In order to tell if the robot was getting closer or further away from a wall a minimum of two sensor readings would have to be taken over a period of time while the robot was moving. I had some difficulty in fine-tuning the reactions needed to prevent the robot from touching the walls. I quickly realized that this sensor arrangement had some shortcomings. I needed to be able to look at a wall and determine if the robot was parallel to it without moving forward. If I could achieve this, the robot would always start off parallel to a given wall. So I made some sensor placement changes that would not require the robot to be moving in order to determine if it was parallel or not.

3

Page 4: Project...Maze Robot

2. Basic Components

Sr. No. Name Value Quantity

1. Crystal Oscillator 12 MHz. 1

2. D.C. Geared Motor 45 R.P.M, 12V. 2

3. Step Down Transformer 220V-12V 1

4. Diodes(IN4007) - 4

5. Capacitor C1 100µF/25V 1 C2 10µF/16V 1

6. Resistance R1-R4 10KΩ 4 R5 6.8KΩ 1

7. Push to ON Button - 1

4

Page 5: Project...Maze Robot

Crystal Oscillator

A crystal oscillator is an electronic circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters/receivers.

A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a regularly ordered, repeating pattern extending in all three spatial dimensions.

Almost any object made of an elastic material could be used like a crystal, with appropriate transducers, since all objects have natural resonant frequencies of vibration. For example, steel is very elastic and has a high speed of sound. It was often used in mechanical filters before quartz. The resonant frequency depends on size, shape, elasticity, and the speed of sound in the material. High-frequency crystals are typically cut in the shape of a simple, rectangular plate. Low-frequency crystals, such as those used in digital watches, are typically cut in the shape of a tuning fork. For applications not needing very precise timing, a low-cost ceramic resonator is often used in place of a quartz crystal.

When a crystal of quartz is properly cut and mounted, it can be made to distort in an electric field by applying a voltage to an electrode near or on the crystal. This property is known as piezoelectricity. When the field is removed, the quartz will generate an electric field as it returns to its previous shape, and this can generate a voltage. The result is that a quartz crystal behaves like a circuit composed of an inductor, capacitor and resistor, with a precise resonant frequency.

5

Page 6: Project...Maze Robot

Quartz has the further advantage that its elastic constants and its size change in such a way that the frequency dependence on temperature can be very low. The specific characteristics will depend on the mode of vibration and the angle at which the quartz is cut (relative to its crystallographic axes). Therefore, the resonant frequency of the plate, which depends on its size, will not change much, either. This means that a quartz clock, filter or oscillator will remain accurate. For critical applications the quartz oscillator is mounted in a temperature-controlled container, called a crystal oven, and can also be mounted on shock absorbers to prevent perturbation by external mechanical vibrations.

Quartz timing crystals are manufactured for frequencies from a few tens of kilohertz to tens of megahertz. More than two billion (2×109) crystals are manufactured annually. Most are small devices for consumer devices such as wristwatches, clocks, radios, computers, and cell phones. Quartz crystals are also found inside test and measurement equipment, such as counters, signal generators, and oscilloscopes.

The crystal oscillator circuit sustains oscillation by taking a voltage signal from the quartz resonator, amplifying it, and feeding it back to the resonator. The rate of expansion and contraction of the quartz is the resonant frequency, and is determined by the cut and size of the crystal. When the energy of the generated output frequencies matches the losses in the circuit, an oscillation can be sustained.

A regular timing crystal contains two electrically conductive plates, with a slice or tuning fork of quartz crystal sandwiched between them. During startup, the circuit around the crystal applies a random noise AC signal to it, and purely by chance, a tiny fraction of the noise will be at the resonant frequency of the crystal. The crystal will therefore start oscillating in synchrony with that signal. As the oscillator amplifies the signals coming out of the crystal, the signals in the crystal's frequency band will become stronger, eventually dominating the output of the oscillator. Natural resistance in the circuit and in the quartz crystal filter out all the unwanted frequencies.

The output frequency of a quartz oscillator can be either the fundamental resonance or a multiple of the resonance, called an overtone frequency. High frequency crystals are often designed to operate at third, fifth, or seventh overtones.

A major reason for the wide use of crystal oscillators is their high Q factor. A typical Q for a quartz oscillator ranges from 104 to 106, compared to perhaps 102 for an LC oscillator. The maximum Q for a high stability quartz oscillator can be estimated as Q = 1.6 × 107/f, where f is the resonance frequency in megahertz.

One of the most important traits of quartz crystal oscillators is that they can exhibit very low phase noise. In many oscillators, any spectral energy at the resonant frequency will be amplified by the oscillator, resulting in a collection of tones at different phases. In a crystal oscillator, the crystal mostly vibrates in one axis, therefore only one phase is dominant. This property of low phase noise makes them particularly useful in telecommunications where stable signals are needed, and in scientific equipment where very precise time references are needed.

Environmental changes of temperature, humidity, pressure, and vibration can change the resonant frequency of a quartz crystal, but there are several designs that reduce these environmental effects. These include the TCXO, MCXO, and OCXO (defined below). These designs (particularly the OCXO) often produce devices with excellent short-term stability.

6

Page 7: Project...Maze Robot

The limitations in short-term stability are due mainly to noise from electronic components in the oscillator circuits. Long term stability is limited by aging of the crystal.

Due to aging and environmental factors (such as temperature and vibration), it is difficult to keep even the best quartz oscillators within one part in 10−10 of their nominal frequency without constant adjustment. For this reason, atomic oscillators are used for applications requiring better long-term stability and accuracy.

Although crystals can be fabricated for any desired resonant frequency, within technological limits, in actual practice today engineers design crystal oscillator circuits around relatively few standard frequencies, such as 3.58 MHz, 10 MHz, 14.318 MHz, 20 MHz, 33.33 MHz, and 40 MHz. The vast popularity of the 3.58 MHz and 14.318 MHz crystals is attributed initially to low cost resulting from economies of scale resulting from the popularity of television and the fact that this frequency is involved in synchronizing to the color burst signal necessary to display color on an NTSC or PAL based television set. Using frequency dividers, frequency multipliers and phase locked loop circuits, it is practical to derive a wide range of frequencies from one reference frequency.

Care must be taken to use only one crystal oscillator source when designing circuits to avoid subtle failure modes of metastability in electronics. If this is not possible, the number of distinct crystal oscillators, PLLs, and their associated clock domains should be rigorously minimized, through techniques such as using a subdivision of an existing clock instead of a new crystal source. Each new crystal source must be rigorously justified, since each one introduces new, difficult-to-debug probabilistic failure modes, due to multiple crystal interactions.

7

Page 8: Project...Maze Robot

D.C. Geared Motor

An electric motor is a device using electrical energy to produce mechanical energy, nearly always by the interaction of magnetic fields and current-carrying conductors. The reverse process, that of using mechanical energy to produce electrical energy, is accomplished by a generator or dynamo. Traction motors used on vehicles often perform both tasks.

Electric motors are found in myriad uses such as industrial fans, blowers and pumps, machine tools, household appliances, power tools, and computer disk drives, among many other applications. Electric motors may be operated by direct current from a battery in a portable device or motor vehicle, or from alternating current from a central electrical distribution grid. The smallest motors may be found in electric wristwatches. Medium-size motors of highly standardized dimensions and characteristics provide convenient mechanical power for industrial uses. The very largest electric motors are used for propulsion of large ships, and for such purposes as pipeline compressors, with ratings in the thousands of kilowatts. Electric motors may be classified by the source of electric power, by their internal construction, and by application.

The physical principle of production of mechanical force by the interaction of an electric current and a magnetic field was known as early as 1821. Electric motors of increasing efficiency were constructed throughout the 19th century, but commercial exploitation of electric motors on a large scale required efficient electrical generators and electrical distribution networks.

Geared dc motor is ideally suited to a wide range of applications requiring a combination of low speed operation and small unit size. The integral iron core DC motor provides smooth operation and a bidirectional variable speed capability while the gearhead utilizes a multistage metal spur gear train rated for a working torque up to 0.2Nm. The unit, which is suitable for mounting in any attitude, provides reliable operation over a wide ambient temperature range and is equipped with an integral VDR (voltage dependant resistor) electrical suppression system to minimize electrical interference.

The 1271 unit offers a range of gear ratio options for operating speeds from 5-200 rpm and is ideally suited to applications where small size and low unit price are important design criteria. The D.C. geared motor is used to drive the wheels of the robotic vehicle. In order to move right one motor is stopped so that it steers in the other direction.

8

Page 9: Project...Maze Robot

Features -

6 or 12Vdc operation

Ratios from 10:1 to 392:1

Rated torque up to 20Ncm

4mm Output shaft

45 rpm speed.

A DC geared motor works by converting electric power into mechanical work. This is accomplished by forcing current through a coil and producing a magnetic field that spins the motor. The simplest DC motor is a single coil apparatus, used here to discuss the DC motor theory.

The voltage source forces voltage through the coil via sliding contacts or brushes that are connected to the DC source. These brushes are found on the end of the coil wires and make a temporary electrical connection with the voltage source. In this motor, the brushes will make a connection every 180 degrees and current will then flow through the coil wires. At 0 degrees, the brushes are in contact with the voltage source and current is flowing. The current that flows through wire segment C-D interacts with the magnetic field that is present and the result is an upward force on the segment.

The current that flows through segment A-B has the same interaction, but the force is in the downward direction. Both forces are of equal magnitude, but in opposing directions since the direction of current flow in the segments is reversed with respect to the magnetic field. At 180 degrees, the same phenomenon occurs, but segment A-B is forced up and C-D is forced down. At 90 and 270-degrees, the brushes are not in contact with the voltage source and no force is produced. In these two positions, the rotational kinetic energy of the motor keeps it spinning until the brushes regain contact.

One drawback to the motor is the large amount of torque ripple that it has. The reason for this excessive ripple is because of the fact that the coil has a force pushing on it only at the 90 and 270 degree positions. The rest of the time the coil spins on its own and the torque drops to zero. The torque curve produced by this single coil, as more coils are added to the motor, the torque curve is smoothed out.

9

Page 10: Project...Maze Robot

The resulting torque curve never reaches the zero point and the average torque for the motor is greatly increased. As more and more coils are added, the torque curve approaches a straight line and has very little torque ripple and the motor runs much more smoothly. Another method of increasing the torque and rotational speed of the motor is to increase the current supplied to the coils. This is accomplished by increasing the voltage that is sent to the motor, thus increasing the current at the same time.

10

Page 11: Project...Maze Robot

Step Down Transformer

A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled electrical conductors. A changing current in the first circuit (the primary) creates a changing magnetic field. This changing magnetic field induces a changing voltage in the second circuit (the secondary). This effect is called mutual induction.

If a load is connected to the secondary circuit, electric charge will flow in the secondary winding of the transformer and transfer energy from the primary circuit to the load connected in the secondary circuit.

The secondary induced voltage (VS), of an ideal transformer, is scaled from the primary voltage (VP) by a factor equal to the ratio of the number of turns of wire in their respective windings:

By appropriate selection of the numbers of turns, a transformer thus allows an alternating voltage to be stepped up — by making NS more than NP — or stepped down, by making it less.

The transformer is based on two principles: firstly, that an electric current can produce a magnetic field (electromagnetism) and secondly that a changing magnetic field within a coil of wire induces a voltage across the ends of the coil (electromagnetic induction).

By changing the current in the primary coil, it changes the strength of its magnetic field; since the changing magnetic field extends into the secondary coil, a voltage is induced across the secondary.

11

Page 12: Project...Maze Robot

An ideal step-down transformer showing magnetic flux in the core

A simplified transformer design is shown. A current passing through the primary coil creates a magnetic field. The primary and secondary coils are wrapped around a core of very high magneti permeability, such as iron; this ensures that most of the magnetic field lines produced by the primary current are within the iron and pass through the secondary coil as well as the primary coil.

Induction law

The voltage induced across the secondary coil may be calculated from Faraday's law of induction, which states that:

where VS is the instantaneous voltage, NS is the number of turns in the secondary coil and Φ equals the magnetic flux through one turn of the coil. If the turns of the coil are oriented perpendicular to the magnetic field lines, the flux is the product of the magnetic field strength B and the area A through which it cuts. The area is constant, being equal to the cross-sectional area of the transformer core, whereas the magnetic field varies with time according to the excitation of the primary.

12

Page 13: Project...Maze Robot

Since the same magnetic flux passes through both the primary and secondary coils in an ideal transformer, the instantaneous voltage across the primary winding equals

Taking the ratio of the two equations for VS and VP gives the basic equation for stepping up or stepping down the voltage

Ideal power equation

The ideal transformer as a circuit element

If the secondary coil is attached to a load that allows current to flow, electrical power is transmitted from the primary circuit to the secondary circuit. Ideally, the transformer is perfectly efficient; all the incoming energy is transformed from the primary circuit to the magnetic field and into the secondary circuit. If this condition is met, the incoming electric power must equal the outgoing power.

13

Page 14: Project...Maze Robot

Pincoming = IPVP = Poutgoing = ISVS

giving the ideal transformer equation

If the voltage is increased (stepped up) (VS > VP), then the current is decreased (stepped down) (IS < IP) by the same factor. Transformers are efficient so this formula is a reasonable approximation.

The impedance in one circuit is transformed by the square of the turns ratio. For example, if an impedance ZS is attached across the terminals of the secondary coil, it appears to the

primary circuit to have an impedance of . This relationship is reciprocal, so that

the impedance ZP of the primary circuit appears to the secondary to be

14

Page 15: Project...Maze Robot

Diodes(IN4007)

Most modern diodes are based on semiconductor p-n junctions. In a p-n diode, conventional current can flow from the p-type side (the anode) to the n-type side (the cathode), but cannot flow in the opposite direction. Another type of semiconductor diode, the Schottky diode, is formed from the contact between a metal and a semiconductor rather than by a p-n junction.

Current–voltage characteristic

A semiconductor diode's current–voltage characteristic, or I–V curve, is related to the transport of carriers through the so-called depletion layer or depletion region that exists at the p-n junction between differing semiconductors. When a p-n junction is first created, conduction band (mobile) electrons from the N-doped region diffuse into the P-doped region where there is a large population of holes (places for electrons in which no electron is present) with which the electrons "recombine". When a mobile electron recombines with a hole, both hole and electron vanish, leaving behind an immobile positively charged donor on the N-side and negatively charged acceptor on the P-side. The region around the p-n junction becomes depleted of charge carriers and thus behaves as an insulator.

However, the depletion width cannot grow without limit. For each electron-hole pair that recombines, a positively-charged dopant ion is left behind in the N-doped region, and a negatively charged dopant ion is left behind in the P-doped region. As recombination proceeds and more ions are created, an increasing electric field develops through the depletion zone which acts to slow and then finally stop recombination. At this point, there is a "built-in" potential across the depletion zone.

15

Page 16: Project...Maze Robot

If an external voltage is placed across the diode with the same polarity as the built-in potential, the depletion zone continues to act as an insulator, preventing any significant electric current flow. This is the reverse bias phenomenon. However, if the polarity of the external voltage opposes the built-in potential, recombination can once again proceed, resulting in substantial electric current through the p-n junction. For silicon diodes, the built-in potential is approximately 0.6 V. Thus, if an external current is passed through the diode, about 0.6 V will be developed across the diode such that the P-doped region is positive with respect to the N-doped region and the diode is said to be "turned on" as it has a forward bas.

Figure : I–V characteristics of a P-N junction diode (not to scale).

A diode’s I–V characteristic can be approximated by four regions of operation

At very large reverse bias, beyond the peak inverse voltage or PIV, a process called reverse breakdown occurs which causes a large increase in current that usually damages the device permanently. The avalanche diode is deliberately designed for use in the avalanche region. In the zener diode, the concept of PIV is not applicable. A zener diode contains a heavily doped p-n junction allowing electrons to tunnel from the valence band of the p-type material to the conduction band of the n-type material, such that the reverse voltage is "clamped" to a known value (called the zener voltage), and avalanche does not occur. Both devices, however, do have a limit to the maximum current and power in the clamped reverse voltage region. Also,

16

Page 17: Project...Maze Robot

following the end of forward conduction in any diode, there is reverse current for a short time. The device does not attain its full blocking capability until the reverse current ceases.

The second region, at reverse biases more positive than the PIV, has only a very small reverse saturation current. In the reverse bias region for a normal P-N rectifier diode, the current through the device is very low (in the µA range).

The third region is forward but small bias, where only a small forward current is conducted.

As the potential difference is increased above an arbitrarily defined "cut-in voltage" or "on-voltage" or "diode forward voltage drop (Vd)", the diode current becomes appreciable (the level of current considered "appreciable" and the value of cut-in voltage depends on the application), and the diode presents a very low resistance.

The current–voltage curve is exponential. In a normal silicon diode at rated currents, the arbitrary "cut-in" voltage is defined as 0.6 to 0.7 volts. The value is different for other diode types — Schottky diodes can be as low as 0.2 V and red light-emitting diodes (LEDs) can be 1.4 V or more and blue LEDs can be up to 4.0 V.

17

Page 18: Project...Maze Robot

Capacitor

A capacitor is an electronic device which consists of two plates (electrically conductive material) separated by an insulator. The capacitor's value (its 'capacitance') is largely determined by the total surface area of the plates and the distance between the plates (determined by the insulator's thickness). A capacitor's value is commonly referred to in microfarads, one millionth of a farad. It is expressed in micro farads because the farad is such

a large amount of capacitance that it would be impractical to use in most situations. Capacitors are occasionally referred to as condensers. This term is considered archaic in English, but most other languages use a cognate of condenser to refer to a capacitor.

A capacitor's ability to store charge is measured by its capacitance C, the ratio of the amount of charge stored on each plate to the voltage:

,

For an ideal parallel plate capacitor with a plate area and a plate separation :

In SI units, a capacitor has a capacitance of one farad when one coulomb of charge stored on each plate causes a voltage difference of one volt between its plates. Since the farad is a very large unit, capacitance is usually expressed in microfarads (µF), nanofarads (nF), or picofarads (pF). In general, capacitance is greater in devices with large plate areas, separated by small distances. When a dielectric is present between two charged plates, its molecules become polarized and reduce the internal electric field and hence the voltage. This allows the capacitor to store more charge for a given voltage, so a dielectric increases the capacitance of a capacitor, by an amount given by the dielectric constant , of the material.

18

Page 19: Project...Maze Robot

Capacitor and DC Voltage:

When a DC voltage source is applied to a capacitor there is an initial surge of current, when the voltage across the terminals of the capacitor is equal to the applied voltage, the current flow stops. When the current stops flowing from the power supply to the capacitor, the capacitor is 'charged'. If the DC source is removed from the capacitor, the capacitor will retain a voltage across its terminals (it will remain charged). The capacitor can be discharged by touching the capacitor's external leads together. When using very large capacitors (1/2 farad or more) in your car, the capacitor partially discharges into the amplifier's power supply when the voltage from the alternator or battery starts to fall. Keep in mind that the discharge is only for a fraction of a second. The capacitor can not act like a battery. It only serves to fill

in what would otherwise be very small dips in the supply voltage.

Capacitor and AC Voltage:

Generally, if an AC voltage source is connected to a capacitor, the current will flow through the capacitor until the source is removed. There are exceptions to this situation and the A.C. current flow through any capacitor is dependent on the frequency of the applied A.C. signal and the value of the capacitor.Leakage:Even though a capacitor's plates are insulated from each other, there is a small amount of 'leakage' current between its plates. This current is generally insignificant but will cause a capacitor to slowly discharge with no external circuit path between the capacitor's leads.

TYPES

Film Capacitors:Many low value capacitors (less than 1 microfarad) will have a plastic type of insulator (polyethylene, polypropylene...) between the plates. Sometimes the plates are actually a metallized layer bonded onto one side of the plastic material. Multiple layers of the metalized plastic material make up the capacitor. Adding layers or increasing the size of the layers (without increasing the thickness of the layers) will increase capacitance.Electrolytic Capacitors:Electrolytic caps are more complex than film capacitors and are generally used for larger capacitance values (0.47 microfarad and higher). The electrolytic capacitor generally consists of 2 layers of aluminum foil with a layer of paper material between the plates.

19

Page 20: Project...Maze Robot

Resistors

A resistor is a two-terminal electronic component designed to oppose an electric current by producing a voltage drop between its terminals in proportion to the current, that is, in accordance with Ohm's law: V = IR. The resistance R is equal to the voltage drop V across the resistor divided by the current I through the resistor.

The resistor's function is to reduce the flow of electric current. The symbol is used to indicate a resistor in a circuit diagram, known as a schematic. Resistance value is designated in units called the "Ohm(Ω).

Resistors are characterized primarily by their resistance and the power they can dissipate. Other characteristics include temperature coefficient, noise, and inductance. Practical resistors can be made of resistive wire, and various compounds and films, and they can be integrated into hybrid and printed circuits.

Size, and position of leads are relevant to equipment designers; resistors must be physically large enough not to overheat when dissipating their power. Variable resistors, adjustable by changing the position of a tapping on the resistive element, and resistors with a movable tap ("potentiometers"), either adjustable by the user of equipment or contained within, are also used.

The resistance value of the resistor is not the only thing to consider when selecting a resistor for use in a circuit. The "tolerance" and the electric power ratings of the resistor are also important.

The tolerance of a resistor denotes how close it is to the actual rated resistence value.The maximum rated power of the resistor is specified in Watts.

20

Page 21: Project...Maze Robot

Classifications:

(1)Fixed Resistors - Variable Resistors. (2)CarbonfilmMetal

A fixed resistor is one in which the value of its resistance cannot change. And therefore a variable resistor is one the value of which can be changed according to need.

Carbon film resistors

Most general purpose, cheap resistor.Usually the tolerance of the resistance value is ±5%. Power ratings of 1/8W, 1/4W and 1/2W are frequently used.Carbon film resistors have a disadvantage; they tend to be electrically noisy. Metal film resistors are recommended for use in analog circuits.

Metal film resistors

Metal film resistors are used when a higher tolerance (more accurate value) is needed. They are much more accurate in value than carbon film resistors. They have about ±0.05% tolerance. They have about ±0.05% tolerance. I don't use any high tolerance resistors in my circuits. Resistors that are about ±1% are more than sufficient. Ni-Cr (Nichrome) seems to be used for the material of resistor. The metal film resistor is used for bridge circuits, filter circuits, and low-noise analog signal circuits.

21

Page 22: Project...Maze Robot

Resistor Colour Coding

Most axial resistors use a pattern of colored stripes to indicate resistance. Surface-mount resistors are marked numerically. Cases are usually tan, brown, blue, or green, though other colors are occasionally found such as dark red or dark gray.

The value of a resistor can be measured with an ohmmeter, which may be one function of a multimeter.

22

Page 23: Project...Maze Robot

Push to ON button

A push-button (also spelled pushbutton) or simply "button is a simple switch

mechanism for controlling some aspect of a machine or a process. Buttons are typically made

out of hard material, usually plastic or metal. The surface is usually flat or shaped to

accommodate the human finger or hand, so as to be easily depressed or pushed. Buttons are

most often biased switches, though even many un-biased buttons (due to their physical

nature) require a spring to return to their un-pushed state. Different people use different terms

for the "pushing" of the button, such as press, depress, mash, and punch.

23

Page 24: Project...Maze Robot

Microcontroller AT89C2051

The AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcomputer with 2K bytes of Flash programmable and erasable read-only memory (PEROM). The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C2051 is a power-ful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.

The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt architecture, a full duplex serial port, a precision analog comparator, on-chip oscillator and clock circuitry. In addition, the AT89C2051 is designed with static logic for opera-tion 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 hardware reset.

Features

2K Bytes of Reprogrammable Flash Memory.

2.7V to 6V Operating Range.

20 pin Microcontroller

Fully Static Operation: 0 Hz to 24 MHz

128 x 8-bit Internal RAM

15 Programmable I/O Lines

Two 16-bit Timer/Counters

Six Interrupt Sources

Direct LED Drive Outputs

On-chip Analog Comparator

24

Page 25: Project...Maze Robot

Pin Configuration

25

Page 26: Project...Maze Robot

Block Diagram

26

Page 27: Project...Maze Robot

PIN Description

1) VCC - Supply voltage.

2) GND - Ground.

3) Port 1 - The Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 to P1.7 provide

internal pull-ups. P1.0 and P1.1 require external pull-ups. P1.0 and P1.1 also serve as the

positive input (AIN0) and the negative input (AIN1), respectively, of the on-chip precision

analog comparator. The Port 1 out-put buffers can sink 20 mA and can drive LED displays

directly. When 1s are written to Port 1 pins, they can be used as inputs. When pins P1.2 to

P1.7 are used as inputs and are externally pulled low, they will source current (IIL) because of

the internal pull-ups. Port 1 also receives code data during Flash programming and

verification.

4) Port 3 - Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins with internal

pull-ups. P3.6 is hard-wired as an input to the output of the on-chip comparator and is not

accessible as a gen-eral-purpose I/O pin. The Port 3 output buffers can sink 20 mA. 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 also serves the functions of various special features of the

AT89C2051 as listed below:

27

Page 28: Project...Maze Robot

5) RST - Reset input. All I/O pins are reset to 1s as soon as RST goes high. Holding the

RST pin high for two machine cycles while the oscillator is running resets the device. Each

machine cycle takes 12 oscillator or clock cycles.

6) XTAL1 - Input to the inverting oscillator amplifier and input to the internal clock

operating circuit.

7) XTAL2 - Output from the inverting oscillator amplifier.

28

Page 29: Project...Maze Robot

Flash Programming Modes

Shift Register Mode Timing Waveforms

29

Page 30: Project...Maze Robot

2. I.C. L293D

The L293D is a quadruple push-pull 4 channel driver capable of delivering 600 mA (1.2 A peak surge) per channel. The L293D is ideal for controlling the forward/reverse/brake motions of small DC motors controlled by a microcontroller such as a PIC or BASIC Stamp.

The L293D is a high voltage, high current four channel driver designed to accept standard TTL logic levels and drive inductive loads (such as relays solenoids, DC and stepping motors) and switching power transistors. The L293D is suitable for use in switching applications at frequencies up to 5 KHz.

Features

600 mA Output Current Capability Per Driver

Pulsed Current 1.2 A / Driver

Wide Supply Voltage Range: 4.5 V to 36 V

Separate Input-Logic Supply

NE Package Designed for Heat Sinking

Thermal Shutdown & Internal ESD Protection

High-Noise-Immunity Inputs

30

Page 31: Project...Maze Robot

PIN Diagram

31

Page 32: Project...Maze Robot

Block Diagram

32

Page 33: Project...Maze Robot

Truth Table and Switching Time Graph.

33

Page 34: Project...Maze Robot

3. I.C. 7805

The 7805 I.C. is a three-terminal positive regulator I.C. available in the TO-220/D-PAK package and with fixed output voltage of 5V., making them useful in a wide range of applications. It employs internal current limiting, thermal shut down and safe operating area protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over 1A output current. Although designed primarily as fixed voltage regulators, these devices can be used with external components to obtain adjustable voltages and currents.

Features

Output Current upto 1 A.

Output voltage of 5V.

Thermal Overload Protection.

Short Circuit Protection.

Output transistor Safe Operating Area Protection.

34

Page 35: Project...Maze Robot

Absolute Maximum Ratings

Internal Block Diagram

35

Page 36: Project...Maze Robot

Electrical Characteristics

36

Page 37: Project...Maze Robot

LM324

The LM324 series are low−cost, quad operational amplifiers with true differential inputs. They have several distinct advantages over standard operational amplifier types in single supply applications. The quad amplifier can operate at supply voltages as low as 3.0 V or as high as 32 V with quiescent currents about one−fifth of those associated with the MC1741 (on a per amplifier basis).

The common mode input range includes the negative supply, thereby eliminating the necessity for external biasing components in many applications. The output voltage range also includes the negative power supply voltage.

Features

Short Circuited Protected Outputs True Differential Input Stage Single Supply Operation: 3.0 V to 32 V Low Input Bias Currents: 100 nA Maximum (LM324A) Four Amplifiers Per Package Internally Compensated Common Mode Range Extends to Negative Supply Industry Standard Pinouts ESD Clamps on the Inputs Increase Ruggedness without Affecting Device Operation NCV Prefix for Automotive and Other Applications Requiring Site and Control

Changes

37

Page 38: Project...Maze Robot

Characteristics

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

The unity gain cross frequency is temperature compensated The input bias current is also temperature compensated.

Pin diagram

38

Page 39: Project...Maze Robot

The LM124 series are op amps which operate with only a single power supply voltage, have true-differential inputs, and remain in the linear mode with an input common-mode voltage of 0 VDC. These amplifiers operate over a wide range of power supply voltage with little change in performance characteristics.

At 25°C amplifier operation is possible down to a minimum supply voltage of 2.3 VDC. The pinouts of the package have been designed to simplify PC board layouts. Inverting inputs are adjacent to outputs for all of the amplifiers and the outputs have also been placed at the corners of the package (pins 1, 7, 8, and 14). Precautions should be taken to insure that the power supply for the integrated circuit never becomes reversed in polarity or that the unit is not inadvertently installed backwards in a test socket as an unlimited current surge through the resulting forward diode within the IC could cause fusing of the internal conductors and result in a destroyed unit.

Large differential input voltages can be easily accommodated and, as input differential voltage protection diodes are not needed, no large input currents result from large differentialinput voltages. The differential input voltage may be larger than V+ without damaging the device. Protection should be provided to prevent the input voltages from going negative more than −0.3 VDC (at 25°C). An input clamp diode with a resistor to the IC input terminal can be used. To reduce the power supply drain, the amplifiers have a class A output stage for small signal levels which converts to class B in a large signal mode.

39

Page 40: Project...Maze Robot

This allows the amplifiers to both source and sink large output currents. Therefore both NPN and PNP external current boost transistors can be used to extend the power capability of the basic amplifiers. The output voltage needs to raise approximately 1 diode drop above ground to bias the on-chip vertical PNP transistor for output current sinking applications. For ac applications, where the load is capacitively coupled to the output of the amplifier, a resistor should be used, from the output of the amplifier to ground to increase the class A bias current and prevent crossover distortion.

Where the load is directly coupled, as in dc applications, there is no crossover distortion. Capacitive loads which are applied directly to the output of the amplifier reduce the loop stability margin. Values of 50 pF can be accommodated using the worst-case non inverting unity gain connection. Large closed loop gains or resistive isolation should be used if larger load capacitance must be driven by the amplifier.

40

Page 41: Project...Maze Robot

Circuit Diagram

Power Supply

41

Page 42: Project...Maze Robot

Transmitter

42

Page 43: Project...Maze Robot

Receiver

43

Page 44: Project...Maze Robot

Construction

For the construction of the Maze Robot, we firstly design the circuit in appropriate software such as Multisim. The multisim software is a great tool for rapid designing of a circuit (schematic entry and simulation). The Placement and wiring technology in the software speeds development. Thus, we used Multisim software to design the circuit for the Robotic vehicle. Through this designed circuit we obtained the PCB Layout of the circuit using a counterpart software of Multisim viz. Ultiboard. The Ultiboard software is used to obtain the PCB Layout of the circuit designed in the Multisim software.

Now, we write the coding of the device. The coding thus written is checked and tested virtually using another simulator software. But the simulator used here is for the simulation of coding while Multisim is the simulator used for the hardware of the device. The simulator software that we used for the purpose of simulation of coding is EDSIM51. In EDSIM51 there is a Assembly Code Panel in which the assembly language codes are written of the program to be used. Then these codes are run and tested for the errors, if any.

This tested coding is ready to be burnt in the Microcontroller. For this purpose, we use Universal Burner or programmer for microcontrollers. For the burning of the program in the microcontroller, firstly we use an editor to type in the program. The editor must be able to produce an ASCII file. The source file has the extension "asm" or "src", depending on the assembler used. The asm source file containing the program code is fed to the assembler, which converts the instructions into machine code. The assembler will produce an object file and a list file. The extension for the object file is "obj" while the extension for the list file is "lst". Assemblers then require linking.

The link program takes one or more object files and produces an absolute object file with the extension "abs”. The "abs" file is fed into a program called "OH" (object to hex converter), which creates a file with extension "hex" that is ready to burn into ROM using burners. Burners are the hardware that programs/writes/burns the pogram into the chip. It comes with it's own software to download stuff onto the chip. Now the Microcontroller chip is removed from the burner.

Now we take the printout of the already generated PCB Layout in order to impose the pattern on the PCB. PCB, is used to mechanically support and electrically connect electronic components using conductive pathways, or traces, etched from copper sheets laminated onto a non-conductive substrate. Thus, after obtaining the printout of the PCB Layout, we draw the exact patterns as in the printout on the zero PCB.

The patterns are drawn using a good quality marker so that when the etching is done the pattern doesn’t get hindered. The PCBs are mostly used for the purpose because they are rugged, inexpensive and highly reliable. So the exact pattern as obtained in the printout is drawn on the PCB.

44

Page 45: Project...Maze Robot

After the layout being designed on the PCB, we dip it in a solution of Water and FeCL3. Where the copper at the places where the pattern is not drawn using marker is peeled of because of the reaction occurring between the copper of the PCB and the solution. Only the patterns that were made, remains.

This is due to the fact that the patterns marked using marker are resistive in nature, due to which the solution does not react with the copper contained inside the marked patterns. And thus the copper etching is done serving the purpose of connection wires on the PCB.

Now, the drills are done at the points where the components such as ICs etc. are to be mounted and soldered. Holes through a PCB are typically drilled with tiny drill bits made of solid tungsten carbide. The drilling is performed by automated drilling machines with placement controlled by a drill tape or drill file.

These computer-generated files are also called numerically controlled drill (NCD) files or "Excellon files". The drill file describes the location and size of each drilled hole. These holes are often filled with annular rings to create vias. Vias allow the electrical and thermal connection of conductors on opposite sides of the PCB.

Finally, the components are mounted on the other side of the PCB i.e. the side other than the patterned side and then soldered carefully using solder machine. Placement of components on both sides of the board allows much higher circuit densities.

45

Page 46: Project...Maze Robot

PCB Layout

Silk Screen Top of Power Supply System.

46

Page 47: Project...Maze Robot

Copper Bottom of Power Supply System

47

Page 48: Project...Maze Robot

Copper Bottom of Maze robot

48

Page 49: Project...Maze Robot

Silk screen top of maze robot

49

Page 50: Project...Maze Robot

Working

First of all, the microcontroller AT89C2051 is loaded or programmed with the coding using a universal burner. The programming contains the specifications of each type of movement that vehicle is going to exhibit. Now when the power supply is switched on i.e. 230V comes to the power supply circuit, it firstly gets converted to 12V using a Step Down transformer. The step down transformer consists of less secondary windings as compared to primary windings, which is essential for the step down process.

This 12V voltage is now rectified i.e. converted from alternating current. to direct current using Bridge Rectifiers. A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-wave rectification. A bridge rectifier consists of 4 diodes arranged in a bridge arrangement, for one half cycle, 2 diodes operate and for the other half cycle another 2 diodes operate, thus full wave rectification is achieved.

Now this rectified supply is the passed through the capacitor to make it ripple free. The capacitor stops all the ripples coming alongwith the signal and makes it completely d.c. From this phase we get a ripple free 12V supply.

In our circuit a power supply of 5V is also needed at many places. Thus, in order to have a power supply of 5V, we use voltage regulator I.C. 7805. I.C. 7805 limits the power to +5V.Thus the 12V signal coming is directly fed to the I.C. 7805 which limits the power to +5V.

When this 5V is applied to the vcc. Pin situated at the pin 20 of the microcontroller, it gets reset. A crystal Oscillator of 12MHz. frequency is used to drive the microcontroller. Pin 10 of the microcontroller is grounded, while the pins 11,12,13,14 are connected to the I.C. L293D, which is a high voltage, high current, four channel driver I.C. designed to accept standard DTL or TTL logic levels and drive inductive loads and switching power transistors.

The pin 11 of the microcontroller is of port3, while the other pins 12,13,14 are the pins of port1. The microcontroller sends the instructions to the H-Bridge to drive the motor connected with it.

Two D.C. geared motors are connected with the driver I.C. One motor is connected at pins 3 and 6, while the other is connected at pins 11 and 14 of the driver I.C. The pins vss, chip enable1 and vcc are fed 12V supply. The pin11 of the microcontroller is connected to the pin7 that is the input2 pin of the driver I.C.

The pin 12 of microcontroller is connected to the pin2 that is input1 pin of the I.C. The pin 13 is connected to the pin 15 of the driver which is the input 4 pin and the pin14 is connected to the pin 10 which is the input 3 pin of the driver.

50

Page 51: Project...Maze Robot

When the signals are received to the driver I.C. from the microcontroller it starts working according to the instructions fed by the microcontroller and thus the motor starts running which in turn causes the wheels to move in the desired direction. The instructions are given in the following manner:

When pin 11 i.e. the pin P3.7 is high, the instructions given to the driver I.C. is of moving in forward direction.

When pin 12 i.e. the pin P1.0 is fed high the instructions given is to move in the backward direction.

Now an interrupt is given which is the instruction to stop the left motor so that only right motor works and due to this reason the vehicle steers in right direction.

When pin 13 i.e. the pin P1.1 is fed high the instruction given is to move in forward direction but this time the movement is in the right direction with respect to the above forward movement.

Now when pin 14 i.e. the pin P1.2 is fed high the instruction given is to move in backward direction.

Now an interrupt is given which is the instruction to stop the right motor so that only left motor works due to which the vehicle steers in left direction.

When pin 13 i.e. the pin P1.1 is fed high the instruction given is to move in forward direction but this time the movement is in the left direction with respect to the above forward movement.

When pin 14 i.e. the pin P1.2 is fed high the instruction given is to move in backward direction.

51

Page 52: Project...Maze Robot

The time delay between each movement is set at 1 sec. the cycle of the above described

movement continues until the power is switched off.

This was the basic working of how the maze robot will actually move. Now comes the most important thing, i.e. to change the position as and when any obstacle occurs.

The infrared transmitter of the robot keeps on sending signal in the forward direction and when any obstacle occurs the receiver sends the signals to the microcontroller AT89C2051. The microcontroller then sends the signals to the driver ic LM293D, to which the two dc geared motors are connected.

The driver ic sends the signal to one of the motors to stop working so that the robot automatically turns either right or left whichever is the appropriate direction. And if there is no way in left or right then the vehicle moves backwards. In this way the purpose of the maze robot is served.

52

Page 53: Project...Maze Robot

Block Diagram

230V Supply

Rectifier

I.C. 7805

MicrocontrollerAT89C2051

I.C. L293D

D.C. Geared Motors

Transmitter Receiver

53

Page 54: Project...Maze Robot

Coding

$ Mod 51

Var equ 0

Var equ 1

Var equ 2

Org 00H

Forward:

Set b P3.7

Clr P1.0

Set b P1.1

Clr P1.2

LCALL TTO

Backward:

Clr P3.7

Set b P1.0

Clr P1.1

Set b P1.2

LCALL TTO

54

Page 55: Project...Maze Robot

Left:

Clr P3.7

Clr P1.0

Setb P1.1

Clr P1.2

LCALL TTO

Right:

Set b P3.7

Clr P1.0

Clr P1.1

Clr P1.2

LCALL TTO

TTO:

MOV Var 3, # 8

MOV Var 2, # 161

MOV Var 1, # 115

55

Page 56: Project...Maze Robot

TT1:

DJNZ Var 1, TT1

DJNZ Var 2, TT1

DJNZ Var 3, TT1

RET

56

Page 57: Project...Maze Robot

Picture of the Maze Robot

57

Page 58: Project...Maze Robot

Picture of a Maze

58

Page 59: Project...Maze Robot

Conclusion

This device forms a sub-section to a lot other bigger and more useful applications where a robot is needed to move. This forms a lot of industrial applications. Controlling the movement of a robot is necessary for almost all type of robots, thus the device serves as a basic necessity accomplished while designing any high level robots. The device also has precise control, fast processing, reduced error rate and the most important being cost-effective.

In our project we have demonstrated the use of the interfacing of microcontrollers with other devices such as I.C. L293D. Where 4 pins of microcontroller are connected to the 4 input pins of the driver I.C. The software can be used to send any sequence of voltage pulses to the interfaced circuit.

In this project we have created simple controls for the movement of the robot. The instructions are already loaded into the microcontroller using universal burner are fed to the driver I.C. which is connected to the motors that starts rotating on the reception of the signal.

Interfacing electrical and electronic circuits with the microcontroller gives lots of advantages and scope for extended as well as extension purposes. Using this technique we can design a circuit for the higher level robots too. Even the usage of different simulators as well as emulators gave us a lot of knowledge about the working of the embedded system devices.

In a nutshell, it may be said that this project can be used very well else where i.e. in other applications and lays the basic foundation for interfacing external circuits using the microcontroller.

59

Page 60: Project...Maze Robot

References

The 8051 Microcontroller and Embedded Systems, Muhammad Ali Mazidi, Rolin D. McKinley, Edition 2004, Page No. 34-71.

Web Links Used: 1) http://www.national.com/ds/LM/LM324.2) http://www.blitzlogic.com/BOOK_51.HTM3) http://www.blitzlogic.com/Microcontrollers.HTM4) http://www.datasheetcatalog.org/datasheet/nationalsemiconductor/5) http://www.elecfree.com/electronic/ir-transmitter-by-ic-lm324/6) http://www.science-ebooks.com/electronics/MC_electronics.htm

60